Dealy running static init until gCling is defined; local_cxa_atexit() needs it.
This commit is contained in:
parent
6325e7ed19
commit
5045248a76
@ -172,7 +172,7 @@ namespace cling {
|
||||
const cling::Transaction* clingT);
|
||||
|
||||
private:
|
||||
///\brief Remaps the __cxa_at_exit with a interpreter-controlled one, so
|
||||
///\brief Remaps the __cxa_at_exit with a interpreter-controlled one, such
|
||||
/// that the interpreter can call the object destructors at the right time.
|
||||
///
|
||||
void remapCXAAtExit();
|
||||
|
@ -83,7 +83,8 @@ namespace cling {
|
||||
m_ASTTransformers.push_back(new CheckEmptyTransactionTransformer(TheSema));
|
||||
}
|
||||
|
||||
void IncrementalParser::Initialize() {
|
||||
void
|
||||
IncrementalParser::Initialize(llvm::SmallVectorImpl<Transaction*> &result) {
|
||||
m_TransactionPool.reset(new TransactionPool(getCI()->getASTContext()));
|
||||
if (hasCodeGenerator())
|
||||
getCodeGenerator()->Initialize(getCI()->getASTContext());
|
||||
@ -104,7 +105,7 @@ namespace cling {
|
||||
true /*AllowPCHWithCompilerErrors*/,
|
||||
0 /*DeserializationListener*/);
|
||||
if (Transaction* EndedT = endTransaction(CurT))
|
||||
commitTransaction(EndedT);
|
||||
result.push_back(EndedT);
|
||||
}
|
||||
|
||||
Transaction* CurT = beginTransaction(CO);
|
||||
@ -124,7 +125,7 @@ namespace cling {
|
||||
External->StartTranslationUnit(m_Consumer);
|
||||
|
||||
if (Transaction* EndedT = endTransaction(CurT))
|
||||
commitTransaction(EndedT);
|
||||
result.push_back(EndedT);
|
||||
}
|
||||
|
||||
IncrementalParser::~IncrementalParser() {
|
||||
|
@ -103,7 +103,7 @@ namespace cling {
|
||||
const char* llvmdir);
|
||||
~IncrementalParser();
|
||||
|
||||
void Initialize();
|
||||
void Initialize(llvm::SmallVectorImpl<Transaction*>& result);
|
||||
clang::CompilerInstance* getCI() const { return m_CI.get(); }
|
||||
clang::Parser* getParser() const { return m_Parser.get(); }
|
||||
clang::CodeGenerator* getCodeGenerator() const { return m_CodeGen.get(); }
|
||||
|
@ -167,8 +167,12 @@ namespace cling {
|
||||
&LeftoverArgs[0],
|
||||
llvmdir));
|
||||
Sema& SemaRef = getSema();
|
||||
m_LookupHelper.reset(new LookupHelper(new Parser(SemaRef.getPreprocessor(),
|
||||
SemaRef,
|
||||
Preprocessor& PP = SemaRef.getPreprocessor();
|
||||
// Enable incremental processing, which prevents the preprocessor destroying
|
||||
// the lexer on EOF token.
|
||||
PP.enableIncrementalProcessing();
|
||||
|
||||
m_LookupHelper.reset(new LookupHelper(new Parser(PP, SemaRef,
|
||||
/*SkipFunctionBodies*/false,
|
||||
/*isTemp*/true), this));
|
||||
|
||||
@ -177,7 +181,8 @@ namespace cling {
|
||||
m_Executor.reset(new IncrementalExecutor(theModule));
|
||||
}
|
||||
|
||||
m_IncrParser->Initialize();
|
||||
llvm::SmallVector<Transaction*, 2> IncrParserTransactions;
|
||||
m_IncrParser->Initialize(IncrParserTransactions);
|
||||
|
||||
// Add configuration paths to interpreter's include files.
|
||||
#ifdef CLING_INCLUDE_PATHS
|
||||
@ -204,16 +209,11 @@ namespace cling {
|
||||
AddIncludePath(P.str());
|
||||
}
|
||||
|
||||
// Enable incremental processing, which prevents the preprocessor destroying
|
||||
// the lexer on EOF token.
|
||||
getSema().getPreprocessor().enableIncrementalProcessing();
|
||||
|
||||
handleFrontendOptions();
|
||||
|
||||
// Tell the diagnostic client that we are entering file parsing mode.
|
||||
DiagnosticConsumer& DClient = getCI()->getDiagnosticClient();
|
||||
DClient.BeginSourceFile(getCI()->getLangOpts(),
|
||||
&getCI()->getPreprocessor());
|
||||
DClient.BeginSourceFile(getCI()->getLangOpts(), &PP);
|
||||
|
||||
if (getCI()->getLangOpts().CPlusPlus) {
|
||||
// Set up common declarations which are going to be available
|
||||
@ -241,6 +241,10 @@ namespace cling {
|
||||
declare("#include \"cling/Interpreter/CValuePrinter.h\"");
|
||||
}
|
||||
|
||||
for (llvm::SmallVectorImpl<Transaction*>::const_iterator
|
||||
I = IncrParserTransactions.begin(), E = IncrParserTransactions.end();
|
||||
I != E; ++I)
|
||||
m_IncrParser->commitTransaction(*I);
|
||||
}
|
||||
|
||||
Interpreter::~Interpreter() {
|
||||
|
Loading…
Reference in New Issue
Block a user