]> granicus.if.org Git - clang/commitdiff
Fix a crasher during error recovery in Parser::ParseObjCTypeName().
authorSteve Naroff <snaroff@apple.com>
Tue, 21 Oct 2008 14:15:04 +0000 (14:15 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 21 Oct 2008 14:15:04 +0000 (14:15 +0000)
Found this while fixing another unrelated radar.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57904 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/SemaObjC/invalid-typename.m [new file with mode: 0644]

index 10ac42718e481d1b43d0c13f780fcf3c9c651e29..8487ea2338f95129326e93a628934e9095220549 100644 (file)
@@ -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 (file)
index 0000000..9996789
--- /dev/null
@@ -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
+