@@ -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,
@@ -1644,7 +1642,25 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1644
1642
unsigned FwdDeclLine = 0 ;
1645
1643
assert (SizeInBits ==
1646
1644
CI.getTargetInfo ().getPointerWidth (clang::LangAS::Default));
1647
- return createPointerSizedStruct (Scope, Decl->getNameStr (), L.File ,
1645
+ if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes) {
1646
+ auto *DIType = createStructType (
1647
+ DbgTy, Decl, ClassTy, Scope, File, L.Line , SizeInBits, AlignInBits,
1648
+ Flags, nullptr , llvm::dwarf::DW_LANG_Swift, MangledName);
1649
+ auto SuperClassTy = ClassTy->getSuperclass ();
1650
+ if (DIType && SuperClassTy) {
1651
+ auto SuperClassDbgTy = DebugTypeInfo::getFromTypeInfo (
1652
+ SuperClassTy, IGM.getTypeInfoForUnlowered (SuperClassTy), IGM,
1653
+ false );
1654
+
1655
+ llvm::DIType *SuperClassDITy = getOrCreateType (SuperClassDbgTy);
1656
+ if (SuperClassDITy) {
1657
+ DBuilder.retainType (DBuilder.createInheritance (
1658
+ DIType, SuperClassDITy, 0 , 0 , llvm::DINode::FlagZero));
1659
+ }
1660
+ }
1661
+ return DIType;
1662
+ }
1663
+ return createPointerSizedStruct (Scope, Decl->getNameStr (), File,
1648
1664
FwdDeclLine, Flags, MangledName);
1649
1665
}
1650
1666
@@ -2017,7 +2033,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2017
2033
void createSpecialStlibBuiltinTypes () {
2018
2034
if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::ASTTypes)
2019
2035
return ;
2020
- for (auto BuiltinType: IGM.getSpecialBuiltinTypes ()) {
2036
+ for (auto BuiltinType: IGM.getOrCreateSpecialStlibBuiltinTypes ()) {
2021
2037
auto DbgTy = DebugTypeInfo::getFromTypeInfo (
2022
2038
BuiltinType, IGM.getTypeInfoForUnlowered (BuiltinType), IGM, false );
2023
2039
DBuilder.retainType (getOrCreateType (DbgTy));
0 commit comments