r201585 - DeLesley Hutchins (who wrote the original thread-safety attribute functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used.

Aaron Ballman aaron at aaronballman.com
Tue Feb 18 09:36:51 PST 2014


Author: aaronballman
Date: Tue Feb 18 11:36:50 2014
New Revision: 201585

URL: http://llvm.org/viewvc/llvm-project?rev=201585&view=rev
Log:
DeLesley Hutchins (who wrote the original thread-safety attribute functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used.

The following attributes have been (silently) deprecated, with their replacements listed:

lockable => capability
exclusive_locks_required => requires_capability
shared_locks_required => requires_shared_capability
locks_excluded => requires_capability

There are no functional changes intended.

Added:
    cfe/trunk/test/Sema/attr-capabilities.c
Modified:
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Analysis/ThreadSafety.cpp
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Feb 18 11:36:50 2014
@@ -1279,6 +1279,7 @@ def Lockable : InheritableAttr {
   let Spellings = [GNU<"lockable">];
   let Subjects = SubjectList<[Record]>;
   let Documentation = [Undocumented];
+  let ASTNode = 0;  // Replaced by Capability
 }
 
 def ScopedLockable : InheritableAttr {
@@ -1287,6 +1288,37 @@ def ScopedLockable : InheritableAttr {
   let Documentation = [Undocumented];
 }
 
+def Capability : InheritableAttr {
+  let Spellings = [GNU<"capability">, CXX11<"clang", "capability">,
+                   GNU<"shared_capability">,
+                   CXX11<"clang", "shared_capability">];
+  let Subjects = SubjectList<[Struct], ErrorDiag, "ExpectedStruct">;
+  let Args = [StringArgument<"Name">];
+  let Accessors = [Accessor<"isShared",
+                    [GNU<"shared_capability">,
+                     CXX11<"clang","shared_capability">]>];
+  let Documentation = [Undocumented];
+}
+
+def RequiresCapability : InheritableAttr {
+  let Spellings = [GNU<"requires_capability">,
+                   CXX11<"clang", "requires_capability">,
+                   GNU<"exclusive_locks_required">,
+                   GNU<"requires_shared_capability">,
+                   CXX11<"clang", "requires_shared_capability">,
+                   GNU<"shared_locks_required">];
+  let Args = [VariadicExprArgument<"Args">];
+  let LateParsed = 1;
+  let TemplateDependent = 1;
+  let ParseArgumentsAsUnevaluated = 1;
+  let DuplicatesAllowedWhileMerging = 1;
+  let Subjects = SubjectList<[Function, FunctionTemplate]>;
+  let Accessors = [Accessor<"isShared", [GNU<"requires_shared_capability">,
+                                         GNU<"shared_locks_required">,
+                                CXX11<"clang","requires_shared_capability">]>];
+  let Documentation = [Undocumented];
+}
+
 def NoThreadSafetyAnalysis : InheritableAttr {
   let Spellings = [GNU<"no_thread_safety_analysis">];
   let Subjects = SubjectList<[Function, FunctionTemplate]>;
@@ -1437,28 +1469,6 @@ def LocksExcluded : InheritableAttr {
   let Args = [VariadicExprArgument<"Args">];
   let LateParsed = 1;
   let TemplateDependent = 1;
-  let ParseArgumentsAsUnevaluated = 1;
-  let DuplicatesAllowedWhileMerging = 1;
-  let Subjects = SubjectList<[Function, FunctionTemplate]>;
-  let Documentation = [Undocumented];
-}
-
-def ExclusiveLocksRequired : InheritableAttr {
-  let Spellings = [GNU<"exclusive_locks_required">];
-  let Args = [VariadicExprArgument<"Args">];
-  let LateParsed = 1;
-  let TemplateDependent = 1;
-  let ParseArgumentsAsUnevaluated = 1;
-  let DuplicatesAllowedWhileMerging = 1;
-  let Subjects = SubjectList<[Function, FunctionTemplate]>;
-  let Documentation = [Undocumented];
-}
-
-def SharedLocksRequired : InheritableAttr {
-  let Spellings = [GNU<"shared_locks_required">];
-  let Args = [VariadicExprArgument<"Args">];
-  let LateParsed = 1;
-  let TemplateDependent = 1;
   let ParseArgumentsAsUnevaluated = 1;
   let DuplicatesAllowedWhileMerging = 1;
   let Subjects = SubjectList<[Function, FunctionTemplate]>;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Feb 18 11:36:50 2014
@@ -2139,7 +2139,7 @@ def warn_thread_attribute_ignored : Warn
   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
 def warn_thread_attribute_argument_not_lockable : Warning<
   "%0 attribute requires arguments whose type is annotated "
-  "with 'lockable' attribute; type here is %1">,
+  "with 'capability' attribute; type here is %1">,
   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
 def warn_thread_attribute_argument_not_class : Warning<
   "%0 attribute requires arguments that are class type or point to"
@@ -2147,7 +2147,7 @@ def warn_thread_attribute_argument_not_c
   InGroup<ThreadSafetyAttributes>, DefaultIgnore;  
 def warn_thread_attribute_decl_not_lockable : Warning<
   "%0 attribute can only be applied in a context annotated "
-  "with 'lockable' attribute">,
+  "with 'capability(\"mutex\")' attribute">,
   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
 def warn_thread_attribute_decl_not_pointer : Warning<
   "%0 only applies to pointer types; type here is %1">,

Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Tue Feb 18 11:36:50 2014
@@ -2015,21 +2015,13 @@ void BuildLockset::handleCall(Expr *Exp,
         break;
       }
 
-      case attr::ExclusiveLocksRequired: {
-        ExclusiveLocksRequiredAttr *A = cast<ExclusiveLocksRequiredAttr>(At);
+      case attr::RequiresCapability: {
+        RequiresCapabilityAttr *A = cast<RequiresCapabilityAttr>(At);
 
-        for (ExclusiveLocksRequiredAttr::args_iterator
-             I = A->args_begin(), E = A->args_end(); I != E; ++I)
-          warnIfMutexNotHeld(D, Exp, AK_Written, *I, POK_FunctionCall);
-        break;
-      }
-
-      case attr::SharedLocksRequired: {
-        SharedLocksRequiredAttr *A = cast<SharedLocksRequiredAttr>(At);
-
-        for (SharedLocksRequiredAttr::args_iterator I = A->args_begin(),
+        for (RequiresCapabilityAttr::args_iterator I = A->args_begin(),
              E = A->args_end(); I != E; ++I)
-          warnIfMutexNotHeld(D, Exp, AK_Read, *I, POK_FunctionCall);
+          warnIfMutexNotHeld(D, Exp, A->isShared() ? AK_Read : AK_Written, *I,
+                             POK_FunctionCall);
         break;
       }
 
@@ -2390,12 +2382,9 @@ void ThreadSafetyAnalyzer::runAnalysis(A
     for (unsigned i = 0; i < ArgAttrs.size(); ++i) {
       Attr *Attr = ArgAttrs[i];
       Loc = Attr->getLocation();
-      if (ExclusiveLocksRequiredAttr *A
-            = dyn_cast<ExclusiveLocksRequiredAttr>(Attr)) {
-        getMutexIDs(ExclusiveLocksToAdd, A, (Expr*) 0, D);
-      } else if (SharedLocksRequiredAttr *A
-                   = dyn_cast<SharedLocksRequiredAttr>(Attr)) {
-        getMutexIDs(SharedLocksToAdd, A, (Expr*) 0, D);
+      if (RequiresCapabilityAttr *A = dyn_cast<RequiresCapabilityAttr>(Attr)) {
+        getMutexIDs(A->isShared() ? SharedLocksToAdd : ExclusiveLocksToAdd, A,
+                    0, D);
       } else if (UnlockFunctionAttr *A = dyn_cast<UnlockFunctionAttr>(Attr)) {
         // UNLOCK_FUNCTION() is used to hide the underlying lock implementation.
         // We must ignore such methods.

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Feb 18 11:36:50 2014
@@ -367,7 +367,7 @@ static const RecordType *getRecordType(Q
 static bool checkBaseClassIsLockableCallback(const CXXBaseSpecifier *Specifier,
                                              CXXBasePath &Path, void *Unused) {
   const RecordType *RT = Specifier->getType()->getAs<RecordType>();
-  return RT->getDecl()->hasAttr<LockableAttr>();
+  return RT->getDecl()->hasAttr<CapabilityAttr>();
 }
 
 
@@ -395,7 +395,7 @@ static void checkForLockableRecord(Sema
 
   // Check if the type is lockable.
   RecordDecl *RD = RT->getDecl();
-  if (RD->hasAttr<LockableAttr>())
+  if (RD->hasAttr<CapabilityAttr>())
     return;
 
   // Else check if any base classes are lockable.
@@ -548,7 +548,7 @@ static bool checkAcquireOrderAttrCommon(
   QualType QT = cast<ValueDecl>(D)->getType();
   if (!QT->isDependentType()) {
     const RecordType *RT = getRecordType(QT);
-    if (!RT || !RT->getDecl()->hasAttr<LockableAttr>()) {
+    if (!RT || !RT->getDecl()->hasAttr<CapabilityAttr>()) {
       S.Diag(Attr.getLoc(), diag::warn_thread_attribute_decl_not_lockable)
         << Attr.getName();
       return false;
@@ -698,46 +698,6 @@ static void handleExclusiveTrylockFuncti
                                           Attr.getAttributeSpellingListIndex()));
 }
 
-static bool checkLocksRequiredCommon(Sema &S, Decl *D,
-                                     const AttributeList &Attr,
-                                     SmallVectorImpl<Expr *> &Args) {
-  if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
-    return false;
-
-  // check that all arguments are lockable objects
-  checkAttrArgsAreLockableObjs(S, D, Attr, Args);
-  if (Args.empty())
-    return false;
-
-  return true;
-}
-
-static void handleExclusiveLocksRequiredAttr(Sema &S, Decl *D,
-                                             const AttributeList &Attr) {
-  SmallVector<Expr*, 1> Args;
-  if (!checkLocksRequiredCommon(S, D, Attr, Args))
-    return;
-
-  Expr **StartArg = &Args[0];
-  D->addAttr(::new (S.Context)
-             ExclusiveLocksRequiredAttr(Attr.getRange(), S.Context,
-                                        StartArg, Args.size(),
-                                        Attr.getAttributeSpellingListIndex()));
-}
-
-static void handleSharedLocksRequiredAttr(Sema &S, Decl *D,
-                                          const AttributeList &Attr) {
-  SmallVector<Expr*, 1> Args;
-  if (!checkLocksRequiredCommon(S, D, Attr, Args))
-    return;
-
-  Expr **StartArg = &Args[0];
-  D->addAttr(::new (S.Context)
-             SharedLocksRequiredAttr(Attr.getRange(), S.Context,
-                                     StartArg, Args.size(),
-                                     Attr.getAttributeSpellingListIndex()));
-}
-
 static void handleUnlockFunAttr(Sema &S, Decl *D,
                                 const AttributeList &Attr) {
   // zero or more arguments ok
@@ -3929,6 +3889,40 @@ Sema::mergeMSInheritanceAttr(Decl *D, So
       MSInheritanceAttr(Range, Context, BestCase, AttrSpellingListIndex);
 }
 
+static void handleCapabilityAttr(Sema &S, Decl *D, const AttributeList &Attr) {
+  // The capability attributes take a single string parameter for the name of
+  // the capability they represent. The lockable attribute does not take any
+  // parameters. However, semantically, both attributes represent the same
+  // concept, and so they use the same semantic attribute. Eventually, the
+  // lockable attribute will be removed.
+  StringRef N;
+  SourceLocation LiteralLoc;
+  if (Attr.getKind() == AttributeList::AT_Capability &&
+      !S.checkStringLiteralArgumentAttr(Attr, 0, N, &LiteralLoc))
+    return;
+
+  D->addAttr(::new (S.Context) CapabilityAttr(Attr.getRange(), S.Context, N,
+                                        Attr.getAttributeSpellingListIndex()));
+}
+
+static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
+                                         const AttributeList &Attr) {
+  if (!checkAttributeAtLeastNumArgs(S, Attr, 1))
+    return;
+
+  // check that all arguments are lockable objects
+  SmallVector<Expr*, 1> Args;
+  checkAttrArgsAreLockableObjs(S, D, Attr, Args);
+  if (Args.empty())
+    return;
+
+  RequiresCapabilityAttr *RCA = ::new (S.Context)
+    RequiresCapabilityAttr(Attr.getRange(), S.Context, Args.data(),
+                           Args.size(), Attr.getAttributeSpellingListIndex());
+
+  D->addAttr(RCA);
+}
+
 /// Handles semantic checking for features that are common to all attributes,
 /// such as checking whether a parameter was properly specified, or the correct
 /// number of arguments were passed, etc.
@@ -4243,8 +4237,6 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_NoSanitizeMemory:
     handleSimpleAttribute<NoSanitizeMemoryAttr>(S, D, Attr);
     break;
-  case AttributeList::AT_Lockable:
-    handleSimpleAttribute<LockableAttr>(S, D, Attr); break;
   case AttributeList::AT_GuardedBy:
     handleGuardedByAttr(S, D, Attr);
     break;
@@ -4254,9 +4246,6 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_ExclusiveLockFunction:
     handleExclusiveLockFunctionAttr(S, D, Attr);
     break;
-  case AttributeList::AT_ExclusiveLocksRequired:
-    handleExclusiveLocksRequiredAttr(S, D, Attr);
-    break;
   case AttributeList::AT_ExclusiveTrylockFunction:
     handleExclusiveTrylockFunctionAttr(S, D, Attr);
     break;
@@ -4269,9 +4258,6 @@ static void ProcessDeclAttribute(Sema &S
   case AttributeList::AT_SharedLockFunction:
     handleSharedLockFunctionAttr(S, D, Attr);
     break;
-  case AttributeList::AT_SharedLocksRequired:
-    handleSharedLocksRequiredAttr(S, D, Attr);
-    break;
   case AttributeList::AT_SharedTrylockFunction:
     handleSharedTrylockFunctionAttr(S, D, Attr);
     break;
@@ -4285,6 +4271,13 @@ static void ProcessDeclAttribute(Sema &S
     handleAcquiredAfterAttr(S, D, Attr);
     break;
 
+  // Capability analysis attributes.
+  case AttributeList::AT_Capability:
+  case AttributeList::AT_Lockable:
+    handleCapabilityAttr(S, D, Attr); break;
+  case AttributeList::AT_RequiresCapability:
+    handleRequiresCapabilityAttr(S, D, Attr); break;
+
   // Consumed analysis attributes.
   case AttributeList::AT_Consumable:
     handleConsumableAttr(S, D, Attr);

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Feb 18 11:36:50 2014
@@ -12749,12 +12749,9 @@ bool Sema::checkThisInStaticMemberFuncti
       Arg = LR->getArg();
     else if (LocksExcludedAttr *LE = dyn_cast<LocksExcludedAttr>(*A))
       Args = ArrayRef<Expr *>(LE->args_begin(), LE->args_size());
-    else if (ExclusiveLocksRequiredAttr *ELR 
-               = dyn_cast<ExclusiveLocksRequiredAttr>(*A))
-      Args = ArrayRef<Expr *>(ELR->args_begin(), ELR->args_size());
-    else if (SharedLocksRequiredAttr *SLR 
-               = dyn_cast<SharedLocksRequiredAttr>(*A))
-      Args = ArrayRef<Expr *>(SLR->args_begin(), SLR->args_size());
+    else if (RequiresCapabilityAttr *RC
+               = dyn_cast<RequiresCapabilityAttr>(*A))
+      Args = ArrayRef<Expr *>(RC->args_begin(), RC->args_size());
 
     if (Arg && !Finder.TraverseStmt(Arg))
       return true;

Added: cfe/trunk/test/Sema/attr-capabilities.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-capabilities.c?rev=201585&view=auto
==============================================================================
--- cfe/trunk/test/Sema/attr-capabilities.c (added)
+++ cfe/trunk/test/Sema/attr-capabilities.c Tue Feb 18 11:36:50 2014
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -Wthread-safety -verify %s
+
+struct __attribute__((capability("thread role"))) ThreadRole {};
+struct __attribute__((shared_capability("mutex"))) Mutex {};
+struct NotACapability {};
+
+int Test1 __attribute__((capability("test1")));  // expected-error {{'capability' attribute only applies to structs}}
+int Test2 __attribute__((shared_capability("test2"))); // expected-error {{'shared_capability' attribute only applies to structs}}
+
+struct __attribute__((capability(12))) Test3 {}; // expected-error {{'capability' attribute requires a string}}
+struct __attribute__((shared_capability(Test2))) Test4 {}; // expected-error {{'shared_capability' attribute requires a string}}
+
+struct __attribute__((capability)) Test5 {}; // expected-error {{'capability' attribute takes one argument}}
+struct __attribute__((shared_capability("test1", 12))) Test6 {}; // expected-error {{'shared_capability' attribute takes one argument}}
+
+struct NotACapability BadCapability;
+struct ThreadRole GUI, Worker;
+void Func1(void) __attribute__((requires_capability(GUI))) {}
+void Func2(void) __attribute__((requires_shared_capability(Worker))) {}
+
+void Func3(void) __attribute__((requires_capability)) {}  // expected-error {{'requires_capability' attribute takes at least 1 argument}}
+void Func4(void) __attribute__((requires_shared_capability)) {}  // expected-error {{'requires_shared_capability' attribute takes at least 1 argument}}
+
+void Func5(void) __attribute__((requires_capability(1))) {}  // expected-warning {{'requires_capability' attribute requires arguments that are class type or point to class type}}
+void Func6(void) __attribute__((requires_shared_capability(BadCapability))) {}  // expected-warning {{'requires_shared_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'struct NotACapability'}}

Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp?rev=201585&r1=201584&r2=201585&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-parsing.cpp Tue Feb 18 11:36:50 2014
@@ -359,7 +359,7 @@ int gb_var_arg_bad_2 GUARDED_BY("mu"); /
 int gb_var_arg_bad_3 GUARDED_BY(muDoublePointer); // \
   // expected-warning {{'guarded_by' attribute requires arguments that are class type or point to class type; type here is 'Mutex **'}}
 int gb_var_arg_bad_4 GUARDED_BY(umu); // \
-  // expected-warning {{'guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute; type here is 'UnlockableMu'}}
+  // expected-warning {{'guarded_by' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'UnlockableMu'}}
 
 //3.
 // Thread Safety analysis tests
@@ -430,7 +430,7 @@ int * pgb_var_arg_bad_2 PT_GUARDED_BY("m
 int * pgb_var_arg_bad_3 PT_GUARDED_BY(muDoublePointer); // \
   // expected-warning {{'pt_guarded_by' attribute requires arguments that are class type or point to class type}}
 int * pgb_var_arg_bad_4 PT_GUARDED_BY(umu); // \
-  // expected-warning {{'pt_guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'pt_guarded_by' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 //-----------------------------------------//
@@ -491,9 +491,9 @@ Mutex aa_var_arg_bad_2 ACQUIRED_AFTER("m
 Mutex aa_var_arg_bad_3 ACQUIRED_AFTER(muDoublePointer); // \
   // expected-warning {{'acquired_after' attribute requires arguments that are class type or point to class type}}
 Mutex aa_var_arg_bad_4 ACQUIRED_AFTER(umu); // \
-  // expected-warning {{'acquired_after' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'acquired_after' attribute requires arguments whose type is annotated with 'capability' attribute}}
 UnlockableMu aa_var_arg_bad_5 ACQUIRED_AFTER(mu_aa); // \
-  // expected-warning {{'acquired_after' attribute can only be applied in a context annotated with 'lockable' attribute}}
+  // expected-warning {{'acquired_after' attribute can only be applied in a context annotated with 'capability("mutex")' attribute}}
 
 //-----------------------------------------//
 //  Acquired Before (ab)
@@ -554,9 +554,9 @@ Mutex ab_var_arg_bad_2 ACQUIRED_BEFORE("
 Mutex ab_var_arg_bad_3 ACQUIRED_BEFORE(muDoublePointer); // \
   // expected-warning {{'acquired_before' attribute requires arguments that are class type or point to class type}}
 Mutex ab_var_arg_bad_4 ACQUIRED_BEFORE(umu); // \
-  // expected-warning {{'acquired_before' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'acquired_before' attribute requires arguments whose type is annotated with 'capability' attribute}}
 UnlockableMu ab_var_arg_bad_5 ACQUIRED_BEFORE(mu_ab); // \
-  // expected-warning {{'acquired_before' attribute can only be applied in a context annotated with 'lockable' attribute}}
+  // expected-warning {{'acquired_before' attribute can only be applied in a context annotated with 'capability("mutex")' attribute}}
 
 
 //-----------------------------------------//
@@ -619,7 +619,7 @@ int elf_function_bad_2() EXCLUSIVE_LOCK_
 int elf_function_bad_3() EXCLUSIVE_LOCK_FUNCTION(muDoublePointer); // \
   // expected-warning {{'exclusive_lock_function' attribute requires arguments that are class type or point to class type}}
 int elf_function_bad_4() EXCLUSIVE_LOCK_FUNCTION(umu); // \
-  // expected-warning {{'exclusive_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'exclusive_lock_function' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 int elf_function_bad_1() EXCLUSIVE_LOCK_FUNCTION(1); // \
   // expected-error {{'exclusive_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}}
@@ -691,7 +691,7 @@ int slf_function_bad_2() SHARED_LOCK_FUN
 int slf_function_bad_3() SHARED_LOCK_FUNCTION(muDoublePointer); // \
   // expected-warning {{'shared_lock_function' attribute requires arguments that are class type or point to class type}}
 int slf_function_bad_4() SHARED_LOCK_FUNCTION(umu); // \
-  // expected-warning {{'shared_lock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'shared_lock_function' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 int slf_function_bad_1() SHARED_LOCK_FUNCTION(1); // \
   // expected-error {{'shared_lock_function' attribute parameter 1 is out of bounds: no parameters to index into}}
@@ -773,7 +773,7 @@ int etf_function_bad_4() EXCLUSIVE_TRYLO
 int etf_function_bad_5() EXCLUSIVE_TRYLOCK_FUNCTION(1, muDoublePointer); // \
   // expected-warning {{'exclusive_trylock_function' attribute requires arguments that are class type or point to class type}}
 int etf_function_bad_6() EXCLUSIVE_TRYLOCK_FUNCTION(1, umu); // \
-  // expected-warning {{'exclusive_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'exclusive_trylock_function' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 //-----------------------------------------//
@@ -847,7 +847,7 @@ int stf_function_bad_4() SHARED_TRYLOCK_
 int stf_function_bad_5() SHARED_TRYLOCK_FUNCTION(1, muDoublePointer); // \
   // expected-warning {{'shared_trylock_function' attribute requires arguments that are class type or point to class type}}
 int stf_function_bad_6() SHARED_TRYLOCK_FUNCTION(1, umu); // \
-  // expected-warning {{'shared_trylock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'shared_trylock_function' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 //-----------------------------------------//
@@ -910,7 +910,7 @@ int uf_function_bad_2() UNLOCK_FUNCTION(
 int uf_function_bad_3() UNLOCK_FUNCTION(muDoublePointer); // \
   // expected-warning {{'unlock_function' attribute requires arguments that are class type or point to class type}}
 int uf_function_bad_4() UNLOCK_FUNCTION(umu); // \
-  // expected-warning {{'unlock_function' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'unlock_function' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 int uf_function_bad_1() UNLOCK_FUNCTION(1); // \
   // expected-error {{'unlock_function' attribute parameter 1 is out of bounds: no parameters to index into}}
@@ -986,7 +986,7 @@ int lr_function_bad_2() LOCK_RETURNED("m
 int lr_function_bad_3() LOCK_RETURNED(muDoublePointer); // \
   // expected-warning {{'lock_returned' attribute requires arguments that are class type or point to class type}}
 int lr_function_bad_4() LOCK_RETURNED(umu); // \
-  // expected-warning {{'lock_returned' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'lock_returned' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 
@@ -1053,7 +1053,7 @@ int le_function_bad_2() LOCKS_EXCLUDED("
 int le_function_bad_3() LOCKS_EXCLUDED(muDoublePointer); // \
   // expected-warning {{'locks_excluded' attribute requires arguments that are class type or point to class type}}
 int le_function_bad_4() LOCKS_EXCLUDED(umu); // \
-  // expected-warning {{'locks_excluded' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'locks_excluded' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 
@@ -1120,7 +1120,7 @@ int elr_function_bad_2() EXCLUSIVE_LOCKS
 int elr_function_bad_3() EXCLUSIVE_LOCKS_REQUIRED(muDoublePointer); // \
   // expected-warning {{'exclusive_locks_required' attribute requires arguments that are class type or point to class type}}
 int elr_function_bad_4() EXCLUSIVE_LOCKS_REQUIRED(umu); // \
-  // expected-warning {{'exclusive_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'exclusive_locks_required' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 
@@ -1188,7 +1188,7 @@ int slr_function_bad_2() SHARED_LOCKS_RE
 int slr_function_bad_3() SHARED_LOCKS_REQUIRED(muDoublePointer); // \
   // expected-warning {{'shared_locks_required' attribute requires arguments that are class type or point to class type}}
 int slr_function_bad_4() SHARED_LOCKS_REQUIRED(umu); // \
-  // expected-warning {{'shared_locks_required' attribute requires arguments whose type is annotated with 'lockable' attribute}}
+  // expected-warning {{'shared_locks_required' attribute requires arguments whose type is annotated with 'capability' attribute}}
 
 
 //-----------------------------------------//
@@ -1430,7 +1430,7 @@ class Foo {
   int a GUARDED_BY(mu1_);
   int b GUARDED_BY(mu2_);
   int c GUARDED_BY(mu3_);  // \
-    // expected-warning {{'guarded_by' attribute requires arguments whose type is annotated with 'lockable' attribute; type here is 'InheritanceTest::Derived3'}}
+    // expected-warning {{'guarded_by' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'InheritanceTest::Derived3'}}
 
   void foo() EXCLUSIVE_LOCKS_REQUIRED(mu1_, mu2_) {
     a = 0;





More information about the cfe-commits mailing list