diff options
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 667a12fea4..49fcfbf2f3 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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(); + } } } |