@@ -1421,10 +1421,14 @@ void DwarfUnit::applySubprogramAttributes(const DISubprogram *SP, DIE &SPDie,
14211421 addFlag (SPDie, dwarf::DW_AT_deleted);
14221422}
14231423
1424- void DwarfUnit::constructSubrangeDIE (DIE &Buffer, const DISubrange *SR,
1425- DIE *IndexTy) {
1424+ void DwarfUnit::constructSubrangeDIE (DIE &Buffer, const DISubrange *SR) {
14261425 DIE &DW_Subrange = createAndAddDIE (dwarf::DW_TAG_subrange_type, Buffer);
1427- addDIEEntry (DW_Subrange, dwarf::DW_AT_type, *IndexTy);
1426+
1427+ // Get an anonymous type for index type.
1428+ // FIXME: This type should be passed down from the front end
1429+ // as different languages may have different sizes for indexes.
1430+ DIE *IdxTy = getIndexTyDie ();
1431+ addDIEEntry (DW_Subrange, dwarf::DW_AT_type, *IdxTy);
14281432
14291433 // The LowerBound value defines the lower bounds which is typically zero for
14301434 // C/C++. The Count value is the number of elements. Values are 64 bit. If
@@ -1463,11 +1467,14 @@ void DwarfUnit::constructSubrangeDIE(DIE &Buffer, const DISubrange *SR,
14631467}
14641468
14651469void DwarfUnit::constructGenericSubrangeDIE (DIE &Buffer,
1466- const DIGenericSubrange *GSR,
1467- DIE *IndexTy) {
1470+ const DIGenericSubrange *GSR) {
14681471 DIE &DwGenericSubrange =
14691472 createAndAddDIE (dwarf::DW_TAG_generic_subrange, Buffer);
1470- addDIEEntry (DwGenericSubrange, dwarf::DW_AT_type, *IndexTy);
1473+ // Get an anonymous type for index type.
1474+ // FIXME: This type should be passed down from the front end
1475+ // as different languages may have different sizes for indexes.
1476+ DIE *IdxTy = getIndexTyDie ();
1477+ addDIEEntry (DwGenericSubrange, dwarf::DW_AT_type, *IdxTy);
14711478
14721479 int64_t DefaultLowerBound = getDefaultLowerBound ();
14731480
@@ -1600,18 +1607,13 @@ void DwarfUnit::constructArrayTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
16001607 // Emit the element type.
16011608 addType (Buffer, CTy->getBaseType ());
16021609
1603- // Get an anonymous type for index type.
1604- // FIXME: This type should be passed down from the front end
1605- // as different languages may have different sizes for indexes.
1606- DIE *IdxTy = getIndexTyDie ();
1607-
16081610 // Add subranges to array type.
16091611 DINodeArray Elements = CTy->getElements ();
16101612 for (DINode *E : Elements) {
16111613 if (auto *Element = dyn_cast_or_null<DISubrange>(E))
1612- constructSubrangeDIE (Buffer, Element, IdxTy );
1614+ constructSubrangeDIE (Buffer, Element);
16131615 else if (auto *Element = dyn_cast_or_null<DIGenericSubrange>(E))
1614- constructGenericSubrangeDIE (Buffer, Element, IdxTy );
1616+ constructGenericSubrangeDIE (Buffer, Element);
16151617 }
16161618}
16171619
0 commit comments