@@ -1283,12 +1283,16 @@ 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;
1286
1291
}
1287
1292
1288
- auto *OpaqueType =
1289
- createOpaqueStruct (Scope, Decl ? Decl->getNameStr () : " " , File, Line,
1290
- SizeInBits, AlignInBits, Flags, MangledName,
1291
- collectGenericParams (Type), UnsubstitutedType);
1293
+ auto *OpaqueType = createOpaqueStruct (
1294
+ Scope, " " , File, Line, SizeInBits, AlignInBits, Flags, MangledName,
1295
+ collectGenericParams (Type), UnsubstitutedType);
1292
1296
DBuilder.replaceTemporary (std::move (FwdDecl), OpaqueType);
1293
1297
return OpaqueType;
1294
1298
}
@@ -1975,9 +1979,18 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
1975
1979
auto L = getFileAndLocation (Decl);
1976
1980
unsigned FwdDeclLine = 0 ;
1977
1981
1978
- return createSpecializedStructOrClassType (ClassTy, Decl, Scope, L.File ,
1979
- L.Line , SizeInBits, AlignInBits,
1980
- Flags, MangledName);
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);
1981
1994
}
1982
1995
1983
1996
case TypeKind::Pack:
@@ -2161,14 +2174,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2161
2174
AliasedTy, DbgTy.getAlignment (), DbgTy.hasDefaultAlignment (),
2162
2175
/* IsMetadataType = */ false , DbgTy.isFixedBuffer (),
2163
2176
DbgTy.getNumExtraInhabitants ());
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;
2177
+ return DBuilder.createTypedef (getOrCreateType (AliasedDbgTy), MangledName,
2178
+ L.File , 0 , Scope);
2172
2179
}
2173
2180
2174
2181
case TypeKind::Locatable: {
@@ -2504,7 +2511,6 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
2504
2511
// winning over a full definition.
2505
2512
auto *FwdDecl = DBuilder.createReplaceableCompositeType (
2506
2513
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, 0 , 0 ,
2507
-
2508
2514
llvm::dwarf::DW_LANG_Swift);
2509
2515
FwdDeclTypes.emplace_back (
2510
2516
std::piecewise_construct, std::make_tuple (MangledName),
0 commit comments