Whenever we emit a typo-correction diagnostic, also emit a note
pointing to the declaration that we found that has that name (if it is
unique).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92877 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 9ed37f6..69e9ff9 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -281,6 +281,9 @@
else
llvm_unreachable("could not have corrected a typo here");
+ Diag(Result->getLocation(), diag::note_previous_decl)
+ << Result->getDeclName();
+
SuggestedType = getTypeName(*Result->getIdentifier(), IILoc, S, SS);
return true;
}
@@ -580,6 +583,9 @@
<< Id << IDecl->getDeclName()
<< CodeModificationHint::CreateReplacement(RecoverLoc,
IDecl->getNameAsString());
+ Diag(IDecl->getLocation(), diag::note_previous_decl)
+ << IDecl->getDeclName();
+
Id = IDecl->getIdentifier();
}
}