diff options
author | Steve Naroff <snaroff@apple.com> | 2008-09-22 10:28:57 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-09-22 10:28:57 +0000 |
commit | 4f9b9f1e6848904fdeca0a9cd693940ecf566bc1 (patch) | |
tree | b484511994a13e77205a5fc3b82bb4c5df67065c | |
parent | 5950b3f93a6e8a6ae8bd59a0ef5797e9f88f0bc3 (diff) |
Fix http://llvm.org/bugs/show_bug.cgi?id=2816.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56433 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 12 | ||||
-rw-r--r-- | test/SemaObjC/protocol-archane.m | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index e81a8b87c3..80970a2f14 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -445,9 +445,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { 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 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) { 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. diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 3ace0ac3de..19736cdf50 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -12,3 +12,13 @@ void foo(id x) { [(<SomeProtocol>)x bar]; // expected-warning {{protocol qualifiers without 'id' is archaic}} } +@protocol MyProtocol +- (void)doSomething; +@end + +@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}} +@end
\ No newline at end of file |