Fix the try_acquire_capability attribute to behave like the other try-lock functions. Fixes PR32954.

llvm-svn: 329930
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp
index 685d1ae..0456df2 100644
--- a/clang/lib/Analysis/ThreadSafety.cpp
+++ b/clang/lib/Analysis/ThreadSafety.cpp
@@ -1450,6 +1450,14 @@
   // If the condition is a call to a Trylock function, then grab the attributes
   for (const auto *Attr : FunDecl->attrs()) {
     switch (Attr->getKind()) {
+      case attr::TryAcquireCapability: {
+        auto *A = cast<TryAcquireCapabilityAttr>(Attr);
+        getMutexIDs(A->isShared() ? SharedLocksToAdd : ExclusiveLocksToAdd, A,
+                    Exp, FunDecl, PredBlock, CurrBlock, A->getSuccessValue(),
+                    Negate);
+        CapDiagKind = ClassifyDiagnostic(A);
+        break;
+      };
       case attr::ExclusiveTrylockFunction: {
         const auto *A = cast<ExclusiveTrylockFunctionAttr>(Attr);
         getMutexIDs(ExclusiveLocksToAdd, A, Exp, FunDecl,
@@ -2249,10 +2257,13 @@
                     A, nullptr, D);
         CapDiagKind = ClassifyDiagnostic(A);
       } else if (isa<ExclusiveTrylockFunctionAttr>(Attr)) {
-        // Don't try to check trylock functions for now
+        // Don't try to check trylock functions for now.
         return;
       } else if (isa<SharedTrylockFunctionAttr>(Attr)) {
-        // Don't try to check trylock functions for now
+        // Don't try to check trylock functions for now.
+        return;
+      } else if (isa<TryAcquireCapabilityAttr>(Attr)) {
+        // Don't try to check trylock functions for now.
         return;
       }
     }