From 97d7a66299278911c3ca5b828d29d34f0cd942f0 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Thu, 19 May 2016 21:53:33 +0000 Subject: [PATCH] [Sema] Fix use after move. Found by ubsan. llvm-svn: 270144 --- clang/include/clang/Sema/SemaInternal.h | 3 +++ clang/lib/Sema/SemaLookup.cpp | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/clang/include/clang/Sema/SemaInternal.h b/clang/include/clang/Sema/SemaInternal.h index 60c6598287b7..ffe69717d3b1 100644 --- a/clang/include/clang/Sema/SemaInternal.h +++ b/clang/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/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index e538f3cb57e9..2afb13e1db1f 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/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); }