Skip to content
Snippets Groups Projects
Commit 8fb00f7b authored by Axel Naumann's avatar Axel Naumann
Browse files

Interpreter::process now uses Evaluate() features for value yes / no, wrap yes...

Interpreter::process now uses Evaluate() features for value yes / no, wrap yes / no, and running the function. Again reducing the line count...
Keep printAST also for declare()
Silence diagnostics for all code paths through Evaluate().


git-svn-id: http://root.cern.ch/svn/root/trunk@43967 27541ba8-7e3a-0410-8455-c3a389f83636
parent e1ae5e95
No related branches found
No related tags found
No related merge requests found
...@@ -401,14 +401,6 @@ namespace cling { ...@@ -401,14 +401,6 @@ namespace cling {
Interpreter::CompilationResult Interpreter::CompilationResult
Interpreter::process(const std::string& input, Value* V /* = 0 */, Interpreter::process(const std::string& input, Value* V /* = 0 */,
const Decl** D /* = 0 */) { const Decl** D /* = 0 */) {
DiagnosticsEngine& Diag = getCI()->getDiagnostics();
// Disable warnings which doesn't make sense when using the prompt
// This gets reset with the clang::Diagnostics().Reset()
Diag.setDiagnosticMapping(clang::diag::warn_unused_expr,
clang::diag::MAP_IGNORE, SourceLocation());
Diag.setDiagnosticMapping(clang::diag::warn_unused_call,
clang::diag::MAP_IGNORE, SourceLocation());
CompilationOptions CO; CompilationOptions CO;
CO.DeclarationExtraction = 1; CO.DeclarationExtraction = 1;
CO.ValuePrinting = CompilationOptions::VPAuto; CO.ValuePrinting = CompilationOptions::VPAuto;
...@@ -418,30 +410,16 @@ namespace cling { ...@@ -418,30 +410,16 @@ namespace cling {
if (!canWrapForCall(input)) if (!canWrapForCall(input))
return declare(input, D); return declare(input, D);
if (V) { if (Evaluate(input, CO, V) == Interpreter::kFailure) {
return Evaluate(input, CO, V); if (D)
*D = 0;
return Interpreter::kFailure;
} }
std::string functName;
std::string wrapped = input;
WrapInput(wrapped, functName);
if (m_IncrParser->Compile(wrapped, CO) == IncrementalParser::kFailed)
return Interpreter::kFailure;
if (D) if (D)
*D = m_IncrParser->getLastTransaction().getFirstDecl(); *D = m_IncrParser->getLastTransaction().getFirstDecl();
// return Interpreter::kSuccess;
// Run it using the JIT.
//
// TODO: Handle the case when RunFunction wasn't able to run the function
bool RunRes = RunFunction(functName);
if (RunRes)
return Interpreter::kSuccess;
return Interpreter::kFailure;
} }
Interpreter::CompilationResult Interpreter::CompilationResult
...@@ -450,6 +428,7 @@ namespace cling { ...@@ -450,6 +428,7 @@ namespace cling {
CO.DeclarationExtraction = 0; CO.DeclarationExtraction = 0;
CO.ValuePrinting = 0; CO.ValuePrinting = 0;
CO.DynamicScoping = isDynamicLookupEnabled(); CO.DynamicScoping = isDynamicLookupEnabled();
CO.Debug = isPrintingAST();
return Declare(input, CO, D); return Declare(input, CO, D);
} }
...@@ -542,6 +521,14 @@ namespace cling { ...@@ -542,6 +521,14 @@ namespace cling {
Sema& TheSema = getCI()->getSema(); Sema& TheSema = getCI()->getSema();
DiagnosticsEngine& Diag = getCI()->getDiagnostics();
// Disable warnings which doesn't make sense when using the prompt
// This gets reset with the clang::Diagnostics().Reset()
Diag.setDiagnosticMapping(clang::diag::warn_unused_expr,
clang::diag::MAP_IGNORE, SourceLocation());
Diag.setDiagnosticMapping(clang::diag::warn_unused_call,
clang::diag::MAP_IGNORE, SourceLocation());
// Wrap the expression // Wrap the expression
std::string WrapperName; std::string WrapperName;
std::string Wrapper = input; std::string Wrapper = input;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment