aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-06 23:44:25 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-06 23:44:25 +0000
commita6f26387355c9a9e61a33c480e28f1a9a15f9b62 (patch)
tree673a48aea49ba663bcf3f27fbe2037a10ebd701b /lib/Sema/SemaDeclObjC.cpp
parentd8210650ed948de65a08a8daf16d291b747717c4 (diff)
When suggesting a typo correction for an @implementation without a
corresponding @interface, provide a note showing which interface we're referring to. This note has the fix-it hint on it. Also, don't automatically apply fix-it hints for notes. They're meant to express fix-its that would change semantics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index f627c23d76..e5526746d9 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -701,11 +701,17 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
LookupResult R(*this, ClassName, ClassLoc, LookupOrdinaryName);
if (CorrectTypo(R, TUScope, 0) &&
(IDecl = R.getAsSingle<ObjCInterfaceDecl>())) {
- // Suggest the (potentially) correct interface name. However, don't
+ // Suggest the (potentially) correct interface name. However, put the
+ // fix-it hint itself in a separate note, since changing the name in
+ // the warning would make the fix-it change semantics.However, don't
// provide a code-modification hint or use the typo name for recovery,
// because this is just a warning. The program may actually be correct.
Diag(ClassLoc, diag::warn_undef_interface_suggest)
<< ClassName << R.getLookupName();
+ Diag(IDecl->getLocation(), diag::note_previous_decl)
+ << R.getLookupName()
+ << CodeModificationHint::CreateReplacement(ClassLoc,
+ R.getLookupName().getAsString());
IDecl = 0;
} else {
Diag(ClassLoc, diag::warn_undef_interface) << ClassName;