@@ -1184,11 +1184,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1184
1184
return OpaqueType;
1185
1185
}
1186
1186
1187
- auto *opaqueType = createOpaqueStructWithSizedContainer (
1188
- Scope, Decl ? Decl->getNameStr () : " " , File, Line, SizeInBits,
1189
- AlignInBits, Flags, MangledName, collectGenericParams (Type),
1190
- UnsubstitutedType);
1191
- return opaqueType;
1187
+ auto *OpaqueType = createOpaqueStruct (
1188
+ Scope, " " , File, Line, SizeInBits, AlignInBits, Flags, MangledName,
1189
+ collectGenericParams (Type), UnsubstitutedType);
1190
+ return OpaqueType;
1192
1191
}
1193
1192
1194
1193
// / Create debug information for an enum with a raw type (enum E : Int {}).
@@ -1624,12 +1623,19 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1624
1623
llvm::DICompositeType *
1625
1624
createOpaqueStruct (llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File,
1626
1625
unsigned Line, unsigned SizeInBits, unsigned AlignInBits,
1627
- llvm::DINode::DIFlags Flags, StringRef MangledName) {
1628
- return DBuilder.createStructType (
1626
+ llvm::DINode::DIFlags Flags, StringRef MangledName,
1627
+ llvm::DINodeArray BoundParams = {},
1628
+ llvm::DIType *SpecificationOf = nullptr ) {
1629
+
1630
+ auto StructType = DBuilder.createStructType (
1629
1631
Scope, Name, File, Line, SizeInBits, AlignInBits, Flags,
1630
1632
/* DerivedFrom */ nullptr ,
1631
1633
DBuilder.getOrCreateArray (ArrayRef<llvm::Metadata *>()),
1632
- llvm::dwarf::DW_LANG_Swift, nullptr , MangledName);
1634
+ llvm::dwarf::DW_LANG_Swift, nullptr , MangledName, SpecificationOf);
1635
+
1636
+ if (BoundParams)
1637
+ DBuilder.replaceArrays (StructType, nullptr , BoundParams);
1638
+ return StructType;
1633
1639
}
1634
1640
1635
1641
bool shouldCacheDIType (llvm::DIType *DITy, DebugTypeInfo &DbgTy) {
@@ -2012,11 +2018,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2012
2018
// Force the creation of the unsubstituted type, don't create it
2013
2019
// directly so it goes through all the caching/verification logic.
2014
2020
auto unsubstitutedDbgTy = getOrCreateType (DbgTy);
2015
- DBuilder.retainType (unsubstitutedDbgTy);
2016
- return createOpaqueStructWithSizedContainer (
2017
- Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
2018
- AlignInBits, Flags, MangledName, collectGenericParams (EnumTy),
2019
- unsubstitutedDbgTy);
2021
+ return createOpaqueStruct (
2022
+ Scope, " " , L.File , FwdDeclLine, SizeInBits, AlignInBits, Flags,
2023
+ MangledName, collectGenericParams (EnumTy), unsubstitutedDbgTy);
2020
2024
}
2021
2025
return createOpaqueStructWithSizedContainer (
2022
2026
Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
0 commit comments