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 | 48f3cc2b2be1d32df14234904539b34e6e387e4a (patch) | |
tree | 0d0dacf0cee2ea81c909d5dbd17f84f2780348b0 /lib/Parse/ParseObjc.cpp | |
parent | c666cf404d37d6624a4efdf06cc2f9f1995cfe9c (diff) | |
download | clang-48f3cc2b2be1d32df14234904539b34e6e387e4a.tar.gz clang-48f3cc2b2be1d32df14234904539b34e6e387e4a.tar.bz2 clang-48f3cc2b2be1d32df14234904539b34e6e387e4a.tar.xz |
objectiveC (take two): don't warn when in -Wselector mode and
an unimplemented selector is consumed by
"respondsToSelector:". // rdar://12938616
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 47c22d9bd0..65bfd1c830 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/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) { |