[libcxx-commits] [libcxxabi] [llvm] Fix C++ demangling for _BitInt type (PR #143466)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 9 19:08:33 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxxabi

Author: Larry Meadows (lfmeadow)

<details>
<summary>Changes</summary>

    * FE expects _BitInt to be available for substitution; ensure DB<n> is added to Subs in ItaniumDemangle.h
    * Add a test case to libcxxabi
    * Copy changed files to llvm/include/llvm/

---
Full diff: https://github.com/llvm/llvm-project/pull/143466.diff


4 Files Affected:

- (modified) libcxxabi/src/demangle/ItaniumDemangle.h (+3-1) 
- (modified) libcxxabi/test/DemangleTestCases.inc (+1) 
- (modified) llvm/include/llvm/Demangle/ItaniumDemangle.h (+3-1) 
- (modified) llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc (+1) 


``````````diff
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<Derived, Alloc>::parseType() {
         return nullptr;
       if (!consumeIf('_'))
         return nullptr;
-      return make<BitIntType>(Size, Signed);
+      // The FE expects this to be available for Substitution
+      Result = make<BitIntType>(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<float>(unsigned _BitInt(sizeof (float*)))"},
 {"_Z1fIiEvDBstPT__", "void f<int>(_BitInt(sizeof (int*)))"},
+{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"},
 {"_Z4testI1A1BE1Cv", "C test<A, B>()"},
 {"_Z4testI1A1BET0_T_S3_", "B test<A, B>(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<Derived, Alloc>::parseType() {
         return nullptr;
       if (!consumeIf('_'))
         return nullptr;
-      return make<BitIntType>(Size, Signed);
+      // The FE expects this to be available for Substitution
+      Result = make<BitIntType>(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<float>(unsigned _BitInt(sizeof (float*)))"},
 {"_Z1fIiEvDBstPT__", "void f<int>(_BitInt(sizeof (int*)))"},
+{"_Z6myfuncRDB8_S0_", "myfunc(_BitInt(8)&, _BitInt(8)&)"},
 {"_Z4testI1A1BE1Cv", "C test<A, B>()"},
 {"_Z4testI1A1BET0_T_S3_", "B test<A, B>(A, A)"},
 {"_ZN1SgtEi", "S::operator>(int)"},

``````````

</details>


https://github.com/llvm/llvm-project/pull/143466


More information about the libcxx-commits mailing list