diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-22 18:35:43 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-01-22 18:35:43 +0000 |
commit | 02447d80e4638aac8a40e27de50f7f990a6d0b2a (patch) | |
tree | e29b105baa57259a4d6af724fd9b5d98a739a485 /clang/lib/Parse/ParseObjc.cpp | |
parent | 44c3145938573088d5f89b7557bd32cb70359e26 (diff) | |
download | bcm5719-llvm-02447d80e4638aac8a40e27de50f7f990a6d0b2a.tar.gz bcm5719-llvm-02447d80e4638aac8a40e27de50f7f990a6d0b2a.zip |
objectiveC (take two): don't warn when in -Wselector mode and
an unimplemented selector is consumed by
"respondsToSelector:". // rdar://12938616
llvm-svn: 173179
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 47c22d9bd00..65bfd1c830e 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -2419,14 +2419,12 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, // Parse objc-selector SourceLocation Loc; IdentifierInfo *selIdent = ParseObjCSelectorPiece(Loc); - + SmallVector<IdentifierInfo *, 12> KeyIdents; SmallVector<SourceLocation, 12> KeyLocs; ExprVector KeyExprs; if (Tok.is(tok::colon)) { - bool RespondsToSelector = - selIdent && selIdent->isStr("respondsToSelector"); while (1) { // Each iteration parses a single keyword argument. KeyIdents.push_back(selIdent); @@ -2465,22 +2463,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, return ExprError(); } - ExprResult Res; - if (RespondsToSelector) { - if (Tok.is(tok::at)) { - // Special handling for 'respondsToSelector:' which must not warn - // on use of @selector expression as its sole argument. - Token AfterAt = GetLookAheadToken(1); - if (AfterAt.isObjCAtKeyword(tok::objc_selector)) { - SourceLocation AtLoc = ConsumeToken(); - Res = ParseObjCSelectorExpression(AtLoc, false); - } - } - RespondsToSelector = false; - } - if (!Res.get()) - Res = ParseAssignmentExpression(); - + ExprResult Res(ParseAssignmentExpression()); if (Res.isInvalid()) { // We must manually skip to a ']', otherwise the expression skipper will // stop at the ']' when it skips to the ';'. We want it to skip beyond @@ -2560,7 +2543,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc, SkipUntil(tok::r_square); return ExprError(); } - + SourceLocation RBracLoc = ConsumeBracket(); // consume ']' unsigned nKeys = KeyIdents.size(); @@ -2814,8 +2797,7 @@ Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) { /// objc-selector-expression /// @selector '(' objc-keyword-selector ')' -ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc, - bool WarnSelector) { +ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) { SourceLocation SelectorLoc = ConsumeToken(); if (Tok.isNot(tok::l_paren)) @@ -2873,8 +2855,7 @@ ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc, Selector Sel = PP.getSelectorTable().getSelector(nColons, &KeyIdents[0]); return Actions.ParseObjCSelectorExpression(Sel, AtLoc, SelectorLoc, T.getOpenLocation(), - T.getCloseLocation(), - WarnSelector); + T.getCloseLocation()); } void Parser::ParseLexedObjCMethodDefs(LexedMethod &LM, bool parseMethod) { |