[clang] [clang-repl] Unlink the withdrawn partial translation unit on Undo (PR #213235)

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 04:09:39 PDT 2026


================
@@ -231,6 +230,9 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl *MostRecentTU) {
         !D->getLangOpts().CPlusPlus)
       S.IdResolver.RemoveDecl(ND);
   }
+
+  // Lookup alone is not enough: the redeclaration chain still reaches these.
+  S.getASTContext().withdrawTranslationUnitDecl();
----------------
vgvassilev wrote:

This change should be done local to the interpreter infrastructure. We can disconnect the last PTU from the redecl chain by effectively rebuilding it. You can take a look at how cling does it. 

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


More information about the cfe-commits mailing list