summaryrefslogtreecommitdiffstats
path: root/clang/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
commit811a0f5578e3898f53724e234b66e9969ddb5aad (patch)
tree97c22a0ccebaaad9aa9dae871735bd96d41c1ab0 /clang/lib/Parse/ParseDecl.cpp
parent21836f726b34c3f1050a812f1562557e6bbe38f8 (diff)
downloadbcm5719-llvm-811a0f5578e3898f53724e234b66e9969ddb5aad.tar.gz
bcm5719-llvm-811a0f5578e3898f53724e234b66e9969ddb5aad.zip
Parse attributes on enumerators and instantiate attributes on enum decls.
llvm-svn: 117182
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 35a35f33b5c..9e430a42968 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud