From: Steve Naroff Date: Tue, 21 Oct 2008 14:15:04 +0000 (+0000) Subject: Fix a crasher during error recovery in Parser::ParseObjCTypeName(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d7333c294d460ace3f0dd22159e3387643790b87;p=clang Fix a crasher during error recovery in Parser::ParseObjCTypeName(). Found this while fixing another unrelated radar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57904 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 10ac42718e..8487ea2338 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -635,7 +635,8 @@ Parser::TypeTy *Parser::ParseObjCTypeName(ObjCDeclSpec &DS) { MatchRHSPunctuation(tok::r_paren, LParenLoc); } } - RParenLoc = ConsumeParen(); + if (Tok.is(tok::r_paren)) + RParenLoc = ConsumeParen(); return Ty; } diff --git a/test/SemaObjC/invalid-typename.m b/test/SemaObjC/invalid-typename.m new file mode 100644 index 0000000000..9996789e21 --- /dev/null +++ b/test/SemaObjC/invalid-typename.m @@ -0,0 +1,12 @@ +// RUN: clang -fsyntax-only -verify %s + +@class NSString, NSArray; + +@protocol ISyncSessionCallback +- (oneway void)clientWithId:(bycopy NSString *)clientId + canBeginSyncingPlanWithId:(bycopy NSString *)planId + syncModes:(bycopy NSArray /* ISDSyncState */ *)syncModes + entities:(bycopy NSArray /* ISDEntity */ *)entities + truthPullers:(bycopy NSDictionary /* NSString -> [NSString] */ *)truthPullers; // expected-error{{expected ')'}} expected-error{{to match this '('}} +@end +