From 52b5c6976aa84e4c596a18a7d076ebd2ce64a3f3 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer <benny.kra@googlemail.com> Date: Thu, 19 May 2016 21:53:33 +0000 Subject: [PATCH] [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 --- include/clang/Sema/SemaInternal.h | 3 +++ lib/Sema/SemaLookup.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/clang/Sema/SemaInternal.h b/include/clang/Sema/SemaInternal.h index 60c6598287b..ffe69717d3b 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 e538f3cb57e..2afb13e1db1 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); } -- GitLab