[clang] [LifetimeSafety] Simplify `AccessPath` root `PointerUnion` (PR #193520)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 23 02:13:31 PDT 2026


NeKon69 wrote:

I'm not sure. I also did this in the commit before the current one, but isn't the whole point of the first dyn_cast that it can return nullptr if it fails? If it can't fail here because we already checked the current active type, then why can't we just do the dyn_cast directly without checking the current active type first?

Sorry if this is a bit confusing. What I mean is:

```cpp
return dyn_cast<ValueDecl*>(Root.dyn_cast<const Decl*>());
```

Wouldn't this give pretty much the same result as the current code?

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


More information about the cfe-commits mailing list