[ObjC] Improve error message for a malformed objc-type-name

If the type didn't exist, we used to emit a really bad error:

t.m:3:12: error: expected ')'
-(nullable NoSuchType)foo3;
           ^

rdar://50925632

llvm-svn: 364489
This commit is contained in:
Erik Pilkington 2019-06-26 23:39:23 +00:00
parent f34711d9a0
commit d7999cbc6e
3 changed files with 5 additions and 2 deletions

View File

@ -1247,11 +1247,11 @@ ParsedType Parser::ParseObjCTypeName(ObjCDeclSpec &DS,
BalancedDelimiterTracker T(*this, tok::l_paren);
T.consumeOpen();
SourceLocation TypeStartLoc = Tok.getLocation();
ObjCDeclContextSwitch ObjCDC(*this);
// Parse type qualifiers, in, inout, etc.
ParseObjCTypeQualifierList(DS, context);
SourceLocation TypeStartLoc = Tok.getLocation();
ParsedType Ty;
if (isTypeSpecifierQualifier() || isObjCInstancetype()) {

View File

@ -6,3 +6,6 @@
- (int*) foo2 __attribute__((deprecated)) : (int) x1 __attribute__((deprecated)); // expected-error {{expected ';' after method prototype}} expected-error {{method type specifier must start with '-' or '+'}}
@end
@interface X
-(nullable NoSuchType)foo3; // expected-error {{expected a type}}
@end

View File

@ -7,6 +7,6 @@
canBeginSyncingPlanWithId:(bycopy NSString *)planId
syncModes:(bycopy NSArray /* ISDSyncState */ *)syncModes
entities:(bycopy NSArray /* ISDEntity */ *)entities
truthPullers:(bycopy NSDictionary /* NSString -> [NSString] */ *)truthPullers; // expected-error{{expected ')'}} expected-note {{to match this '('}}
truthPullers:(bycopy NSDictionary /* NSString -> [NSString] */ *)truthPullers; // expected-error {{expected a type}}
@end