Skip to content

Commit ed3ce91

Browse files
committed
Remove a FIXME from DwarfUnit::constructArrayTypeDIE
DwarfUnit::constructArrayTypeDIE has a FIXME comment related to an over-broad cast. As I am planning to add a new case in this spot, this patch first refactors it to be more precise.
1 parent f0d61ea commit ed3ce91

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,14 +1608,10 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
16081608
// Add subranges to array type.
16091609
DINodeArray Elements = CTy->getElements();
16101610
for (DINode *E : Elements) {
1611-
// FIXME: Should this really be such a loose cast?
1612-
if (auto *Element = dyn_cast_or_null<DINode>(E)) {
1613-
if (Element->getTag() == dwarf::DW_TAG_subrange_type)
1614-
constructSubrangeDIE(Buffer, cast<DISubrange>(Element), IdxTy);
1615-
else if (Element->getTag() == dwarf::DW_TAG_generic_subrange)
1616-
constructGenericSubrangeDIE(Buffer, cast<DIGenericSubrange>(Element),
1617-
IdxTy);
1618-
}
1611+
if (auto *Element = dyn_cast_or_null<DISubrange>(E))
1612+
constructSubrangeDIE(Buffer, Element, IdxTy);
1613+
else if (auto *Element = dyn_cast_or_null<DIGenericSubrange>(E))
1614+
constructGenericSubrangeDIE(Buffer, Element, IdxTy);
16191615
}
16201616
}
16211617

0 commit comments

Comments
 (0)