Allow empty argument lists in thread safety attributes

llvm-svn: 146580
This commit is contained in:
DeLesley Hutchins 2011-12-14 19:36:06 +00:00
parent 8d24618975
commit 36f5d8518b
2 changed files with 11 additions and 2 deletions

View File

@ -843,7 +843,7 @@ void Parser::ParseThreadSafetyAttribute(IdentifierInfo &AttrName,
bool ArgExprsOk = true;
// now parse the list of expressions
while (1) {
while (Tok.isNot(tok::r_paren)) {
ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
ArgExprsOk = false;
@ -857,7 +857,7 @@ void Parser::ParseThreadSafetyAttribute(IdentifierInfo &AttrName,
ConsumeToken(); // Eat the comma, move to the next argument
}
// Match the ')'.
if (ArgExprsOk && !T.consumeClose()) {
if (ArgExprsOk && !T.consumeClose() && ArgExprs.size() > 0) {
Attrs.addNew(&AttrName, AttrNameLoc, 0, AttrNameLoc, 0, SourceLocation(),
ArgExprs.take(), ArgExprs.size());
}

View File

@ -1253,3 +1253,12 @@ public:
Mu mu;
};
//-------------------------
// Empty argument lists
//-------------------------
class __attribute__((lockable)) EmptyArgListsTest {
void lock() __attribute__((exclusive_lock_function())) { }
void unlock() __attribute__((unlock_function())) { }
};