[PATCH] D14731: [libcxx] Add clang thread safety annotations to mutex and lock_guard

James Robinson via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 18:57:23 PDT 2016


jamesr added a comment.

In http://reviews.llvm.org/D14731#376128, @EricWF wrote:

> So I fixed up LIT so that it also adds "-Werror=thread-safety" for both ".pass.cpp" and ".fail.cpp" tests. Could you apply it to your patch?
>  https://gist.github.com/EricWF/8a0bfb6ff02f8c9f9940


Cool! Applied and confirmed that it's set for both.


================
Comment at: include/__mutex_base:37
@@ -30,1 +36,3 @@
+
+class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
 {
----------------
EricWF wrote:
> Does `capability` have a alternative keyword that's a reserved name? ie `__capability__`? If so we should use that instead.
If I'm reading https://github.com/llvm-mirror/clang/blob/master/include/clang/Basic/Attr.td#L1657 correctly:

def Capability : InheritableAttr {
  let Spellings = [GNU<"capability">, CXX11<"clang", "capability">,
                   GNU<"shared_capability">,
                   CXX11<"clang", "shared_capability">];

then the answer is unfortunately "no"


http://reviews.llvm.org/D14731





More information about the cfe-commits mailing list