@@ -1283,16 +1283,12 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1283
1283
DBuilder.createInheritance (UnsubstitutedType, SuperClassDITy, 0 , 0 ,
1284
1284
llvm::DINode::FlagZero);
1285
1285
}
1286
-
1287
- auto *OpaqueType = createPointerSizedStruct (
1288
- Scope, Decl ? Decl->getNameStr () : MangledName, File, 0 , Flags,
1289
- MangledName, UnsubstitutedType);
1290
- return OpaqueType;
1291
1286
}
1292
1287
1293
- auto *OpaqueType = createOpaqueStruct (
1294
- Scope, " " , File, Line, SizeInBits, AlignInBits, Flags, MangledName,
1295
- collectGenericParams (Type), UnsubstitutedType);
1288
+ auto *OpaqueType =
1289
+ createOpaqueStruct (Scope, Decl ? Decl->getNameStr () : " " , File, Line,
1290
+ SizeInBits, AlignInBits, Flags, MangledName,
1291
+ collectGenericParams (Type), UnsubstitutedType);
1296
1292
DBuilder.replaceTemporary (std::move (FwdDecl), OpaqueType);
1297
1293
return OpaqueType;
1298
1294
}
@@ -1979,18 +1975,9 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1979
1975
auto L = getFileAndLocation (Decl);
1980
1976
unsigned FwdDeclLine = 0 ;
1981
1977
1982
- if (Opts.DebugInfoLevel > IRGenDebugInfoLevel::ASTTypes)
1983
- return createSpecializedStructOrClassType (
1984
- ClassTy, Decl, Scope, L.File , L.Line , SizeInBits, AlignInBits,
1985
- Flags, MangledName);
1986
-
1987
- // TODO: We may want to peek at Decl->isObjC() and set this
1988
- // attribute accordingly.
1989
- assert (SizeInBits ==
1990
- CI.getTargetInfo ().getPointerWidth (clang::LangAS::Default));
1991
- return createPointerSizedStruct (
1992
- Scope, Decl ? Decl->getNameStr () : MangledName, L.File , FwdDeclLine,
1993
- Flags, MangledName, SpecificationOf);
1978
+ return createSpecializedStructOrClassType (ClassTy, Decl, Scope, L.File ,
1979
+ L.Line , SizeInBits, AlignInBits,
1980
+ Flags, MangledName);
1994
1981
}
1995
1982
1996
1983
case TypeKind::Pack:
@@ -2174,8 +2161,14 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2174
2161
AliasedTy, DbgTy.getAlignment (), DbgTy.hasDefaultAlignment (),
2175
2162
/* IsMetadataType = */ false , DbgTy.isFixedBuffer (),
2176
2163
DbgTy.getNumExtraInhabitants ());
2177
- return DBuilder.createTypedef (getOrCreateType (AliasedDbgTy), MangledName,
2178
- L.File , 0 , Scope);
2164
+ auto *TypeDef = DBuilder.createTypedef (getOrCreateType (AliasedDbgTy),
2165
+ MangledName, L.File , 0 , Scope);
2166
+ // Bound generic types don't reference their type parameters in ASTTypes
2167
+ // mode, so we need to artificially keep typealiases alive, since they can
2168
+ // appear in reflection metadata.
2169
+ if (Opts.DebugInfoLevel < IRGenDebugInfoLevel::DwarfTypes)
2170
+ DBuilder.retainType (TypeDef);
2171
+ return TypeDef;
2179
2172
}
2180
2173
2181
2174
case TypeKind::Locatable: {
@@ -2511,6 +2504,7 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2511
2504
// winning over a full definition.
2512
2505
auto *FwdDecl = DBuilder.createReplaceableCompositeType (
2513
2506
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0 , 0 ,
2507
+
2514
2508
llvm::dwarf::DW_LANG_Swift);
2515
2509
FwdDeclTypes.emplace_back (
2516
2510
std::piecewise_construct, std::make_tuple (MangledName),
0 commit comments