@@ -1207,11 +1207,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1207
1207
return OpaqueType;
1208
1208
}
1209
1209
1210
- auto *opaqueType = createOpaqueStructWithSizedContainer (
1211
- Scope, Decl ? Decl->getNameStr () : " " , File, Line, SizeInBits,
1212
- AlignInBits, Flags, MangledName, collectGenericParams (Type),
1213
- UnsubstitutedType);
1214
- return opaqueType;
1210
+ auto *OpaqueType = createOpaqueStruct (
1211
+ Scope, " " , File, Line, SizeInBits, AlignInBits, Flags, MangledName,
1212
+ collectGenericParams (Type), UnsubstitutedType);
1213
+ return OpaqueType;
1215
1214
}
1216
1215
1217
1216
// / Create debug information for an enum with a raw type (enum E : Int {}).
@@ -1647,12 +1646,19 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1647
1646
llvm::DICompositeType *
1648
1647
createOpaqueStruct (llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File,
1649
1648
unsigned Line, unsigned SizeInBits, unsigned AlignInBits,
1650
- llvm::DINode::DIFlags Flags, StringRef MangledName) {
1651
- return DBuilder.createStructType (
1649
+ llvm::DINode::DIFlags Flags, StringRef MangledName,
1650
+ llvm::DINodeArray BoundParams = {},
1651
+ llvm::DIType *SpecificationOf = nullptr ) {
1652
+
1653
+ auto StructType = DBuilder.createStructType (
1652
1654
Scope, Name, File, Line, SizeInBits, AlignInBits, Flags,
1653
1655
/* DerivedFrom */ nullptr ,
1654
1656
DBuilder.getOrCreateArray (ArrayRef<llvm::Metadata *>()),
1655
- llvm::dwarf::DW_LANG_Swift, nullptr , MangledName);
1657
+ llvm::dwarf::DW_LANG_Swift, nullptr , MangledName, SpecificationOf);
1658
+
1659
+ if (BoundParams)
1660
+ DBuilder.replaceArrays (StructType, nullptr , BoundParams);
1661
+ return StructType;
1656
1662
}
1657
1663
1658
1664
bool shouldCacheDIType (llvm::DIType *DITy, DebugTypeInfo &DbgTy) {
@@ -2035,11 +2041,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2035
2041
// Force the creation of the unsubstituted type, don't create it
2036
2042
// directly so it goes through all the caching/verification logic.
2037
2043
auto unsubstitutedDbgTy = getOrCreateType (DbgTy);
2038
- DBuilder.retainType (unsubstitutedDbgTy);
2039
- return createOpaqueStructWithSizedContainer (
2040
- Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
2041
- AlignInBits, Flags, MangledName, collectGenericParams (EnumTy),
2042
- unsubstitutedDbgTy);
2044
+ return createOpaqueStruct (
2045
+ Scope, " " , L.File , FwdDeclLine, SizeInBits, AlignInBits, Flags,
2046
+ MangledName, collectGenericParams (EnumTy), unsubstitutedDbgTy);
2043
2047
}
2044
2048
return createOpaqueStructWithSizedContainer (
2045
2049
Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
0 commit comments