[clang] [Clang] Instantiate constexpr function when they are needed. (PR #173537)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 16 06:22:57 PDT 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:
The answer is likely, all of them. And that does not help, because what matters is that whether or not there is a `SemaProxy` object in some location does not mean you get to arbitrarily use it.
What matters is the context you are in. And for reflection, we will need additional contexts to match the standard wording. Ie only in consteval blocs are some operations allowed. For example, you can only call substitute in a constebal blocks, but members_of you can call anywhere.
We also use the same entry points for different form of evaluations, so the state you seem to bee looking for already exists - ie all the booleans in the EvalInfo object.
So yes, we will always need to think if an interface can be called in some context. But that's no different from status quo.
https://github.com/llvm/llvm-project/pull/173537
More information about the cfe-commits
mailing list