Create function member of IncrementalParser for setting the transformers.
The transformers have to be set later in the initialization for 2 reasons: - to avoid the null deref check before the check pointer function is declared in the RuntimeUniverse; - to avoid useless checks.
This commit is contained in:
parent
31af5359b1
commit
1472015449
@ -183,25 +183,6 @@ namespace cling {
|
||||
}
|
||||
|
||||
initializeVirtualFile();
|
||||
|
||||
// Add transformers to the IncrementalParser, which owns them
|
||||
Sema* TheSema = &CI->getSema();
|
||||
// Register the AST Transformers
|
||||
typedef std::unique_ptr<ASTTransformer> ASTTPtr_t;
|
||||
std::vector<ASTTPtr_t> ASTTransformers;
|
||||
ASTTransformers.emplace_back(new AutoSynthesizer(TheSema));
|
||||
ASTTransformers.emplace_back(new EvaluateTSynthesizer(TheSema));
|
||||
ASTTransformers.emplace_back(new NullDerefProtectionTransformer(TheSema));
|
||||
|
||||
typedef std::unique_ptr<WrapperTransformer> WTPtr_t;
|
||||
std::vector<WTPtr_t> WrapperTransformers;
|
||||
WrapperTransformers.emplace_back(new ValuePrinterSynthesizer(TheSema, 0));
|
||||
WrapperTransformers.emplace_back(new DeclExtractor(TheSema));
|
||||
WrapperTransformers.emplace_back(new ValueExtractionSynthesizer(TheSema, isChildInterpreter));
|
||||
WrapperTransformers.emplace_back(new CheckEmptyTransactionTransformer(TheSema));
|
||||
|
||||
m_Consumer->SetTransformers(std::move(ASTTransformers),
|
||||
std::move(WrapperTransformers));
|
||||
}
|
||||
|
||||
void
|
||||
@ -839,5 +820,26 @@ namespace cling {
|
||||
}
|
||||
}
|
||||
|
||||
void IncrementalParser::setTransformers(bool isChildInterpreter) {
|
||||
// Add transformers to the IncrementalParser, which owns them
|
||||
Sema* TheSema = &m_CI->getSema();
|
||||
// Register the AST Transformers
|
||||
typedef std::unique_ptr<ASTTransformer> ASTTPtr_t;
|
||||
std::vector<ASTTPtr_t> ASTTransformers;
|
||||
ASTTransformers.emplace_back(new AutoSynthesizer(TheSema));
|
||||
ASTTransformers.emplace_back(new EvaluateTSynthesizer(TheSema));
|
||||
ASTTransformers.emplace_back(new NullDerefProtectionTransformer(TheSema));
|
||||
|
||||
typedef std::unique_ptr<WrapperTransformer> WTPtr_t;
|
||||
std::vector<WTPtr_t> WrapperTransformers;
|
||||
WrapperTransformers.emplace_back(new ValuePrinterSynthesizer(TheSema, 0));
|
||||
WrapperTransformers.emplace_back(new DeclExtractor(TheSema));
|
||||
WrapperTransformers.emplace_back(new ValueExtractionSynthesizer(TheSema, isChildInterpreter));
|
||||
WrapperTransformers.emplace_back(new CheckEmptyTransactionTransformer(TheSema));
|
||||
|
||||
m_Consumer->SetTransformers(std::move(ASTTransformers),
|
||||
std::move(WrapperTransformers));
|
||||
}
|
||||
|
||||
|
||||
} // namespace cling
|
||||
|
@ -222,6 +222,10 @@ namespace cling {
|
||||
///
|
||||
bool runStaticInitOnTransaction(Transaction* T) const;
|
||||
|
||||
///\brief Add the trnasformers to the Incremental Parser.
|
||||
///
|
||||
void setTransformers(bool isChildInterpreter);
|
||||
|
||||
private:
|
||||
///\brief Finalizes the consumers (e.g. CodeGen) on a transaction.
|
||||
///
|
||||
@ -252,6 +256,7 @@ namespace cling {
|
||||
/// duplicated by CodeGen.
|
||||
///
|
||||
bool shouldIgnore(const clang::Decl* D) const;
|
||||
|
||||
};
|
||||
} // end namespace cling
|
||||
#endif // CLING_INCREMENTAL_PARSER_H
|
||||
|
@ -229,6 +229,8 @@ namespace cling {
|
||||
AutoLoadCB(new AutoloadCallback(this, showSuggestions));
|
||||
setCallbacks(std::move(AutoLoadCB));
|
||||
}
|
||||
|
||||
m_IncrParser->setTransformers(isChildInterp);
|
||||
}
|
||||
|
||||
///\brief Constructor for the child Interpreter.
|
||||
|
Loading…
x
Reference in New Issue
Block a user