[clang] [Clang][NFC] Add nullptr check in InitializationSequence::InitializeFrom (PR #143067)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 9 06:39:49 PDT 2025


AaronBallman wrote:

> If this were a bug, I suspect it would have been reported. Most likely, `dyn_cast_or_null<VarDecl>(Entity.getDecl());` is never null, and could be replaced by `cast`? Did you try that?

`getDecl()` can definitely return null: https://github.com/llvm/llvm-project/blob/e4060d3beab3b525b49baaa15484e3c595740a2f/clang/lib/Sema/SemaInit.cpp#L3728

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


More information about the cfe-commits mailing list