diff options
author | John McCall <rjmccall@apple.com> | 2012-06-23 22:30:04 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-06-23 22:30:04 +0000 |
commit | 1e12b3d777b36b80527da566192f8aeefad8f9d4 (patch) | |
tree | ccc8cd80ed8b0d7e7b28ca3123d49a012f2a3422 /lib/Parse/ParseDecl.cpp | |
parent | 33e6c2da2f72720ee6a34c6acd2a3e5ad37feca9 (diff) |
Recognize GNU attributes after 'enum class'. Fixes the libc++ build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 8c24f9761f..96c57581e8 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2976,15 +2976,22 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, SourceLocation ScopedEnumKWLoc; bool IsScopedUsingClassTag = false; + // In C++11, recognize 'enum class' and 'enum struct'. if (getLangOpts().CPlusPlus0x && (Tok.is(tok::kw_class) || Tok.is(tok::kw_struct))) { Diag(Tok, diag::warn_cxx98_compat_scoped_enum); IsScopedUsingClassTag = Tok.is(tok::kw_class); ScopedEnumKWLoc = ConsumeToken(); + // Attributes are not allowed between these keywords. Diagnose, + // but then just treat them like they appeared in the right place. ProhibitAttributes(attrs); - // Recovery: assume that the attributes came after the tag. + + // They are allowed afterwards, though. + MaybeParseGNUAttributes(attrs); MaybeParseCXX0XAttributes(attrs); + while (Tok.is(tok::kw___declspec)) + ParseMicrosoftDeclSpec(attrs); } // C++11 [temp.explicit]p12: |