Added a function to attach the AutoloadCallback automatically

This commit is contained in:
manasij7479 2014-07-15 15:11:43 +05:30 committed by sftnight
parent 083ab88d81
commit a812b2cd1d
6 changed files with 9 additions and 10 deletions

View File

@ -616,6 +616,7 @@ namespace cling {
void GenerateAutoloadingMap(llvm::StringRef inFile,llvm::StringRef outFile);
void SetAutoloadCallback();
friend class runtime::internal::LifetimeHandler;
// FIXME: workaround until JIT supports exceptions

View File

@ -101,7 +101,6 @@ namespace cling {
InterpreterCallbacks(interp,true,false,true), m_Interpreter(interp){
}
AutoloadCallback::~AutoloadCallback() {
m_Map.clear();
}
void AutoloadCallback::InsertIntoAutoloadingState

View File

@ -24,6 +24,7 @@
#include "cling/Interpreter/Transaction.h"
#include "cling/Interpreter/Value.h"
#include "cling/Utils/AST.h"
#include "cling/Interpreter/AutoloadCallback.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/GlobalDecl.h"
@ -1279,5 +1280,8 @@ namespace cling {
T->setState(Transaction::kCommitted);
return;
}
void Interpreter::SetAutoloadCallback() {
m_Callbacks.reset(new AutoloadCallback(this));
}
} //end namespace cling

View File

@ -12,9 +12,7 @@
#include "cling/Interpreter/DynamicExprInfo.h"
#include "cling/Interpreter/InterpreterCallbacks.h"
#include "cling/Interpreter/LookupHelper.h"
#include "cling/Interpreter/AutoloadCallback.h"
#include "clang/AST/Type.h"
#include "llvm/Support/raw_ostream.h"
namespace cling {
@ -30,8 +28,6 @@ void symbol_requester() {
h.findFunctionArgs(0, "", "", LookupHelper::NoDiagnostics);
runtime::internal::DynamicExprInfo DEI(0,0,false);
DEI.getExpr();
InterpreterCallbacks cb(0);
AutoloadCallback a(&I);
}
}
}

View File

@ -13,10 +13,9 @@
#include "cling/Interpreter/Interpreter.h"
gCling->GenerateAutoloadingMap("Def2.h","test.h");
.undo 1
#include "cling/Interpreter/AutoloadCallback.h"
gCling->setCallbacks(new cling::AutoloadCallback(gCling));
gCling->SetAutoloadCallback();
#include "test.h"
#include "Def2.h"
//expected-no-diagnostics
.q
.q

View File

@ -11,8 +11,8 @@
//XFAIL: *
//Becasue functionality is disabled now
#include "cling/Interpreter/AutoloadCallback.h"
gCling->setCallbacks(new cling::AutoloadCallback(gCling));
#include "cling/Interpreter/Interpreter.h"
gCling->SetAutoloadCallback();
.rawInput 1
class __attribute__((annotate("Def.h"))) C;