diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-12-01 15:37:53 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-12-01 15:37:53 +0000 |
| commit | 11bb3084575f9d545f7030bf6a98682becf6f1ef (patch) | |
| tree | 7bb1cda580226fcd9ec977702c548efcc7e19598 /clang/lib/Sema | |
| parent | b8e6cee9cadfe1e2704e3e0575e803870224c4b6 (diff) | |
| download | bcm5719-llvm-11bb3084575f9d545f7030bf6a98682becf6f1ef.tar.gz bcm5719-llvm-11bb3084575f9d545f7030bf6a98682becf6f1ef.zip | |
When typo-correction an Objective-C superclass name, don't
typo-correct to ourselves.
llvm-svn: 145583
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 667a12fea44..49fcfbf2f37 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/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(); + } } } |

