Rollback the transaction if there is an error occurred in one of the transformers.

git-svn-id: http://root.cern.ch/svn/root/trunk@46826 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev 2012-10-26 12:56:49 +00:00
parent b07eb9a4ec
commit 4fd8ccc00d
4 changed files with 33 additions and 10 deletions

View File

@ -100,10 +100,6 @@ namespace cling {
delete m_TTransformers[i];
}
// pin the vtable here since there is no point to create dedicated to that
// cpp file.
TransactionTransformer::~TransactionTransformer() {}
void IncrementalParser::beginTransaction(const CompilationOptions& Opts) {
llvm::Module* M = 0;
if (hasCodeGenerator())

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Vassil Vassilev <vvasilev@cern.ch>
//------------------------------------------------------------------------------
#include "TransactionTransformer.h"
#include "clang/Sema/Sema.h"
namespace cling {
// pin the vtable here since there is no point to create dedicated to that
// cpp file.
TransactionTransformer::~TransactionTransformer() {}
bool TransactionTransformer::TransformTransaction(Transaction& T) {
m_Transaction = &T;
Transform();
if (!m_Sema)
return true;
return !m_Sema->getDiagnostics().hasErrorOccurred();
}
} // end namespace cling

View File

@ -53,13 +53,9 @@ namespace cling {
/// does the actual transformation.
///
///\param[in] T - The transaction to be transformed.
///\returns The transformed transaction.
///\returns true on success.
///
Transaction* TransformTransaction(Transaction& T) {
m_Transaction = &T;
Transform();
return m_Transaction;
}
bool TransformTransaction(Transaction& T);
protected:
///\brief Transforms the current transaction.

View File

@ -31,3 +31,8 @@ gCling->process("double sin(double); double one = sin(3.141/2);", &V);
V // CHECK: (cling::StoredValueRef) boxes [(double) 1.000000e+00]
one // CHECK: (double) 1.000
int one; // expected-error {{saying something like redecl but verify is broken!}}
// Make sure that PR#98434 doesn't get reintroduced.
void f(int);
gCling->evaluate("f", V);
// end PR#98434