Objective-C [qoi]. Patch to not do Fix-It for fixing

a messaging expression except in the simple case
of a unary selector. We cannot reliably provide such a fixit due
to numerous reasons where a matching selector could not be found.
rdar://15756038

llvm-svn: 215480
This commit is contained in:
Fariborz Jahanian 2014-08-12 22:16:41 +00:00
parent d2d2457823
commit 5ab8750c5c
2 changed files with 21 additions and 3 deletions

View File

@ -1366,9 +1366,12 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
: diag::warn_instance_method_not_found_with_typo;
Selector MatchedSel = OMD->getSelector();
SourceRange SelectorRange(SelectorLocs.front(), SelectorLocs.back());
Diag(SelLoc, DiagID)
<< Sel<< isClassMessage << MatchedSel
<< FixItHint::CreateReplacement(SelectorRange, MatchedSel.getAsString());
if (MatchedSel.isUnarySelector())
Diag(SelLoc, DiagID)
<< Sel<< isClassMessage << MatchedSel
<< FixItHint::CreateReplacement(SelectorRange, MatchedSel.getAsString());
else
Diag(SelLoc, DiagID) << Sel<< isClassMessage << MatchedSel;
}
else
Diag(SelLoc, DiagID)

View File

@ -0,0 +1,15 @@
// RUN: cp %s %t
// RUN: %clang_cc1 -x objective-c -fixit %t
// RUN: diff %t %s
// rdar://15756038
#define nil (void *)0
@interface NSObject
- (void)testDataSource:(id)object withMultipleArguments:(id)arguments;
@end
int main() {
id obj;
[obj TestDataSource:nil withMultipleArguments:nil];
}