[clang] [clang-repl] Keep the first llvm::Module empty to avoid invalid memory access. (PR #89031)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 07:28:00 PDT 2024


================
@@ -224,11 +228,8 @@ IncrementalParser::IncrementalParser(Interpreter &Interp,
     return;                     // PTU.takeError();
   }
 
-  if (CodeGenerator *CG = getCodeGen()) {
-    std::unique_ptr<llvm::Module> M(CG->ReleaseModule());
-    CG->StartModule("incr_module_" + std::to_string(PTUs.size()),
-                    M->getContext());
-    PTU->TheModule = std::move(M);
+  if (getCodeGen()) {
+    PTU->TheModule = std::move(GenModule());
----------------
vgvassilev wrote:

Yes, independent clean up. 

https://github.com/llvm/llvm-project/pull/89031


More information about the cfe-commits mailing list