r270144 - [Sema] Fix use after move. Found by ubsan.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu May 19 14:53:34 PDT 2016


Author: d0k
Date: Thu May 19 16:53:33 2016
New Revision: 270144

URL: http://llvm.org/viewvc/llvm-project?rev=270144&view=rev
Log:
[Sema] Fix use after move. Found by ubsan.

Modified:
    cfe/trunk/include/clang/Sema/SemaInternal.h
    cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/include/clang/Sema/SemaInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/SemaInternal.h?rev=270144&r1=270143&r2=270144&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/SemaInternal.h (original)
+++ cfe/trunk/include/clang/Sema/SemaInternal.h Thu May 19 16:53:33 2016
@@ -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 {

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=270144&r1=270143&r2=270144&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Thu May 19 16:53:33 2016
@@ -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);
   }




More information about the cfe-commits mailing list