Skip to content

Commit dba926b

Browse files
committed
Debug info: Fix the storage size of zero-size types.
This removes an obsolete workaround that prevented zero-sized types from being emitted with the correct byte size.
1 parent ff83942 commit dba926b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,12 +1260,6 @@ llvm::DIType *IRGenDebugInfo::createType(DebugTypeInfo DbgTy,
12601260
// to emit the (target!) size of the underlying basic type.
12611261
uint64_t SizeOfByte = CI.getTargetInfo().getCharWidth();
12621262
uint64_t SizeInBits = DbgTy.size.getValue() * SizeOfByte;
1263-
// Prefer the actual storage size over the DbgTy.
1264-
if (DbgTy.StorageType && DbgTy.StorageType->isSized()) {
1265-
uint64_t Storage = IGM.DataLayout.getTypeSizeInBits(DbgTy.StorageType);
1266-
if (Storage)
1267-
SizeInBits = Storage;
1268-
}
12691263
uint64_t AlignInBits = DbgTy.align.getValue() * SizeOfByte;
12701264
unsigned Encoding = 0;
12711265
unsigned Flags = 0;

test/DebugInfo/nostorage.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ public class Foo {
1010
// CHECK1: call void @llvm.dbg.value(metadata i{{.*}} 0,
1111
// CHECK1-SAME: metadata ![[TYPE:.*]], metadata
1212
// CHECK1: ![[TYPE]] = !DILocalVariable(name: "type",
13-
// CHECK1-SAME: line: [[@LINE+1]],
13+
// CHECK1-SAME: line: [[@LINE+4]],
14+
// CHECK1-SAME: type: ![[FOO:[0-9]+]]
15+
// CHECK1: ![[FOO]] = !DICompositeType(tag: DW_TAG_structure_type,
16+
// CHECK1-SAME: line: [[@LINE+1]], align: 8, flags:
1417
let type = self.dynamicType
1518
used(type)
1619
}()

0 commit comments

Comments
 (0)