From 13feed5e2096e54d199ddfd651791fd9d89ebb8e Mon Sep 17 00:00:00 2001 From: Larry Meadows Date: Mon, 9 Jun 2025 20:50:45 -0500 Subject: [PATCH 1/3] Fix C++ demangling for _BitInt type * FE expects _BitInt to be available for substitution; ensure DB is added to Subs in ItaniumDemangle.h * Add a test case to libcxxabi * Copy changed files to llvm/include/llvm/ --- libcxxabi/src/demangle/ItaniumDemangle.h | 4 +++- libcxxabi/test/DemangleTestCases.inc | 1 + llvm/include/llvm/Demangle/ItaniumDemangle.h | 4 +++- llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h index 4e7f92dd1991a..b15cf03aa1f9c 100644 --- a/libcxxabi/src/demangle/ItaniumDemangle.h +++ b/libcxxabi/src/demangle/ItaniumDemangle.h @@ -4468,7 +4468,9 @@ Node *AbstractManglingParser::parseType() { return nullptr; if (!consumeIf('_')) return nullptr; - return make(Size, Signed); + // The FE expects this to be available for Substitution + Result = make(Size, Signed); + break; } // ::= Di # char32_t case 'i': diff --git a/libcxxabi/test/DemangleTestCases.inc b/libcxxabi/test/DemangleTestCases.inc index 1e3f7459deaa2..2721d2aa5504e 100644 --- a/libcxxabi/test/DemangleTestCases.inc +++ b/libcxxabi/test/DemangleTestCases.inc @@ -6,6 +6,7 @@ {"_Z1fDU10_", "f(unsigned _BitInt(10))"}, {"_Z1fIfEvDUstPT__", "void f(unsigned _BitInt(sizeof (float*)))"}, {"_Z1fIiEvDBstPT__", "void f(_BitInt(sizeof (int*)))"}, +{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"}, {"_Z4testI1A1BE1Cv", "C test()"}, {"_Z4testI1A1BET0_T_S3_", "B test(A, A)"}, {"_ZN1SgtEi", "S::operator>(int)"}, diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h index f4569850b093c..38ac8473e3e97 100644 --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -4468,7 +4468,9 @@ Node *AbstractManglingParser::parseType() { return nullptr; if (!consumeIf('_')) return nullptr; - return make(Size, Signed); + // The FE expects this to be available for Substitution + Result = make(Size, Signed); + break; } // ::= Di # char32_t case 'i': diff --git a/llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc b/llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc index 1e3f7459deaa2..2721d2aa5504e 100644 --- a/llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc +++ b/llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc @@ -6,6 +6,7 @@ {"_Z1fDU10_", "f(unsigned _BitInt(10))"}, {"_Z1fIfEvDUstPT__", "void f(unsigned _BitInt(sizeof (float*)))"}, {"_Z1fIiEvDBstPT__", "void f(_BitInt(sizeof (int*)))"}, +{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"}, {"_Z4testI1A1BE1Cv", "C test()"}, {"_Z4testI1A1BET0_T_S3_", "B test(A, A)"}, {"_ZN1SgtEi", "S::operator>(int)"}, From 9f4ac961b61e26512aec9e71b5d6eb653c824292 Mon Sep 17 00:00:00 2001 From: Larry Meadows Date: Wed, 18 Jun 2025 14:20:14 -0700 Subject: [PATCH 2/3] Update ItaniumDemangle.h improve comment --- libcxxabi/src/demangle/ItaniumDemangle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h index b15cf03aa1f9c..b306b2013445c 100644 --- a/libcxxabi/src/demangle/ItaniumDemangle.h +++ b/libcxxabi/src/demangle/ItaniumDemangle.h @@ -4468,7 +4468,7 @@ Node *AbstractManglingParser::parseType() { return nullptr; if (!consumeIf('_')) return nullptr; - // The FE expects this to be available for Substitution + // The front end expects this to be available for Substitution Result = make(Size, Signed); break; } From defd09d3cf9b44449901f18d0b1a3e39151132e4 Mon Sep 17 00:00:00 2001 From: Larry Meadows Date: Wed, 18 Jun 2025 14:25:02 -0700 Subject: [PATCH 3/3] Update ItaniumDemangle.h Improve comment --- llvm/include/llvm/Demangle/ItaniumDemangle.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h index 38ac8473e3e97..5533652736dc8 100644 --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -4468,7 +4468,7 @@ Node *AbstractManglingParser::parseType() { return nullptr; if (!consumeIf('_')) return nullptr; - // The FE expects this to be available for Substitution + // The front end expects this to be available for Substitution Result = make(Size, Signed); break; }