[libcxx-commits] [libcxxabi] [llvm] [ItaniumDemangle] Fix conversion operators failing to demangle types … (PR #197420)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 13 05:25:46 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxxabi
Author: Iris Shi (el-ev)
<details>
<summary>Changes</summary>
…with substitutions
Resolves #<!-- -->109130
---
Full diff: https://github.com/llvm/llvm-project/pull/197420.diff
3 Files Affected:
- (modified) libcxxabi/src/demangle/ItaniumDemangle.h (+4)
- (modified) llvm/include/llvm/Demangle/ItaniumDemangle.h (+4)
- (modified) llvm/unittests/Demangle/DemangleTest.cpp (+9)
``````````diff
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index c001a8d33f227..4137c9bbcb3b0 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -6108,6 +6108,10 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
if (!consumeIf('I'))
return nullptr;
+ // Subtypes within template args are complete, so they can always parse their
+ // own template args.
+ ScopedOverride<bool> SaveTryToParseTemplateArgs(TryToParseTemplateArgs, true);
+
// <template-params> refer to the innermost <template-args>. Clear out any
// outer args that we may have inserted into TemplateParams.
if (TagTemplates) {
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 6d7f189a6e44c..b7f844df33c50 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -6108,6 +6108,10 @@ AbstractManglingParser<Derived, Alloc>::parseTemplateArgs(bool TagTemplates) {
if (!consumeIf('I'))
return nullptr;
+ // Subtypes within template args are complete, so they can always parse their
+ // own template args.
+ ScopedOverride<bool> SaveTryToParseTemplateArgs(TryToParseTemplateArgs, true);
+
// <template-params> refer to the innermost <template-args>. Clear out any
// outer args that we may have inserted into TemplateParams.
if (TagTemplates) {
diff --git a/llvm/unittests/Demangle/DemangleTest.cpp b/llvm/unittests/Demangle/DemangleTest.cpp
index e60a75ecd76da..d3b3099bbbb1c 100644
--- a/llvm/unittests/Demangle/DemangleTest.cpp
+++ b/llvm/unittests/Demangle/DemangleTest.cpp
@@ -29,4 +29,13 @@ TEST(Demangle, demangleTest) {
// extended type qualifier (https://bugs.llvm.org/show_bug.cgi?id=48009)
EXPECT_EQ(demangle("_Z3fooILi79EEbU7_ExtIntIXT_EEi"),
"bool foo<79>(int _ExtInt<79>)");
+
+ // Conversion operators with substitutions that have template args
+ // (https://github.com/llvm/llvm-project/issues/109130)
+ EXPECT_EQ(demangle("_ZN3foocvNSt7__cxx1112basic_stringIcSt11char_"
+ "traitsIcESaIcEEEEv"),
+ "foo::operator std::__cxx11::basic_string<char, "
+ "std::char_traits<char>, std::allocator<char>>()");
+ EXPECT_EQ(demangle("_ZN1XcvSt6vectorIiSaIiEEEv"),
+ "X::operator std::vector<int, std::allocator<int>>()");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/197420
More information about the libcxx-commits
mailing list