summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Parse/ParseDecl.cpp12
-rw-r--r--clang/test/SemaObjC/protocol-archane.m10
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
OpenPOWER on IntegriCloud