5353#include " llvm/IR/LLVMContext.h"
5454#include " llvm/IR/Module.h"
5555#include " llvm/Support/CrashRecoveryContext.h"
56+ #include " llvm/Support/Error.h"
5657#include " llvm/Support/MemoryBuffer.h"
5758
5859#include < stdio.h>
@@ -911,8 +912,11 @@ namespace cling {
911912 PP .EnterSourceFile (FID , /* DirLookup*/ nullptr , NewLoc);
912913 m_Consumer->getTransaction ()->setBufferFID (FID );
913914
914- if (!ParseOrWrapTopLevelDecl ())
915+ llvm::Error res = ParseOrWrapTopLevelDecl ();
916+ if (res) {
917+ llvm::consumeError (std::move (res));
915918 return kFailed ;
919+ }
916920
917921 if (PP .getLangOpts ().DelayedTemplateParsing ) {
918922 // Microsoft-specific:
@@ -939,7 +943,7 @@ namespace cling {
939943 return kSuccess ;
940944 }
941945
942- llvm::Expected< bool > IncrementalParser::ParseOrWrapTopLevelDecl () {
946+ llvm::Error IncrementalParser::ParseOrWrapTopLevelDecl () {
943947 // Recover resources if we crash before exiting this method.
944948 Sema& S = getCI ()->getSema ();
945949 DiagnosticsEngine& Diags = getCI ()->getDiagnostics ();
@@ -993,7 +997,7 @@ namespace cling {
993997 // Let's ignore this transaction:
994998 m_Consumer->getTransaction ()->setIssuedDiags (Transaction::kErrors );
995999
996- return true ;
1000+ return llvm::Error::success () ;
9971001 }
9981002
9991003 // Process any TopLevelDecls generated by #pragma weak.
@@ -1005,7 +1009,7 @@ namespace cling {
10051009 LocalInstantiations.perform ();
10061010 GlobalInstantiations.perform ();
10071011
1008- return true ;
1012+ return llvm::Error::success () ;
10091013 }
10101014
10111015 void IncrementalParser::printTransactionStructure () const {
0 commit comments