DebugInfo: Don't simplify template names using _BitInt(N)

_BitInt(N) only encodes the byte size in DWARF, not the bit size, so
can't be reconstituted.
This commit is contained in:
David Blaikie 2022-02-10 21:14:02 -08:00
parent ae76fafc3f
commit 1ea326634b
3 changed files with 17 additions and 0 deletions

View File

@ -5032,6 +5032,15 @@ struct ReconstitutableType : public RecursiveASTVisitor<ReconstitutableType> {
Reconstitutable = false;
return false;
}
bool VisitType(Type *T) {
// _BitInt(N) isn't reconstitutable because the bit width isn't encoded in
// the DWARF, only the byte width.
if (T->isBitIntType()) {
Reconstitutable = false;
return false;
}
return true;
}
bool TraverseEnumType(EnumType *ET) {
// Unnamed enums can't be reconstituted due to a lack of column info we
// produce in the DWARF, so we can't get Clang's full name back.

View File

@ -105,4 +105,10 @@ void f() {
f3<t1>();
// CHECK: !DISubprogram(name: "_STNf3|<t1>",
f1<_BitInt(3)>();
// CHECK: !DISubprogram(name: "f1<_BitInt(3)>",
f1<const unsigned _BitInt(5)>();
// CHECK: !DISubprogram(name: "f1<const unsigned _BitInt(5)>",
}

View File

@ -316,6 +316,8 @@ int main() {
f1<void(t8)>();
operator_not_really<int>();
t12 v4;
f1<_BitInt(3)>();
f1<const unsigned _BitInt(5)>();
}
void t8::mem() {
struct t7 { };