r184208 - Objective-C: Fixes a typo correction bug where a
Fariborz Jahanian
fjahanian at apple.com
Tue Jun 18 10:10:59 PDT 2013
Author: fjahanian
Date: Tue Jun 18 12:10:58 2013
New Revision: 184208
URL: http://llvm.org/viewvc/llvm-project?rev=184208&view=rev
Log:
Objective-C: Fixes a typo correction bug where a
selector would be correted to identical selector name
in certain corner cases. // rdar://7853549
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/call-super-2.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=184208&r1=184207&r2=184208&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Jun 18 12:10:58 2013
@@ -2331,7 +2331,8 @@ Sema::SelectorsForTypoCorrection(Selecto
// instance methods
for (ObjCMethodList *M = &b->second.first; M; M=M->getNext())
if (M->Method &&
- (M->Method->getSelector().getNumArgs() == NumArgs)) {
+ (M->Method->getSelector().getNumArgs() == NumArgs) &&
+ (M->Method->getSelector() != Sel)) {
if (ObjectIsId)
Methods.push_back(M->Method);
else if (!ObjectIsClass &&
@@ -2341,7 +2342,8 @@ Sema::SelectorsForTypoCorrection(Selecto
// class methods
for (ObjCMethodList *M = &b->second.second; M; M=M->getNext())
if (M->Method &&
- (M->Method->getSelector().getNumArgs() == NumArgs)) {
+ (M->Method->getSelector().getNumArgs() == NumArgs) &&
+ (M->Method->getSelector() != Sel)) {
if (ObjectIsClass)
Methods.push_back(M->Method);
else if (!ObjectIsId &&
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=184208&r1=184207&r2=184208&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Tue Jun 18 12:10:58 2013
@@ -1233,7 +1233,7 @@ bool Sema::CheckMessageArgumentTypes(Qua
: diag::warn_inst_method_not_found;
if (!getLangOpts().DebuggerSupport) {
const ObjCMethodDecl *OMD = SelectorsForTypoCorrection(Sel, ReceiverType);
- if (OMD && !OMD->isInvalidDecl() && OMD->getSelector() != Sel) {
+ if (OMD && !OMD->isInvalidDecl()) {
if (getLangOpts().ObjCAutoRefCount)
DiagID = diag::error_method_not_found_with_typo;
else
Modified: cfe/trunk/test/SemaObjC/call-super-2.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/call-super-2.m?rev=184208&r1=184207&r2=184208&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/call-super-2.m (original)
+++ cfe/trunk/test/SemaObjC/call-super-2.m Tue Jun 18 12:10:58 2013
@@ -35,7 +35,7 @@ id objc_getClass(const char *s);
@implementation Derived
+ (int) class_func1
{
- int i = (size_t)[self class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
+ int i = (size_t)[self class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id'); did you mean '+class_func}}
return i + (size_t)[super class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
}
+ (int) class_func2
More information about the cfe-commits
mailing list