case attr::SharedTrylockFunction: {
SharedTrylockFunctionAttr *A =
cast<SharedTrylockFunctionAttr>(Attr);
- getMutexIDs(ExclusiveLocksToAdd, A, Exp, FunDecl,
+ getMutexIDs(SharedLocksToAdd, A, Exp, FunDecl,
PredBlock, CurrBlock, A->getSuccessValue(), Negate);
break;
}
}; // end namespace FunctionAttrTest
+namespace TryLockTest {
+
struct TestTryLock {
Mutex mu;
int a GUARDED_BY(mu);
b = !b;
}
}
+
+ // Test merge of exclusive trylock
+ void foo11() {
+ if (cond) {
+ if (!mu.TryLock())
+ return;
+ }
+ else {
+ mu.Lock();
+ }
+ a = 10;
+ mu.Unlock();
+ }
+
+ // Test merge of shared trylock
+ void foo12() {
+ if (cond) {
+ if (!mu.ReaderTryLock())
+ return;
+ }
+ else {
+ mu.ReaderLock();
+ }
+ int i = a;
+ mu.Unlock();
+ }
}; // end TestTrylock
+} // end namespace TrylockTest
+
namespace TestTemplateAttributeInstantiation {