]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/6505139> [clang on growl]: need to allow unnamed selectors as...
authorSteve Naroff <snaroff@apple.com>
Wed, 11 Feb 2009 20:43:13 +0000 (20:43 +0000)
committerSteve Naroff <snaroff@apple.com>
Wed, 11 Feb 2009 20:43:13 +0000 (20:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64320 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseObjc.cpp
test/SemaObjC/selector-1.m

index 338e770cd6954583d9c1aef6a22732ad6e022562..8bb6e114d9c2626edfb3e993599d4f9c082fff9b 100644 (file)
@@ -687,7 +687,8 @@ Parser::DeclTy *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
   SourceLocation selLoc;
   IdentifierInfo *SelIdent = ParseObjCSelector(selLoc);
 
-  if (!SelIdent) { // missing selector name.
+  // An unnamed colon is valid.
+  if (!SelIdent && Tok.isNot(tok::colon)) { // missing selector name.
     Diag(Tok, diag::err_expected_selector_for_method)
       << SourceRange(mLoc, Tok.getLocation());
     // Skip until we get a ; or {}.
index 476568f6caa40b7b71a9fcac8812a6443956a1b5..1fd1d444a12879b8a50f1ab5c25be4ac5160ceb7 100644 (file)
@@ -1,5 +1,13 @@
 // RUN: clang -verify %s 
 
+@interface Lancelot @end
+@implementation Lancelot
+
+- (void):(int)x {}
+- (void)xx:(int)x :(int)y { }
+
+@end
+
 int main() {
  SEL s = @selector(retain);
  SEL s1 = @selector(meth1:);