aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-01 15:37:53 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-01 15:37:53 +0000
commita38c4730fb016abc20a5479540b65ff3992095ab (patch)
tree7b4c35d281bf8cc74ef83be344394a2ad10698d7 /lib/Sema/SemaDeclObjC.cpp
parent50118da99d3c04eb14747cfdc44a9e1d56432aea (diff)
When typo-correction an Objective-C superclass name, don't
typo-correct to ourselves. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp13
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();
+ }
}
}