Skip to content

Commit 3567b9f

Browse files
committed
Refactor getSizeOfBasicType to take CompletedDebugTypeInfo (NFC)
(cherry picked from commit a5533fc)
1 parent 06ffd8e commit 3567b9f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,12 +1021,11 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
10211021
return getOrCreateType(BlandDbgTy);
10221022
}
10231023

1024-
uint64_t getSizeOfBasicType(DebugTypeInfo DbgTy) {
1024+
uint64_t getSizeOfBasicType(CompletedDebugTypeInfo DbgTy) {
10251025
uint64_t SizeOfByte = CI.getTargetInfo().getCharWidth();
10261026
uint64_t BitWidth = 0;
1027-
assert(DbgTy.getSize() && "non-fixed basic type");
10281027
if (DbgTy.getSize())
1029-
BitWidth = DbgTy.getSize()->getValue() * SizeOfByte;
1028+
BitWidth = DbgTy.getSizeValue() * SizeOfByte;
10301029
llvm::Type *StorageType = DbgTy.getStorageType()
10311030
? DbgTy.getStorageType()
10321031
: IGM.DataLayout.getSmallestLegalIntType(
@@ -1288,13 +1287,15 @@ class IRGenDebugInfoImpl : public IRGenDebugInfo {
12881287
switch (BaseTy->getKind()) {
12891288
case TypeKind::BuiltinInteger: {
12901289
Encoding = llvm::dwarf::DW_ATE_unsigned;
1291-
SizeInBits = getSizeOfBasicType(DbgTy);
1290+
if (auto CompletedDbgTy = CompletedDebugTypeInfo::get(DbgTy))
1291+
SizeInBits = getSizeOfBasicType(*CompletedDbgTy);
12921292
break;
12931293
}
12941294

12951295
case TypeKind::BuiltinIntegerLiteral: {
12961296
Encoding = llvm::dwarf::DW_ATE_unsigned; // ?
1297-
SizeInBits = getSizeOfBasicType(DbgTy);
1297+
if (auto CompletedDbgTy = CompletedDebugTypeInfo::get(DbgTy))
1298+
SizeInBits = getSizeOfBasicType(*CompletedDbgTy);
12981299
break;
12991300
}
13001301

0 commit comments

Comments
 (0)