Skip to content

Commit 01c752e

Browse files
committed
[DebugInfo] Use LLVM type size instead of an estimate for types
1 parent 35e346f commit 01c752e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,9 +1688,8 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
16881688
// to emit the (target!) size of the underlying basic type.
16891689
uint64_t SizeOfByte = CI.getTargetInfo().getCharWidth();
16901690
// FIXME: SizeInBits is redundant with DbgTy, remove it.
1691-
uint64_t SizeInBits = 0;
1692-
if (DbgTy.getTypeSizeInBits())
1693-
SizeInBits = *DbgTy.getTypeSizeInBits();
1691+
auto *llvmty = IGM.getStorageTypeForUnlowered(DbgTy.getType());
1692+
uint64_t SizeInBits = llvmty->isSized() ? IGM.DataLayout.getTypeSizeInBits(llvmty) : 0;
16941693
unsigned AlignInBits = DbgTy.hasDefaultAlignment()
16951694
? 0
16961695
: DbgTy.getAlignment().getValue() * SizeOfByte;

0 commit comments

Comments
 (0)