llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.85k stars 11.47k forks source link

std::shared_mutex doesn't have capability "shared_mutex" #95063

Open fftonello opened 2 months ago

fftonello commented 2 months ago

shared_mutex is defined without the capability "shared_mutex" used for thread safety analysis. See https://cs.android.com/android/platform/superproject/main/+/main:external/libcxx/include/shared_mutex;l=180

class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex
{
…
};

Interestingly the base class has it: https://cs.android.com/android/platform/superproject/main/+/main:external/libcxx/include/shared_mutex;l=147

struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("shared_mutex"))
__shared_mutex_base
{
…
};
fftonello commented 2 months ago

I found a commit that fixed it, but unfortunately hasn't been propagated yet to other projects.

https://github.com/llvm/llvm-project/commit/5b666cf11e7a913fdfd0a65975ff587452635659