When typo-correction an Objective-C superclass name, don't
typo-correct to ourselves. llvm-svn: 145583
This commit is contained in:
parent
b8e6cee9ca
commit
11bb308457
|
@ -417,10 +417,15 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
|
||||||
DeclarationNameInfo(SuperName, SuperLoc), LookupOrdinaryName, TUScope,
|
DeclarationNameInfo(SuperName, SuperLoc), LookupOrdinaryName, TUScope,
|
||||||
NULL, NULL, false, CTC_NoKeywords);
|
NULL, NULL, false, CTC_NoKeywords);
|
||||||
if ((PrevDecl = Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>())) {
|
if ((PrevDecl = Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>())) {
|
||||||
Diag(SuperLoc, diag::err_undef_superclass_suggest)
|
if (PrevDecl == IDecl) {
|
||||||
<< SuperName << ClassName << PrevDecl->getDeclName();
|
// Don't correct to the class we're defining.
|
||||||
Diag(PrevDecl->getLocation(), diag::note_previous_decl)
|
PrevDecl = 0;
|
||||||
<< PrevDecl->getDeclName();
|
} else {
|
||||||
|
Diag(SuperLoc, diag::err_undef_superclass_suggest)
|
||||||
|
<< SuperName << ClassName << PrevDecl->getDeclName();
|
||||||
|
Diag(PrevDecl->getLocation(), diag::note_previous_decl)
|
||||||
|
<< PrevDecl->getDeclName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,4 +30,6 @@ typedef NSObject TD_NSObject;
|
||||||
@interface XCElementUnit : TD_NSObject {}
|
@interface XCElementUnit : TD_NSObject {}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
// Make sure we don't typo-correct to ourselves.
|
||||||
|
@interface SomeClassSub : SomeClassSup // expected-error{{cannot find interface declaration for 'SomeClassSup', superclass of 'SomeClassSub'}}
|
||||||
|
@end
|
||||||
|
|
Loading…
Reference in New Issue