Add interface in cling::Interpreter that avoids lexing, parsing and sematic

analysis. It just takes the transaction runs all the transformers on it 
(depending on the compilation options residing in the transaction itself) and
generate code for it.


git-svn-id: http://root.cern.ch/svn/root/trunk@47518 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Vassil Vassilev 2012-11-21 02:28:31 +00:00
parent 4008ac3681
commit 512d1bbf21
2 changed files with 19 additions and 1 deletions

View File

@ -475,7 +475,7 @@ namespace cling {
/// expression result is an aggregate.
///
///\returns Whether the operation was fully successful.
///
///
CompilationResult echo(const std::string& input, StoredValueRef* V = 0);
///\brief Compiles input line and runs.
@ -490,6 +490,17 @@ namespace cling {
///
CompilationResult execute(const std::string& input);
///\brief Generates code for a given transaction. NOTE: we will have to
/// think of better name because it doesn't do codegen only it applies the
/// specified by the compilation options transformations, too.
///
/// @param[in] T - The cling::Transaction that contains the declarations and
/// the compilation/generation options.
///
///\returns Whether the operation was fully successfil.
///
CompilationResult codegen(Transaction* T);
///\brief Loads header file or shared library.
///
///\param [in] filename - The file to loaded.

View File

@ -471,6 +471,13 @@ namespace cling {
return Interpreter::kFailure;
}
Interpreter::CompilationResult Interpreter::codegen(Transaction* T) {
m_IncrParser->commitTransaction(T);
if (T->getState() == Transaction::kCommitted)
return Interpreter::kSuccess;
return Interpreter::kFailure;
}
void Interpreter::WrapInput(std::string& input, std::string& fname) {
fname = createUniqueWrapper();
input.insert(0, "void " + fname + "() {\n ");