Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions lib/Interpreter/CppInterOpInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,7 @@ class Interpreter {

CompilationResult declare(const std::string& input,
clang::PartialTranslationUnit** PTU = nullptr) {
auto PTUOrErr = Parse(input);
if (!PTUOrErr) {
llvm::logAllUnhandledErrors(PTUOrErr.takeError(), llvm::errs(),
"Failed to parse via ::process:");
return Interpreter::kFailure;
}
if (PTU)
*PTU = &*PTUOrErr;
return Interpreter::kSuccess;
return process(input, /*Value=*/nullptr, PTU);
}

///\brief Maybe transform the input line to implement cint command line
Expand All @@ -270,14 +262,17 @@ class Interpreter {
CompilationResult process(const std::string& input, clang::Value* V = 0,
clang::PartialTranslationUnit** PTU = nullptr,
bool disableValuePrinting = false) {
clang::PartialTranslationUnit* ParsePTU = nullptr;
if (declare(input, &ParsePTU))
auto PTUOrErr = Parse(input);
if (!PTUOrErr) {
llvm::logAllUnhandledErrors(PTUOrErr.takeError(), llvm::errs(),
"Failed to parse via ::process:");
return Interpreter::kFailure;
}

if (PTU)
*PTU = ParsePTU;
*PTU = &*PTUOrErr;

if (auto Err = Execute(*ParsePTU)) {
if (auto Err = Execute(*PTUOrErr)) {
llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(),
"Failed to execute via ::process:");
return Interpreter::kFailure;
Expand Down