r174644 - Thread safety analysis: make sure that expressions in attributes are parsed

DeLesley Hutchins delesley at google.com
Thu Feb 7 11:01:07 PST 2013


Author: delesley
Date: Thu Feb  7 13:01:07 2013
New Revision: 174644

URL: http://llvm.org/viewvc/llvm-project?rev=174644&view=rev
Log:
Thread safety analysis: make sure that expressions in attributes are parsed
in an unevaluated context.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=174644&r1=174643&r2=174644&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Feb  7 13:01:07 2013
@@ -1023,6 +1023,7 @@ void Parser::ParseThreadSafetyAttribute(
 
   // 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;

Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=174644&r1=174643&r2=174644&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Thu Feb  7 13:01:07 2013
@@ -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
+





More information about the cfe-commits mailing list