@@ -1079,8 +1079,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1079
1079
llvm::dwarf::DW_TAG_structure_type, UniqueID, Scope, File, Line,
1080
1080
llvm::dwarf::DW_LANG_Swift, SizeInBits, 0 );
1081
1081
}
1082
- if (OffsetInBits > SizeInBits)
1083
- SizeInBits = OffsetInBits;
1084
1082
1085
1083
auto DITy = DBuilder.createStructType (
1086
1084
Scope, Name, File, Line, SizeInBits, AlignInBits, Flags, DerivedFrom,
@@ -1526,8 +1524,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1526
1524
? 0
1527
1525
: DbgTy.getAlignment ().getValue () * SizeOfByte;
1528
1526
unsigned Encoding = 0 ;
1529
- uint32_t NumExtraInhabitants =
1530
- DbgTy.getNumExtraInhabitants () ? *DbgTy.getNumExtraInhabitants () : 0 ;
1527
+ uint32_t NumExtraInhabitants = DbgTy.getNumExtraInhabitants ().value_or (0 );
1531
1528
1532
1529
llvm::DINode::DIFlags Flags = llvm::DINode::FlagZero;
1533
1530
@@ -1644,6 +1641,25 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1644
1641
unsigned FwdDeclLine = 0 ;
1645
1642
assert (SizeInBits ==
1646
1643
CI.getTargetInfo ().getPointerWidth (clang::LangAS::Default));
1644
+ if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) {
1645
+ auto *DIType = createStructType (
1646
+ DbgTy, Decl, ClassTy, Scope, File, L.Line , SizeInBits, AlignInBits,
1647
+ Flags, nullptr , llvm::dwarf::DW_LANG_Swift, MangledName);
1648
+ assert (DIType && " Unexpected null DIType!" );
1649
+ assert (DIType && " createStructType should never return null!" );
1650
+ auto SuperClassTy = ClassTy->getSuperclass ();
1651
+ if (SuperClassTy) {
1652
+ auto SuperClassDbgTy = DebugTypeInfo::getFromTypeInfo (
1653
+ SuperClassTy, IGM.getTypeInfoForUnlowered (SuperClassTy), IGM,
1654
+ false );
1655
+
1656
+ llvm::DIType *SuperClassDITy = getOrCreateType (SuperClassDbgTy);
1657
+ assert (SuperClassDITy && " getOrCreateType should never return null!" );
1658
+ DBuilder.retainType (DBuilder.createInheritance (
1659
+ DIType, SuperClassDITy, 0 , 0 , llvm::DINode::FlagZero));
1660
+ }
1661
+ return DIType;
1662
+ }
1647
1663
return createPointerSizedStruct (Scope, Decl->getNameStr (), L.File ,
1648
1664
FwdDeclLine, Flags, MangledName);
1649
1665
}
@@ -2021,7 +2037,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2021
2037
void createSpecialStlibBuiltinTypes () {
2022
2038
if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::ASTTypes)
2023
2039
return ;
2024
- for (auto BuiltinType: IGM.getSpecialBuiltinTypes ()) {
2040
+ for (auto BuiltinType: IGM.getOrCreateSpecialStlibBuiltinTypes ()) {
2025
2041
auto DbgTy = DebugTypeInfo::getFromTypeInfo (
2026
2042
BuiltinType, IGM.getTypeInfoForUnlowered (BuiltinType), IGM, false );
2027
2043
DBuilder.retainType (getOrCreateType (DbgTy));
0 commit comments