Thread safety analysis: make sure that expressions in attributes are parsed
authorDeLesley Hutchins <delesley@google.com>
Thu, 7 Feb 2013 19:01:07 +0000 (19:01 +0000)
committerDeLesley Hutchins <delesley@google.com>
Thu, 7 Feb 2013 19:01:07 +0000 (19:01 +0000)
in an unevaluated context.

llvm-svn: 174644

clang/lib/Parse/ParseDecl.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp

index 8e24a14..14fd581 100644 (file)
@@ -1023,6 +1023,7 @@ void Parser::ParseThreadSafetyAttribute(IdentifierInfo &AttrName,
 
   // now parse the list of expressions
   while (Tok.isNot(tok::r_paren)) {
+    EnterExpressionEvaluationContext Unevaluated(Actions, Sema::Unevaluated);
     ExprResult ArgExpr(ParseAssignmentExpression());
     if (ArgExpr.isInvalid()) {
       ArgExprsOk = false;
index 26a3df0..3f41124 100644 (file)
@@ -3902,3 +3902,16 @@ class Foo {
 }  // end namespace TestThrowExpr
 
 
+namespace UnevaluatedContextTest {
+
+// parse attribute expressions in an unevaluated context.
+
+static inline Mutex* getMutex1();
+static inline Mutex* getMutex2();
+
+void bar() EXCLUSIVE_LOCKS_REQUIRED(getMutex1());
+
+void bar2() EXCLUSIVE_LOCKS_REQUIRED(getMutex1(), getMutex2());
+
+}  // end namespace UnevaluatedContextTest
+