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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 21 02:47:47 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/test/Interpreter/template-recovery.cpp clang/lib/Sema/SemaExpr.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0a30a9c2f..b4fa0bec0 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -19047,10 +19047,11 @@ void Sema::MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func,
     });
   } else if (NeedDefinition && getLangOpts().IncrementalExtensions) {
     const FunctionDecl *Def = nullptr;
-    if (Func->getBody(Def) && 
+    if (Func->getBody(Def) &&
         Def->getTemplateSpecializationKind() == TSK_ImplicitInstantiation &&
         !Def->isInvalidDecl()) {
-      Consumer.HandleTopLevelDecl(DeclGroupRef(const_cast<FunctionDecl*>(Def)));
+      Consumer.HandleTopLevelDecl(
+          DeclGroupRef(const_cast<FunctionDecl *>(Def)));
     }
   }
 

``````````

</details>


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


More information about the cfe-commits mailing list