diff --git a/clang/lib/Interpreter/IncrementalParser.cpp b/clang/lib/Interpreter/IncrementalParser.cpp index 0f1ef3233a2a..e5712303cbbb 100644 --- a/clang/lib/Interpreter/IncrementalParser.cpp +++ b/clang/lib/Interpreter/IncrementalParser.cpp @@ -134,7 +134,10 @@ IncrementalParser::IncrementalParser(std::unique_ptr Instance, P->Initialize(); } -IncrementalParser::~IncrementalParser() { Act->FinalizeAction(); } +IncrementalParser::~IncrementalParser() { + P.reset(); + Act->FinalizeAction(); +} llvm::Expected IncrementalParser::ParseOrWrapTopLevelDecl() { diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index 470c9c289a74..564b24efebdd 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -116,6 +116,9 @@ CreateCI(const llvm::opt::ArgStringList &Argv) { // times, reusing the same AST. Clang->getCodeGenOpts().ClearASTBeforeBackend = false; + Clang->getFrontendOpts().DisableFree = false; + Clang->getCodeGenOpts().DisableFree = false; + return std::move(Clang); }