Skip to content

Commit b720735

Browse files
committed
IRGen: Don't ask for stored properties of resilient types in debug info emission
1 parent 4a63007 commit b720735

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,22 +1190,24 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
11901190
Name);
11911191
// Collect the members.
11921192
SmallVector<MemberDIType, 16> MemberTypes;
1193-
for (VarDecl *VD : Decl->getStoredProperties()) {
1194-
auto memberTy = Type->getTypeOfMember(VD);
1195-
if (auto DbgTy = CompletedDebugTypeInfo::getFromTypeInfo(
1196-
memberTy,
1197-
IGM.getTypeInfoForUnlowered(
1198-
IGM.getSILTypes().getAbstractionPattern(VD), memberTy),
1199-
IGM))
1200-
MemberTypes.emplace_back(VD->getName().str(),
1201-
getByteSize() *
1202-
DbgTy->getAlignment().getValue(),
1203-
getOrCreateType(*DbgTy));
1204-
else
1205-
// Without complete type info we can only create a forward decl.
1206-
return DBuilder.createForwardDecl(
1207-
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
1208-
llvm::dwarf::DW_LANG_Swift, SizeInBits, 0);
1193+
if (!IGM.isResilient(Decl, ResilienceExpansion::Maximal)) {
1194+
for (VarDecl *VD : Decl->getStoredProperties()) {
1195+
auto memberTy = Type->getTypeOfMember(VD);
1196+
if (auto DbgTy = CompletedDebugTypeInfo::getFromTypeInfo(
1197+
memberTy,
1198+
IGM.getTypeInfoForUnlowered(
1199+
IGM.getSILTypes().getAbstractionPattern(VD), memberTy),
1200+
IGM))
1201+
MemberTypes.emplace_back(VD->getName().str(),
1202+
getByteSize() *
1203+
DbgTy->getAlignment().getValue(),
1204+
getOrCreateType(*DbgTy));
1205+
else
1206+
// Without complete type info we can only create a forward decl.
1207+
return DBuilder.createForwardDecl(
1208+
llvm::dwarf::DW_TAG_structure_type, MangledName, Scope, File, Line,
1209+
llvm::dwarf::DW_LANG_Swift, SizeInBits, 0);
1210+
}
12091211
}
12101212

12111213
SmallVector<llvm::Metadata *, 16> Members;
@@ -1245,17 +1247,21 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12451247
UniqueID, Name);
12461248
// Collect the members.
12471249
SmallVector<MemberDIType, 16> MemberTypes;
1248-
for (VarDecl *VD : Decl->getStoredProperties()) {
1249-
Type memberTy = UnsubstitutedType->getTypeOfMember(VD);
1250-
auto DbgTy = DebugTypeInfo::getFromTypeInfo(
1251-
memberTy,
1252-
IGM.getTypeInfoForUnlowered(
1253-
IGM.getSILTypes().getAbstractionPattern(VD), memberTy),
1254-
IGM);
1255-
MemberTypes.emplace_back(VD->getName().str(),
1256-
getByteSize() * DbgTy.getAlignment().getValue(),
1257-
getOrCreateType(DbgTy));
1250+
1251+
if (!IGM.isResilient(Decl, ResilienceExpansion::Maximal)) {
1252+
for (VarDecl *VD : Decl->getStoredProperties()) {
1253+
Type memberTy = UnsubstitutedType->getTypeOfMember(VD);
1254+
auto DbgTy = DebugTypeInfo::getFromTypeInfo(
1255+
memberTy,
1256+
IGM.getTypeInfoForUnlowered(
1257+
IGM.getSILTypes().getAbstractionPattern(VD), memberTy),
1258+
IGM);
1259+
MemberTypes.emplace_back(VD->getName().str(),
1260+
getByteSize() * DbgTy.getAlignment().getValue(),
1261+
getOrCreateType(DbgTy));
1262+
}
12581263
}
1264+
12591265
SmallVector<llvm::Metadata *, 16> Members;
12601266
for (auto &Member : MemberTypes) {
12611267
unsigned OffsetInBits = 0;

0 commit comments

Comments
 (0)