@@ -253,15 +253,7 @@ class Interpreter {
253
253
254
254
CompilationResult declare (const std::string& input,
255
255
clang::PartialTranslationUnit** PTU = nullptr ) {
256
- auto PTUOrErr = Parse (input);
257
- if (!PTUOrErr) {
258
- llvm::logAllUnhandledErrors (PTUOrErr.takeError (), llvm::errs (),
259
- " Failed to parse via ::process:" );
260
- return Interpreter::kFailure ;
261
- }
262
- if (PTU)
263
- *PTU = &*PTUOrErr;
264
- return Interpreter::kSuccess ;
256
+ return process (input, /* Value=*/ nullptr , PTU);
265
257
}
266
258
267
259
// /\brief Maybe transform the input line to implement cint command line
@@ -270,14 +262,17 @@ class Interpreter {
270
262
CompilationResult process (const std::string& input, clang::Value* V = 0 ,
271
263
clang::PartialTranslationUnit** PTU = nullptr ,
272
264
bool disableValuePrinting = false ) {
273
- clang::PartialTranslationUnit* ParsePTU = nullptr ;
274
- if (declare (input, &ParsePTU))
265
+ auto PTUOrErr = Parse (input);
266
+ if (!PTUOrErr) {
267
+ llvm::logAllUnhandledErrors (PTUOrErr.takeError (), llvm::errs (),
268
+ " Failed to parse via ::process:" );
275
269
return Interpreter::kFailure ;
270
+ }
276
271
277
272
if (PTU)
278
- *PTU = ParsePTU ;
273
+ *PTU = &*PTUOrErr ;
279
274
280
- if (auto Err = Execute (*ParsePTU )) {
275
+ if (auto Err = Execute (*PTUOrErr )) {
281
276
llvm::logAllUnhandledErrors (std::move (Err), llvm::errs (),
282
277
" Failed to execute via ::process:" );
283
278
return Interpreter::kFailure ;
0 commit comments