[cfe-commits] r146218 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Sema/attr-availability-macosx.c

Fariborz Jahanian fjahanian at apple.com
Thu Dec 8 17:15:54 PST 2011


Author: fjahanian
Date: Thu Dec  8 19:15:54 2011
New Revision: 146218

URL: http://llvm.org/viewvc/llvm-project?rev=146218&view=rev
Log:
deprecated enum should not warn when used initializing another deprecated enumerator.
// rdar://10535640

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/Sema/attr-availability-macosx.c

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=146218&r1=146217&r2=146218&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Dec  8 19:15:54 2011
@@ -3099,6 +3099,8 @@
 
     SourceLocation EqualLoc;
     ExprResult AssignedVal;
+    ParsingDeclRAIIObject PD(*this);
+    
     if (Tok.is(tok::equal)) {
       EqualLoc = ConsumeToken();
       AssignedVal = ParseConstantExpression();
@@ -3112,6 +3114,8 @@
                                                     IdentLoc, Ident,
                                                     attrs.getList(), EqualLoc,
                                                     AssignedVal.release());
+    PD.complete(EnumConstDecl);
+    
     EnumConstantDecls.push_back(EnumConstDecl);
     LastEnumConstDecl = EnumConstDecl;
 

Modified: cfe/trunk/test/Sema/attr-availability-macosx.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-availability-macosx.c?rev=146218&r1=146217&r2=146218&view=diff
==============================================================================
--- cfe/trunk/test/Sema/attr-availability-macosx.c (original)
+++ cfe/trunk/test/Sema/attr-availability-macosx.c Thu Dec  8 19:15:54 2011
@@ -15,3 +15,17 @@
   f4(0); // expected-error{{f4' is unavailable: obsoleted in Mac OS X 10.5}}
   f5(0); // expected-error{{'f5' is unavailable: not available on Mac OS X}}
 }
+
+// rdar://10535640
+
+enum {
+    foo __attribute__((availability(macosx,introduced=8.0,deprecated=9.0)))
+};
+
+enum {
+    bar __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) = foo
+};
+
+enum __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) {
+    bar1 = foo
+};





More information about the cfe-commits mailing list