[cfe-commits] r56433 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/SemaObjC/protocol-archane.m

Steve Naroff snaroff at apple.com
Mon Sep 22 03:28:58 PDT 2008


Author: snaroff
Date: Mon Sep 22 05:28:57 2008
New Revision: 56433

URL: http://llvm.org/viewvc/llvm-project?rev=56433&view=rev
Log:
Fix http://llvm.org/bugs/show_bug.cgi?id=2816.

Modified:
    cfe/trunk/lib/Parse/ParseDecl.cpp
    cfe/trunk/test/SemaObjC/protocol-archane.m

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=56433&r1=56432&r2=56433&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Sep 22 05:28:57 2008
@@ -445,9 +445,9 @@
       
       DS.SetRangeEnd(EndProtoLoc);
 
-      // Do not allow any other declspecs after the protocol qualifier list
-      // "<foo,bar>short" is not allowed.
-      goto DoneWithDeclSpec;
+      // Need to support trailing type qualifiers (e.g. "id<p> const").
+      // If a type specifier follows, it will be diagnosed elsewhere.
+      continue;
     }
     // GNU attributes support.
     case tok::kw___attribute:
@@ -585,9 +585,9 @@
 
         Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id,
              SourceRange(Loc, EndProtoLoc));
-        // Do not allow any other declspecs after the protocol qualifier list
-        // "<foo,bar>short" is not allowed.
-        goto DoneWithDeclSpec;
+        // Need to support trailing type qualifiers (e.g. "id<p> const").
+        // If a type specifier follows, it will be diagnosed elsewhere.
+        continue;
       }
     }
     // If the specifier combination wasn't legal, issue a diagnostic.

Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=56433&r1=56432&r2=56433&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-archane.m Mon Sep 22 05:28:57 2008
@@ -12,3 +12,13 @@
   [(<SomeProtocol>)x bar];      // expected-warning {{protocol qualifiers without 'id' is archaic}}
 }
 
+ at protocol MyProtocol
+- (void)doSomething;
+ at end
+
+ at interface MyClass
+- (void)m1:(id <MyProtocol> const)arg1;
+
+// FIXME: provide a better diagnostic (no typedef).
+- (void)m2:(id <MyProtocol> short)arg1; // expected-error {{'short typedef' is invalid}}
+ at end
\ No newline at end of file





More information about the cfe-commits mailing list