Skip to content

Commit 485a2df

Browse files
committed
[clang][DebugInfo] Mark _BitInt's as reconstitutable when emitting -gsimple-template-names
Depends on: * #168382 As of recent, LLVM includes the bit-size as a `DW_AT_bit_size` (and as part of `DW_AT_name`) of `_BitInt`s in DWARF. This allows us to mark `_BitInt`s as "reconstitutable" when compiling with `-gsimple-template-names`. We still only omits template parameters that are `<= 64` bit wide. So support `_BitInt`s larger than 64 bits is not part of this patch.
1 parent 9b33d9a commit 485a2df

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5863,15 +5863,6 @@ struct ReconstitutableType : public RecursiveASTVisitor<ReconstitutableType> {
58635863
Reconstitutable = false;
58645864
return false;
58655865
}
5866-
bool VisitType(Type *T) {
5867-
// _BitInt(N) isn't reconstitutable because the bit width isn't encoded in
5868-
// the DWARF, only the byte width.
5869-
if (T->isBitIntType()) {
5870-
Reconstitutable = false;
5871-
return false;
5872-
}
5873-
return true;
5874-
}
58755866
bool TraverseEnumType(EnumType *ET, bool = false) {
58765867
// Unnamed enums can't be reconstituted due to a lack of column info we
58775868
// produce in the DWARF, so we can't get Clang's full name back.

clang/test/DebugInfo/CXX/simple-template-names.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,28 @@ void f() {
114114

115115
f3<t1>();
116116
// CHECK: !DISubprogram(name: "_STN|f3|<t1>",
117-
117+
118118
f1<_BitInt(3)>();
119-
// CHECK: !DISubprogram(name: "f1<_BitInt(3)>",
119+
// CHECK: !DISubprogram(name: "_STN|f1|<_BitInt(3)>",
120120

121121
f1<const unsigned _BitInt(5)>();
122-
// CHECK: !DISubprogram(name: "f1<const unsigned _BitInt(5)>",
122+
// CHECK: !DISubprogram(name: "_STN|f1|<const unsigned _BitInt(5)>",
123+
124+
f1<_BitInt(120)>();
125+
// CHECK: !DISubprogram(name: "_STN|f1|<_BitInt(120)>",
126+
127+
f1<const unsigned _BitInt(120)>();
128+
// CHECK: !DISubprogram(name: "_STN|f1|<const unsigned _BitInt(120)>",
129+
130+
f2<_BitInt(2), 1>();
131+
// CHECK: !DISubprogram(name: "_STN|f2|<_BitInt(2), (_BitInt(2))1>",
132+
133+
f2<_BitInt(64), 12>();
134+
// CHECK: !DISubprogram(name: "_STN|f2|<_BitInt(64), (_BitInt(64))12>",
135+
136+
// FIXME: make block forms reconstitutable
137+
f2<_BitInt(65), 1>();
138+
// CHECK: !DISubprogram(name: "f2<_BitInt(65), (_BitInt(65))1>",
123139

124140
// Add a parameter just so this differs from other attributed function types
125141
// that don't mangle differently.

0 commit comments

Comments
 (0)