[clang] [Clang] [NFC] Introduce `ConstDynamicRecursiveASTVisitor` (PR #122991)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 09:18:04 PST 2025


Sirraide wrote:

> Generally looks great. can you explain why the 2 or 3 `const_cast` are needed?

As in e.g. `FORWARD_TO_BASE()`? That’s because the RAV implementation for e.g. `TraverseStmt` accepts a `Stmt*`, but if `Const` is `true`, then `MaybeConst<Stmt> *` would be a `const Stmt*`, so we need to `const_cast` it to a `Stmt*` so we can pass it to the RAV implementation.

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


More information about the cfe-commits mailing list