summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseDecl.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 0ed245f942d..411edcc6d70 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -292,13 +292,8 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
// Ignore the left paren location for now.
ConsumeParen();
- OwningPtr<EnterExpressionEvaluationContext> Unevaluated;
ArgsVector ArgExprs;
- if (attributeParsedArgsUnevaluated(*AttrName))
- Unevaluated.reset(new EnterExpressionEvaluationContext(Actions,
- Sema::Unevaluated));
-
if (Tok.is(tok::identifier)) {
// If this attribute wants an 'identifier' argument, make it so.
bool IsIdentifierArg = attributeHasIdentifierArg(*AttrName);
@@ -322,6 +317,11 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
// Parse the non-empty comma-separated list of expressions.
do {
+ OwningPtr<EnterExpressionEvaluationContext> Unevaluated;
+ if (attributeParsedArgsUnevaluated(*AttrName))
+ Unevaluated.reset(new EnterExpressionEvaluationContext(Actions,
+ Sema::Unevaluated));
+
ExprResult ArgExpr(ParseAssignmentExpression());
if (ArgExpr.isInvalid()) {
SkipUntil(tok::r_paren, StopAtSemi);
@@ -338,6 +338,9 @@ void Parser::ParseGNUAttributeArgs(IdentifierInfo *AttrName,
Attrs.addNew(AttrName, SourceRange(AttrLoc, RParen), ScopeName, ScopeLoc,
ArgExprs.data(), ArgExprs.size(), Syntax);
}
+
+ if (EndLoc)
+ *EndLoc = RParen;
}
/// \brief Parses a single argument for a declspec, including the
OpenPOWER on IntegriCloud