summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-09-15 18:55:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-09-15 18:55:37 +0000
commite588341d487d7ec86b5282968e3223f8c0e6de27 (patch)
treefaa3fbdcd0e38085bd03d4960bc7ccbe4adf4a38 /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
parentbdc6feb28f528ee3a365ca97577f7312ffa0dc65 (diff)
Notes
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index e958f38e486b..ceeae14c1073 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1417,8 +1417,10 @@ static bool hasVectorBeenPadded(const DICompositeType *CTy) {
Elements[0]->getTag() == dwarf::DW_TAG_subrange_type &&
"Invalid vector element array, expected one element of type subrange");
const auto Subrange = cast<DISubrange>(Elements[0]);
- const auto CI = Subrange->getCount().get<ConstantInt *>();
- const int32_t NumVecElements = CI->getSExtValue();
+ const auto NumVecElements =
+ Subrange->getCount()
+ ? Subrange->getCount().get<ConstantInt *>()->getSExtValue()
+ : 0;
// Ensure we found the element count and that the actual size is wide
// enough to contain the requested size.