r364489 - [ObjC] Improve error message for a malformed objc-type-name
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 26 16:39:23 PDT 2019
Author: epilk
Date: Wed Jun 26 16:39:23 2019
New Revision: 364489
URL: http://llvm.org/viewvc/llvm-project?rev=364489&view=rev
Log:
[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
Modified:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/test/Parser/objc-interfaces.m
cfe/trunk/test/SemaObjC/invalid-typename.m
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=364489&r1=364488&r2=364489&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Wed Jun 26 16:39:23 2019
@@ -1247,11 +1247,11 @@ ParsedType Parser::ParseObjCTypeName(Obj
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()) {
Modified: cfe/trunk/test/Parser/objc-interfaces.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/objc-interfaces.m?rev=364489&r1=364488&r2=364489&view=diff
==============================================================================
--- cfe/trunk/test/Parser/objc-interfaces.m (original)
+++ cfe/trunk/test/Parser/objc-interfaces.m Wed Jun 26 16:39:23 2019
@@ -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
+ at interface X
+-(nullable NoSuchType)foo3; // expected-error {{expected a type}}
+ at end
Modified: cfe/trunk/test/SemaObjC/invalid-typename.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/invalid-typename.m?rev=364489&r1=364488&r2=364489&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/invalid-typename.m (original)
+++ cfe/trunk/test/SemaObjC/invalid-typename.m Wed Jun 26 16:39:23 2019
@@ -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
More information about the cfe-commits
mailing list