[clang] Enable AST mutation in the constant evaluator (PR #115168)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 01:48:38 PST 2024


cor3ntin wrote:

@zygoloid I think we ended up concluding that

- The tooling situation will not change (When Sema is not available mutation can't happen and we provide a default no-op implementation of the mutation function)
- It's easy to check in `SemaProxyImpl` (or wherever it's called from ) that define class etc only happen in what P2996 calls a "plainly evaluated constant evaluated context" (constexpr initialization + consteval block as of the Poland meeting)

I initially was of the same opinion as you, but I think we would have to modify most call sites, and it's unclear that it would buy us anything (On the other hand, I'm not thrilled about a pointer to Sema being stashed in `ASTContext`, just because it  feels weird, but it's not an issue in practice)

PS: Note that it seems to still be unclear how we should handle try evaluation (destructors, vlas), when the evaluation fails after side effects are produced



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


More information about the cfe-commits mailing list