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

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 24 09:10:26 PST 2026


================
@@ -786,6 +797,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
   /// Keeps track of the deallocated DeclListNodes for future reuse.
   DeclListNode *ListNodeFreeList = nullptr;
 
+  std::unique_ptr<SemaProxy> SemaProxyPtr;
----------------
cor3ntin wrote:

See the description of the PR.
For reflection, we will need to pass around (or put on the stack or something) some sort of additional context (and/or modify EvaluationContext, which would be better).

It's important to separate "do we have access to sema" from "can we do that specific thing" - notably because sema can do different things some but not all of which can be valid in a particular context - here we need to check for example that we are in a constant context, not doing trial evaluation, not checking for overflow, etc  

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


More information about the cfe-commits mailing list