forked from OSchip/llvm-project
Objective-C: Fixes a typo correction bug where a
selector would be correted to identical selector name in certain corner cases. // rdar://7853549 llvm-svn: 184208
This commit is contained in:
parent
8811ad4f81
commit
0649923b57
|
@ -2331,7 +2331,8 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
|
||||||
// instance methods
|
// instance methods
|
||||||
for (ObjCMethodList *M = &b->second.first; M; M=M->getNext())
|
for (ObjCMethodList *M = &b->second.first; M; M=M->getNext())
|
||||||
if (M->Method &&
|
if (M->Method &&
|
||||||
(M->Method->getSelector().getNumArgs() == NumArgs)) {
|
(M->Method->getSelector().getNumArgs() == NumArgs) &&
|
||||||
|
(M->Method->getSelector() != Sel)) {
|
||||||
if (ObjectIsId)
|
if (ObjectIsId)
|
||||||
Methods.push_back(M->Method);
|
Methods.push_back(M->Method);
|
||||||
else if (!ObjectIsClass &&
|
else if (!ObjectIsClass &&
|
||||||
|
@ -2341,7 +2342,8 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
|
||||||
// class methods
|
// class methods
|
||||||
for (ObjCMethodList *M = &b->second.second; M; M=M->getNext())
|
for (ObjCMethodList *M = &b->second.second; M; M=M->getNext())
|
||||||
if (M->Method &&
|
if (M->Method &&
|
||||||
(M->Method->getSelector().getNumArgs() == NumArgs)) {
|
(M->Method->getSelector().getNumArgs() == NumArgs) &&
|
||||||
|
(M->Method->getSelector() != Sel)) {
|
||||||
if (ObjectIsClass)
|
if (ObjectIsClass)
|
||||||
Methods.push_back(M->Method);
|
Methods.push_back(M->Method);
|
||||||
else if (!ObjectIsId &&
|
else if (!ObjectIsId &&
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
|
||||||
: diag::warn_inst_method_not_found;
|
: diag::warn_inst_method_not_found;
|
||||||
if (!getLangOpts().DebuggerSupport) {
|
if (!getLangOpts().DebuggerSupport) {
|
||||||
const ObjCMethodDecl *OMD = SelectorsForTypoCorrection(Sel, ReceiverType);
|
const ObjCMethodDecl *OMD = SelectorsForTypoCorrection(Sel, ReceiverType);
|
||||||
if (OMD && !OMD->isInvalidDecl() && OMD->getSelector() != Sel) {
|
if (OMD && !OMD->isInvalidDecl()) {
|
||||||
if (getLangOpts().ObjCAutoRefCount)
|
if (getLangOpts().ObjCAutoRefCount)
|
||||||
DiagID = diag::error_method_not_found_with_typo;
|
DiagID = diag::error_method_not_found_with_typo;
|
||||||
else
|
else
|
||||||
|
|
|
@ -35,7 +35,7 @@ id objc_getClass(const char *s);
|
||||||
@implementation Derived
|
@implementation Derived
|
||||||
+ (int) class_func1
|
+ (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')}}
|
return i + (size_t)[super class_func0]; // expected-warning {{class method '+class_func0' not found (return type defaults to 'id')}}
|
||||||
}
|
}
|
||||||
+ (int) class_func2
|
+ (int) class_func2
|
||||||
|
|
Loading…
Reference in New Issue