Skip to content

Commit 20f56d1

Browse files
authored
[libc++abi] Fix C++ demangling for _BitInt type (llvm#143466)
The front-end expects _BitInt to be available for substitution; ensure DB<n> is added to Subs in ItaniumDemangle.h. Also add a test case to libc++abi and sync the files to llvm/include/llvm.
1 parent c873e5f commit 20f56d1

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

libcxxabi/src/demangle/ItaniumDemangle.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4468,7 +4468,9 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
44684468
return nullptr;
44694469
if (!consumeIf('_'))
44704470
return nullptr;
4471-
return make<BitIntType>(Size, Signed);
4471+
// The front end expects this to be available for Substitution
4472+
Result = make<BitIntType>(Size, Signed);
4473+
break;
44724474
}
44734475
// ::= Di # char32_t
44744476
case 'i':

libcxxabi/test/DemangleTestCases.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{"_Z1fDU10_", "f(unsigned _BitInt(10))"},
77
{"_Z1fIfEvDUstPT__", "void f<float>(unsigned _BitInt(sizeof (float*)))"},
88
{"_Z1fIiEvDBstPT__", "void f<int>(_BitInt(sizeof (int*)))"},
9+
{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"},
910
{"_Z4testI1A1BE1Cv", "C test<A, B>()"},
1011
{"_Z4testI1A1BET0_T_S3_", "B test<A, B>(A, A)"},
1112
{"_ZN1SgtEi", "S::operator>(int)"},

llvm/include/llvm/Demangle/ItaniumDemangle.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4468,7 +4468,9 @@ Node *AbstractManglingParser<Derived, Alloc>::parseType() {
44684468
return nullptr;
44694469
if (!consumeIf('_'))
44704470
return nullptr;
4471-
return make<BitIntType>(Size, Signed);
4471+
// The front end expects this to be available for Substitution
4472+
Result = make<BitIntType>(Size, Signed);
4473+
break;
44724474
}
44734475
// ::= Di # char32_t
44744476
case 'i':

llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{"_Z1fDU10_", "f(unsigned _BitInt(10))"},
77
{"_Z1fIfEvDUstPT__", "void f<float>(unsigned _BitInt(sizeof (float*)))"},
88
{"_Z1fIiEvDBstPT__", "void f<int>(_BitInt(sizeof (int*)))"},
9+
{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"},
910
{"_Z4testI1A1BE1Cv", "C test<A, B>()"},
1011
{"_Z4testI1A1BET0_T_S3_", "B test<A, B>(A, A)"},
1112
{"_ZN1SgtEi", "S::operator>(int)"},

0 commit comments

Comments
 (0)