[clang] [NFC][analyzer] Tweak constness of CheckerContext methods (PR #218937)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 08:06:34 PDT 2026
NagyDonat wrote:
> The removal of `const ExplodedNode *getPredecessor() const;` made it controversial, as you need it to avoid a `const_cast` when you are holding an immutable `CheckerContext` and need the pred node.
Even if the `CheckerContext` is immutable, this method can return its "pointer to non-const `ExplodedNode`" data member by value. (And then "pointer to non-const `ExplodedNode`" is implicitly convertible to "pointer to const `ExplodedNode`".)
We don't lose any opportunity with this change.
https://github.com/llvm/llvm-project/pull/218937
More information about the cfe-commits
mailing list