Skip to content

Commit 30579c0

Browse files
authored
[DebugInfo] Add bit size to _BitInt name in debug info (#165583)
Follow on from #164372 This changes the DW_AT_name for `_BitInt(N)` from `_BitInt` to `_BitInt(N)`
1 parent 31890c5 commit 30579c0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,10 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
11741174
}
11751175

11761176
llvm::DIType *CGDebugInfo::CreateType(const BitIntType *Ty) {
1177-
StringRef Name = Ty->isUnsigned() ? "unsigned _BitInt" : "_BitInt";
1177+
SmallString<32> Name;
1178+
llvm::raw_svector_ostream OS(Name);
1179+
OS << (Ty->isUnsigned() ? "unsigned _BitInt(" : "_BitInt(")
1180+
<< Ty->getNumBits() << ")";
11781181
llvm::dwarf::TypeKind Encoding = Ty->isUnsigned()
11791182
? llvm::dwarf::DW_ATE_unsigned
11801183
: llvm::dwarf::DW_ATE_signed;

clang/test/DebugInfo/Generic/bit-int.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
unsigned _BitInt(17) a;
55
_BitInt(2) b;
66

7-
// CHECK: !DIBasicType(name: "_BitInt", size: 8, dataSize: 2, encoding: DW_ATE_signed)
8-
// CHECK: !DIBasicType(name: "unsigned _BitInt", size: 32, dataSize: 17, encoding: DW_ATE_unsigned)
7+
// CHECK: !DIBasicType(name: "_BitInt(2)", size: 8, dataSize: 2, encoding: DW_ATE_signed)
8+
// CHECK: !DIBasicType(name: "unsigned _BitInt(17)", size: 32, dataSize: 17, encoding: DW_ATE_unsigned)

0 commit comments

Comments
 (0)