[cfe-commits] r151798 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/MicrosoftExtensions.c
Aaron Ballman
aaron at aaronballman.com
Wed Feb 29 20:09:28 PST 2012
Author: aaronballman
Date: Wed Feb 29 22:09:28 2012
New Revision: 151798
URL: http://llvm.org/viewvc/llvm-project?rev=151798&view=rev
Log:
Added support for parsing declspecs on enumerations. Fixes PR8783
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/MicrosoftExtensions.c
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=151798&r1=151797&r2=151798&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Wed Feb 29 22:09:28 2012
@@ -2871,6 +2871,8 @@
///[C99/C++]'enum' identifier[opt] '{' enumerator-list ',' '}'
/// [GNU] 'enum' attributes[opt] identifier[opt] '{' enumerator-list ',' [opt]
/// '}' attributes[opt]
+/// [MS] 'enum' __declspec[opt] identifier[opt] '{' enumerator-list ',' [opt]
+/// '}'
/// 'enum' identifier
/// [GNU] 'enum' attributes[opt] identifier
///
@@ -2916,6 +2918,10 @@
ParsedAttributes attrs(AttrFactory);
MaybeParseGNUAttributes(attrs);
+ // If declspecs exist after tag, parse them.
+ while (Tok.is(tok::kw___declspec))
+ ParseMicrosoftDeclSpec(attrs);
+
bool AllowFixedUnderlyingType
= getLang().CPlusPlus0x || getLang().MicrosoftExt || getLang().ObjC2;
Modified: cfe/trunk/test/Parser/MicrosoftExtensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.c?rev=151798&r1=151797&r2=151798&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.c (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.c Wed Feb 29 22:09:28 2012
@@ -49,8 +49,8 @@
typedef enum E { e1 };
-
-
+enum __declspec(deprecated) E2 { i, j, k };
+__declspec(deprecated) enum E3 { a, b, c } e;
/* Microsoft attribute tests */
More information about the cfe-commits
mailing list