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 | cd5e782bce0f1c93757f170a80da3d3a69abee50 (patch) | |
tree | b8e5f5b2f12f8d129269753f918500b8dbe9e6bb /clang | |
parent | 73a5406d246185d79cd3448eed94244c2092a48f (diff) | |
download | bcm5719-llvm-cd5e782bce0f1c93757f170a80da3d3a69abee50.tar.gz bcm5719-llvm-cd5e782bce0f1c93757f170a80da3d3a69abee50.zip |
Fix http://llvm.org/bugs/show_bug.cgi?id=2816.
llvm-svn: 56433
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 12 | ||||
-rw-r--r-- | clang/test/SemaObjC/protocol-archane.m | 10 |
2 files changed, 16 insertions, 6 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index e81a8b87c39..80970a2f14d 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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/clang/test/SemaObjC/protocol-archane.m b/clang/test/SemaObjC/protocol-archane.m index 3ace0ac3de0..19736cdf505 100644 --- a/clang/test/SemaObjC/protocol-archane.m +++ b/clang/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 |