From: Benjamin Kramer Date: Thu, 19 May 2016 21:53:33 +0000 (+0000) Subject: [Sema] Fix use after move. Found by ubsan. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52b5c6976aa84e4c596a18a7d076ebd2ce64a3f3;p=clang [Sema] Fix use after move. Found by ubsan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270144 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h index 60c6598287..ffe69717d3 100644 --- a/include/clang/Sema/SemaInternal.h +++ b/include/clang/Sema/SemaInternal.h @@ -216,6 +216,9 @@ public: bool isAddressOfOperand() const { return CorrectionValidator->IsAddressOfOperand; } const CXXScopeSpec *getSS() const { return SS.get(); } Scope *getScope() const { return S; } + CorrectionCandidateCallback *getCorrectionValidator() const { + return CorrectionValidator.get(); + } private: class NamespaceSpecifierSet { diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index e538f3cb57..2afb13e1db 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -4789,7 +4789,8 @@ TypoExpr *Sema::CorrectTypoDelayed( TypoCorrection ExternalTypo; if (ExternalSource && Consumer) { ExternalTypo = ExternalSource->CorrectTypo( - TypoName, LookupKind, S, SS, *CCC, MemberContext, EnteringContext, OPT); + TypoName, LookupKind, S, SS, *Consumer->getCorrectionValidator(), + MemberContext, EnteringContext, OPT); if (ExternalTypo) Consumer->addCorrection(ExternalTypo); }