From 35c1d0a4f1073490e472fbacd178944ddd35c5b6 Mon Sep 17 00:00:00 2001 From: Vipul Cariappa Date: Sat, 30 Nov 2024 15:49:40 +0530 Subject: [PATCH] fix error handling when parsing invaild code by consuming the Error --- lib/Interpreter/IncrementalParser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Interpreter/IncrementalParser.cpp b/lib/Interpreter/IncrementalParser.cpp index 58e2b56736..e176d98e4e 100644 --- a/lib/Interpreter/IncrementalParser.cpp +++ b/lib/Interpreter/IncrementalParser.cpp @@ -911,8 +911,11 @@ namespace cling { PP.EnterSourceFile(FID, /*DirLookup*/nullptr, NewLoc); m_Consumer->getTransaction()->setBufferFID(FID); - if (!ParseOrWrapTopLevelDecl()) + llvm::Expected res = ParseOrWrapTopLevelDecl(); + if (!res) { + llvm::consumeError(std::move(res.takeError())); return kFailed; + } if (PP.getLangOpts().DelayedTemplateParsing) { // Microsoft-specific: