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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 16 06:14:48 PDT 2026


================
@@ -1427,6 +1439,16 @@ class ASTContext : public RefCountedBase<ASTContext> {
   /// with this AST context, if any.
   ASTMutationListener *getASTMutationListener() const { return Listener; }
 
+  /// Returns a SemaProxy*, i.e an object through which interact with Sema.
+  /// This will return null, unless setSemaProxy has been called.
+  /// As Sema is only available during parsing, getSemaProxy will return null
+  /// during CodeGen and when using the AST from tooling.
+  SemaProxy *getSemaProxy() { return SemaProxyPtr.get(); }
----------------
AaronBallman wrote:

Given that we're already asking for viral changes to interfaces, do we want to aim for const correctness by having `cost SemaProxy *getSemaProxy() const` in addition? If it's too disruptive, I don't insist, but I would like to see it explored.

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


More information about the cfe-commits mailing list