[cfe-commits] r159089 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx0x-attributes.cpp
John McCall
rjmccall at apple.com
Sat Jun 23 15:30:04 PDT 2012
Author: rjmccall
Date: Sat Jun 23 17:30:04 2012
New Revision: 159089
URL: http://llvm.org/viewvc/llvm-project?rev=159089&view=rev
Log:
Recognize GNU attributes after 'enum class'. Fixes the libc++ build.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/cxx0x-attributes.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=159089&r1=159088&r2=159089&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Jun 23 17:30:04 2012
@@ -2976,15 +2976,22 @@
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:
Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=159089&r1=159088&r2=159089&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Sat Jun 23 17:30:04 2012
@@ -207,3 +207,8 @@
for ([[]] int n : { 1, 2, 3 }) {
}
}
+
+enum class __attribute__((visibility("hidden"))) SecretKeepers {
+ one, /* rest are deprecated */ two, three
+};
+enum class [[]] EvenMoreSecrets {};
More information about the cfe-commits
mailing list