Move renaming.

This commit is contained in:
Vassil Vassilev 2014-03-27 17:30:09 +01:00 committed by sftnight
parent 230638b648
commit 33ece80d2b
5 changed files with 29 additions and 28 deletions

View File

@ -9,7 +9,7 @@
#include "CheckEmptyTransactionTransformer.h"
#include "ASTNodeEraser.h"
#include "TransactionUnloader.h"
#include "cling/Interpreter/Transaction.h"
#include "clang/AST/Decl.h"
@ -36,8 +36,8 @@ namespace cling {
T->erase(found);
}
// We know that it didn't end up in the EE by design.
ASTNodeEraser eraser(m_Sema, /*CodeGenerator*/0, /*ExecutionEngine*/0);
eraser.UnloadDecl(FD);
TransactionUnloader U(m_Sema, /*CodeGenerator*/0, /*ExecutionEngine*/0);
U.UnloadDecl(FD);
}
}
}

View File

@ -8,7 +8,7 @@
//------------------------------------------------------------------------------
#include "IncrementalParser.h"
#include "ASTNodeEraser.h"
#include "AutoSynthesizer.h"
#include "BackendPass.h"
#include "CheckEmptyTransactionTransformer.h"
@ -18,6 +18,7 @@
#include "NullDerefProtectionTransformer.h"
#include "ValueExtractionSynthesizer.h"
#include "TransactionPool.h"
#include "TransactionUnloader.h"
#include "ValuePrinterSynthesizer.h"
#include "cling/Interpreter/CIFactory.h"
#include "cling/Interpreter/Interpreter.h"
@ -485,10 +486,10 @@ namespace cling {
if (m_Interpreter->getOptions().ErrorOut)
return;
ASTNodeEraser NodeEraser(&getCI()->getSema(), m_CodeGen.get(),
m_Interpreter->getExecutionEngine());
TransactionUnloader U(&getCI()->getSema(), m_CodeGen.get(),
m_Interpreter->getExecutionEngine());
if (NodeEraser.RevertTransaction(T))
if (U.RevertTransaction(T))
T->setState(Transaction::kRolledBack);
else
T->setState(Transaction::kRolledBackWithErrors);

View File

@ -9,7 +9,7 @@
#include "cling/Interpreter/LookupHelper.h"
#include "ASTNodeEraser.h"
#include "TransactionUnloader.h"
#include "cling/Interpreter/Interpreter.h"
#include "clang/AST/ASTContext.h"
@ -234,9 +234,9 @@ namespace cling {
TheDecl = TD->getDefinition();
if (TheDecl->isInvalidDecl()) {
// if the decl is invalid try to clean up
ASTNodeEraser eraser(&S, /*CodeGenerator*/0,
/*ExecutionEngine*/0);
eraser.UnloadDecl(TheDecl);
TransactionUnloader U(&S, /*CodeGenerator*/0,
/*ExecutionEngine*/0);
U.UnloadDecl(TheDecl);
return 0;
}
} else {
@ -450,8 +450,8 @@ namespace cling {
}
if (scopeDecl->isInvalidDecl()) {
// if the decl is invalid try to clean up
ASTNodeEraser eraser(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
eraser.UnloadDecl(const_cast<Decl*>(scopeDecl));
TransactionUnloader U(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
U.UnloadDecl(const_cast<Decl*>(scopeDecl));
return 0;
}
@ -618,8 +618,8 @@ namespace cling {
true /*recursive instantiation*/);
if (TheDecl->isInvalidDecl()) {
// if the decl is invalid try to clean up
ASTNodeEraser eraser(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
eraser.UnloadDecl(const_cast<FunctionDecl*>(TheDecl));
TransactionUnloader U(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
U.UnloadDecl(const_cast<FunctionDecl*>(TheDecl));
return 0;
}
}
@ -1089,8 +1089,8 @@ namespace cling {
true /*recursive instantiation*/);
if (fdecl->isInvalidDecl()) {
// if the decl is invalid try to clean up
ASTNodeEraser eraser(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
eraser.UnloadDecl(fdecl);
TransactionUnloader U(&S, /*CodeGenerator*/0, /*ExecutionEngine*/0);
U.UnloadDecl(fdecl);
return 0;
}
return fdecl;

View File

@ -7,7 +7,7 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
#include "ASTNodeEraser.h"
#include "TransactionUnloader.h"
#include "cling/Interpreter/Transaction.h"
#include "cling/Utils/AST.h"
@ -1022,15 +1022,15 @@ namespace cling {
}
ASTNodeEraser::ASTNodeEraser(Sema* S, clang::CodeGenerator* CG,
TransactionUnloader::TransactionUnloader(Sema* S, clang::CodeGenerator* CG,
llvm::ExecutionEngine* EE)
: m_Sema(S), m_CodeGen(CG), m_EEngine(EE) {
}
ASTNodeEraser::~ASTNodeEraser() {
TransactionUnloader::~TransactionUnloader() {
}
bool ASTNodeEraser::RevertTransaction(Transaction* T) {
bool TransactionUnloader::RevertTransaction(Transaction* T) {
DeclUnloader DeclU(m_Sema, m_CodeGen, m_EEngine, T);
bool Successful = true;
@ -1077,7 +1077,7 @@ namespace cling {
return Successful;
}
bool ASTNodeEraser::UnloadDecl(Decl* D) {
bool TransactionUnloader::UnloadDecl(Decl* D) {
Transaction T(D->getASTContext());
T.append(D);
return RevertTransaction(&T);

View File

@ -7,8 +7,8 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
#ifndef CLING_AST_NODE_ERASER
#define CLING_AST_NODE_ERASER
#ifndef CLING_TRANSACTION_UNLOADER
#define CLING_TRANSACTION_UNLOADER
namespace llvm {
class ExecutionEngine;
@ -26,16 +26,16 @@ namespace cling {
///\brief A simple eraser class that removes already created AST Nodes.
///
class ASTNodeEraser {
class TransactionUnloader {
private:
clang::Sema* m_Sema;
clang::CodeGenerator* m_CodeGen;
llvm::ExecutionEngine* m_EEngine;
public:
ASTNodeEraser(clang::Sema* S, clang::CodeGenerator* CG,
llvm::ExecutionEngine* EE);
~ASTNodeEraser();
TransactionUnloader(clang::Sema* S, clang::CodeGenerator* CG,
llvm::ExecutionEngine* EE);
~TransactionUnloader();
///\brief Rolls back given transaction from the AST.
///