r215480 - Objective-C [qoi]. Patch to not do Fix-It for fixing
Fariborz Jahanian
fjahanian at apple.com
Tue Aug 12 15:16:41 PDT 2014
Author: fjahanian
Date: Tue Aug 12 17:16:41 2014
New Revision: 215480
URL: http://llvm.org/viewvc/llvm-project?rev=215480&view=rev
Log:
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
Added:
cfe/trunk/test/FixIt/multiarg-selector-fixit.m
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=215480&r1=215479&r2=215480&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Aug 12 17:16:41 2014
@@ -1366,9 +1366,12 @@ bool Sema::CheckMessageArgumentTypes(Qua
: 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)
Added: cfe/trunk/test/FixIt/multiarg-selector-fixit.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/multiarg-selector-fixit.m?rev=215480&view=auto
==============================================================================
--- cfe/trunk/test/FixIt/multiarg-selector-fixit.m (added)
+++ cfe/trunk/test/FixIt/multiarg-selector-fixit.m Tue Aug 12 17:16:41 2014
@@ -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
+
+ at interface NSObject
+- (void)testDataSource:(id)object withMultipleArguments:(id)arguments;
+ at end
+
+int main() {
+ id obj;
+ [obj TestDataSource:nil withMultipleArguments:nil];
+}
More information about the cfe-commits
mailing list