diff options
author | Steve Naroff <snaroff@apple.com> | 2009-02-11 20:43:13 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-02-11 20:43:13 +0000 |
commit | 84c431088693e216193094d1dbf327a01173f57f (patch) | |
tree | 2e279d25f4036b608cc4b98169a7344158581839 | |
parent | e21dd6ffef4585fa43cd3586ed971217d65bf56c (diff) |
Fix <rdar://problem/6505139> [clang on growl]: need to allow unnamed selectors as the first argument
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64320 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 3 | ||||
-rw-r--r-- | test/SemaObjC/selector-1.m | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 338e770cd6..8bb6e114d9 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -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 {}. diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m index 476568f6ca..1fd1d444a1 100644 --- a/test/SemaObjC/selector-1.m +++ b/test/SemaObjC/selector-1.m @@ -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:); |