[clang] [clang-repl] Re-emit implicitly instantiated templates on subsequent uses (PR #192588)

via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 02:47:15 PDT 2026


================
@@ -19061,6 +19061,15 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
         }
       }
     });
+  } else if (NeedDefinition && getLangOpts().IncrementalExtensions &&
----------------
voyager-jhk wrote:

Hi @vgvassilev, you are right. Modifying `Sema` is the wrong layer.
I considered resetting the `InvalidDecl` flags inside `IncrementalParser::CleanUpPTU`. However, this still feels like a workaround, as it leaves orphaned template instantiations lingering in the AST. The proper fix seems to require a full transactional AST rollback?

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


More information about the cfe-commits mailing list