[clang] [Clang] Instantiate constexpr function when they are needed. (PR #173537)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 06:14:52 PST 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,h -- clang/include/clang/AST/ASTContext.h clang/include/clang/Sema/Sema.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ByteCode/Interp.cpp clang/lib/AST/ByteCode/InterpState.cpp clang/lib/AST/ByteCode/State.h clang/lib/AST/ExprConstShared.h clang/lib/AST/ExprConstant.cpp clang/lib/Interpreter/IncrementalParser.cpp clang/lib/Parse/ParseAST.cpp clang/lib/Sema/Sema.cpp clang/test/SemaCXX/constexpr-late-instantiation.cpp clang/test/SemaCXX/constexpr-subobj-initialization.cpp clang/test/SemaCXX/cxx2b-consteval-propagate.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/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index de0658263..4f23ddb22 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -225,7 +225,6 @@ struct SemaProxy {
   virtual void
   instantiateFunctionDefinition(SourceLocation PointOfInstantiation,
                                 FunctionDecl *Function) = 0;
-
 };
 struct PFPField {
   CharUnits Offset;
diff --git a/clang/lib/AST/ExprConstShared.h b/clang/lib/AST/ExprConstShared.h
index 14deff15d..45c7db846 100644
--- a/clang/lib/AST/ExprConstShared.h
+++ b/clang/lib/AST/ExprConstShared.h
@@ -90,7 +90,6 @@ std::optional<llvm::APFloat>
 EvalScalarMinMaxFp(const llvm::APFloat &A, const llvm::APFloat &B,
                    std::optional<llvm::APSInt> RoundingMode, bool IsMin);
 
-
 /// Whether we can instantiate FD during constant evaluation
 bool FunctionDefinitionCanBeLazilyInstantiated(const FunctionDecl *FD);
 

``````````

</details>


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


More information about the cfe-commits mailing list