[PATCH] D44048: [DebugInfo] Add DW_AT_byte_size to vectors
Eric Christopher via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 2 17:41:14 PST 2018
echristo added inline comments.
================
Comment at: lib/CodeGen/AsmPrinter/DwarfUnit.cpp:1428
+ const auto Subrange = cast<DISubrange>(Elements[0]);
+ const auto CI = Subrange->getCount().dyn_cast<ConstantInt *>();
+ const int32_t NumVecElements = CI->getSExtValue();
----------------
probinson wrote:
> echristo wrote:
> > probinson wrote:
> > > I think `get<ConstantInt *>` instead of `dyn_cast` so this will assert if it isn't the right type.
> > >
> > Yes, because otherwise you could be grabbing a null pointer as well.
> I'm not really familiar with PointerUnion; the value can be set but still null? So there needs to be an explicit assert here anyway.
dyn_cast returns null if the thing isn't of that type.
https://reviews.llvm.org/D44048
More information about the llvm-commits
mailing list