]> granicus.if.org Git - clang/commitdiff
Added support for parsing declspecs on enumerations. Fixes PR8783
authorAaron Ballman <aaron@aaronballman.com>
Thu, 1 Mar 2012 04:09:28 +0000 (04:09 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 1 Mar 2012 04:09:28 +0000 (04:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151798 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Parser/MicrosoftExtensions.c

index 2d8271db407841c055f2a02d743633892681f56b..591fe9ef3d662b556168864d3967f3066a1dd923 100644 (file)
@@ -2871,6 +2871,8 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
 ///[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 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
   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;
 
index a0f15e9d86347467cf17d67bccd9b7b1aa7fd606..5f457293faef1c09b24528e1c39a20eddf43d81a 100644 (file)
@@ -49,8 +49,8 @@ char x = FOO(a);
 typedef enum E { e1 };
 
 
-
-
+enum __declspec(deprecated) E2 { i, j, k };
+__declspec(deprecated) enum E3 { a, b, c } e;
 
 
 /* Microsoft attribute tests */