mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 19:32:35 +00:00
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,
|
||||
NULL, NULL, false, CTC_NoKeywords);
|
||||
if ((PrevDecl = Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>())) {
|
||||
Diag(SuperLoc, diag::err_undef_superclass_suggest)
|
||||
<< SuperName << ClassName << PrevDecl->getDeclName();
|
||||
Diag(PrevDecl->getLocation(), diag::note_previous_decl)
|
||||
<< PrevDecl->getDeclName();
|
||||
if (PrevDecl == IDecl) {
|
||||
// Don't correct to the class we're defining.
|
||||
PrevDecl = 0;
|
||||
} 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 {}
|
||||
@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
Block a user