@@ -1207,11 +1207,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12071207 return OpaqueType;
12081208 }
12091209
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;
12151214 }
12161215
12171216 // / Create debug information for an enum with a raw type (enum E : Int {}).
@@ -1647,12 +1646,19 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
16471646 llvm::DICompositeType *
16481647 createOpaqueStruct (llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File,
16491648 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 (
16521654 Scope, Name, File, Line, SizeInBits, AlignInBits, Flags,
16531655 /* DerivedFrom */ nullptr ,
16541656 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;
16561662 }
16571663
16581664 bool shouldCacheDIType (llvm::DIType *DITy, DebugTypeInfo &DbgTy) {
@@ -2035,11 +2041,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
20352041 // Force the creation of the unsubstituted type, don't create it
20362042 // directly so it goes through all the caching/verification logic.
20372043 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);
20432047 }
20442048 return createOpaqueStructWithSizedContainer (
20452049 Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
0 commit comments