Run caching before using the cached vars.

This commit is contained in:
Vassil Vassilev 2014-04-04 15:13:18 +02:00 committed by sftnight
parent d1a416ddc0
commit 198e89d305
2 changed files with 8 additions and 8 deletions

View File

@ -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,

View File

@ -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.