diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-29 19:43:10 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-12-29 19:43:10 +0000 |
commit | de6d6c486031bacf3097831dd9fe95b9dab59fe9 (patch) | |
tree | 1935a808b42cfa7547adf1f0b0fa564e86c52864 /clang/lib/Sema/SemaLookup.cpp | |
parent | b120ae96d342458905b5ab86cf60f9d508fc904f (diff) | |
download | bcm5719-llvm-de6d6c486031bacf3097831dd9fe95b9dab59fe9.tar.gz bcm5719-llvm-de6d6c486031bacf3097831dd9fe95b9dab59fe9.zip |
Teach typo correction to properly handle mapping declarations to their
underlying decls. Preserve the found declaration throughout, and only map to
the underlying declaration when we want to check whether it's the right kind.
This allows us to provide the right source location for the found declaration,
and prepares for the possibility of underlying decls with a different name
from the found decl.
llvm-svn: 256575
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 2aeffd82b76..481ae6cd55b 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4719,7 +4719,7 @@ void TypoCorrection::addCorrectionDecl(NamedDecl *CDecl) { if (isKeyword()) CorrectionDecls.clear(); - CorrectionDecls.push_back(CDecl->getUnderlyingDecl()); + CorrectionDecls.push_back(CDecl); if (!CorrectionName) CorrectionName = CDecl->getDeclName(); @@ -4948,7 +4948,7 @@ void Sema::diagnoseTypo(const TypoCorrection &Correction, // Maybe we're just missing a module import. if (Correction.requiresImport()) { - NamedDecl *Decl = Correction.getCorrectionDecl(); + NamedDecl *Decl = Correction.getFoundDecl(); assert(Decl && "import required but no declaration to import"); diagnoseMissingImport(Correction.getCorrectionRange().getBegin(), Decl, @@ -4960,7 +4960,7 @@ void Sema::diagnoseTypo(const TypoCorrection &Correction, << CorrectedQuotedStr << (ErrorRecovery ? FixTypo : FixItHint()); NamedDecl *ChosenDecl = - Correction.isKeyword() ? nullptr : Correction.getCorrectionDecl(); + Correction.isKeyword() ? nullptr : Correction.getFoundDecl(); if (PrevNote.getDiagID() && ChosenDecl) Diag(ChosenDecl->getLocation(), PrevNote) << CorrectedQuotedStr << (ErrorRecovery ? FixItHint() : FixTypo); |