Skip to content

Commit 2c0d37b

Browse files
OCHyamsMichael137
authored andcommitted
[DebugInfo] Add bit size to _BitInt name in debug info (llvm#165583)
Follow on from llvm#164372 This changes the DW_AT_name for `_BitInt(N)` from `_BitInt` to `_BitInt(N)` (cherry picked from commit 30579c0)
1 parent 0362f75 commit 2c0d37b

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
@@ -1146,7 +1146,10 @@ llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {
11461146
}
11471147

11481148
llvm::DIType *CGDebugInfo::CreateType(const BitIntType *Ty) {
1149-
StringRef Name = Ty->isUnsigned() ? "unsigned _BitInt" : "_BitInt";
1149+
SmallString<32> Name;
1150+
llvm::raw_svector_ostream OS(Name);
1151+
OS << (Ty->isUnsigned() ? "unsigned _BitInt(" : "_BitInt(")
1152+
<< Ty->getNumBits() << ")";
11501153
llvm::dwarf::TypeKind Encoding = Ty->isUnsigned()
11511154
? llvm::dwarf::DW_ATE_unsigned
11521155
: llvm::dwarf::DW_ATE_signed;

clang/test/CodeGen/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)