aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-22 23:36:17 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-22 23:36:17 +0000
commit5b629aa86c987f276d00453b6c9ab8424f7903fe (patch)
tree24597767a93178761620c05731fcb6a130603146 /lib/Parse/ParseDecl.cpp
parentb164a19eb4b7f120a3ce8922587b7777ddbefde6 (diff)
Parse attributes on enumerators and instantiate attributes on enum decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 35a35f33b5..9e430a4296 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2124,6 +2124,11 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) {
IdentifierInfo *Ident = Tok.getIdentifierInfo();
SourceLocation IdentLoc = ConsumeToken();
+ // If attributes exist after the enumerator, parse them.
+ llvm::OwningPtr<AttributeList> Attr;
+ if (Tok.is(tok::kw___attribute))
+ Attr.reset(ParseGNUAttributes());
+
SourceLocation EqualLoc;
ExprResult AssignedVal;
if (Tok.is(tok::equal)) {
@@ -2137,7 +2142,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) {
Decl *EnumConstDecl = Actions.ActOnEnumConstant(getCurScope(), EnumDecl,
LastEnumConstDecl,
IdentLoc, Ident,
- EqualLoc,
+ Attr.get(), EqualLoc,
AssignedVal.release());
EnumConstantDecls.push_back(EnumConstDecl);
LastEnumConstDecl = EnumConstDecl;