From 198e89d305fe8429831f0378c46a977e548bd1ce Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Fri, 4 Apr 2014 15:13:18 +0200 Subject: [PATCH] Run caching before using the cached vars. --- lib/Interpreter/ValueExtractionSynthesizer.cpp | 8 ++++---- lib/Interpreter/ValueExtractionSynthesizer.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Interpreter/ValueExtractionSynthesizer.cpp b/lib/Interpreter/ValueExtractionSynthesizer.cpp index 96731e0c..2fba4d83 100644 --- a/lib/Interpreter/ValueExtractionSynthesizer.cpp +++ b/lib/Interpreter/ValueExtractionSynthesizer.cpp @@ -157,9 +157,6 @@ namespace cling { // case 2.1): // copyArray(src, placement, size) - if (!m_gClingVD) - FindAndCacheRuntimeDecls(); - Expr* SVRInit = SynthesizeSVRInit(lastExpr); // if we had return stmt update to execute the SVR init, even if the // wrapper returns void. @@ -174,7 +171,10 @@ namespace cling { } } - Expr* ValueExtractionSynthesizer::SynthesizeSVRInit(Expr* E) const { + Expr* ValueExtractionSynthesizer::SynthesizeSVRInit(Expr* E) { + if (!m_gClingVD) + FindAndCacheRuntimeDecls(); + // Build a reference to gCling ExprResult gClingDRE = m_Sema->BuildDeclRefExpr(m_gClingVD, m_Context->VoidPtrTy, diff --git a/lib/Interpreter/ValueExtractionSynthesizer.h b/lib/Interpreter/ValueExtractionSynthesizer.h index 330ae582..51178f22 100644 --- a/lib/Interpreter/ValueExtractionSynthesizer.h +++ b/lib/Interpreter/ValueExtractionSynthesizer.h @@ -50,7 +50,7 @@ public: ///\param[in] S - The semantic analysis object. /// ValueExtractionSynthesizer(clang::Sema* S); - + virtual ~ValueExtractionSynthesizer(); virtual void Transform(); @@ -65,13 +65,13 @@ public: // /// Depending on the type we need to synthesize a call to cling: /// 0) void : do nothing; - /// 1) enum, integral, float, double, referece, pointer types : + /// 1) enum, integral, float, double, referece, pointer types : /// call to cling::internal::setValueNoAlloc(...); /// 2) object type (alloc on the stack) : /// cling::internal::setValueWithAlloc /// 2.1) constant arrays: /// call to cling::runtime::internal::copyArray(...) - /// + /// /// We need to synthesize later: /// Wrapper has signature: void w(cling::Value V) /// case 1): @@ -81,7 +81,7 @@ public: /// case 2.1): /// copyArray(src, placement, N) /// - clang::Expr* SynthesizeSVRInit(clang::Expr* E) const; + clang::Expr* SynthesizeSVRInit(clang::Expr* E); // Find and cache cling::runtime::gCling, setValueNoAlloc, // setValueWithAlloc on first request.