@@ -1184,11 +1184,10 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11841184 return OpaqueType;
11851185 }
11861186
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;
11921191 }
11931192
11941193 // / Create debug information for an enum with a raw type (enum E : Int {}).
@@ -1624,12 +1623,19 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
16241623 llvm::DICompositeType *
16251624 createOpaqueStruct (llvm::DIScope *Scope, StringRef Name, llvm::DIFile *File,
16261625 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 (
16291631 Scope, Name, File, Line, SizeInBits, AlignInBits, Flags,
16301632 /* DerivedFrom */ nullptr ,
16311633 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;
16331639 }
16341640
16351641 bool shouldCacheDIType (llvm::DIType *DITy, DebugTypeInfo &DbgTy) {
@@ -2012,11 +2018,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
20122018 // Force the creation of the unsubstituted type, don't create it
20132019 // directly so it goes through all the caching/verification logic.
20142020 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);
20202024 }
20212025 return createOpaqueStructWithSizedContainer (
20222026 Scope, Decl->getName ().str (), L.File , FwdDeclLine, SizeInBits,
0 commit comments