[PATCH] D44048: [DebugInfo] Add DW_AT_byte_size to vectors

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 17:38:34 PST 2018


probinson 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();
----------------
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.


https://reviews.llvm.org/D44048





More information about the llvm-commits mailing list