[llvm] [LLVM Demangler] Set `InConstraintExpr` to `true` when demangling a c… (PR #107385)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 00:43:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: None (VitaNuo)

<details>
<summary>Changes</summary>

…onstraint expression.

This prevents demangler failures until the TODO in the [demangler](https://github.com/llvm/llvm-project/blob/3e070906eff720dc44aee86e533e12aafc8bb14b/llvm/include/llvm/Demangle/ItaniumDemangle.h#L5678) is implemented.

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


2 Files Affected:

- (modified) llvm/include/llvm/Demangle/ItaniumDemangle.h (+1) 
- (added) llvm/test/tools/llvm-cxxfilt/demangle-constrained-template.test (+3) 


``````````diff
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index fb2060fa07f724..5c044def74e881 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -5737,6 +5737,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseTemplateParamDecl(
   }
 
   if (consumeIf("Tk")) {
+    ScopedOverride<bool> SaveInConstraintExpr(InConstraintExpr, true);
     Node *Constraint = getDerived().parseName();
     if (!Constraint)
       return nullptr;
diff --git a/llvm/test/tools/llvm-cxxfilt/demangle-constrained-template.test b/llvm/test/tools/llvm-cxxfilt/demangle-constrained-template.test
new file mode 100644
index 00000000000000..7a038ebb77a06d
--- /dev/null
+++ b/llvm/test/tools/llvm-cxxfilt/demangle-constrained-template.test
@@ -0,0 +1,3 @@
+RUN: llvm-cxxfilt -n _ZN3FooIiE6methodITk4TrueIT_EiEEvS3_ | FileCheck %s
+
+CHECK: void Foo<int>::method<int>(T)
\ No newline at end of file

``````````

</details>


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


More information about the llvm-commits mailing list