llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Corentin Jabot (cor3ntin)

<details>
<summary>Changes</summary>

We have a very confusing NNS interface:

```cpp
NestedNameSpecifier() : NestedNameSpecifier(FlagKind::Invalid) {}
NestedNameSpecifier(std::nullopt_t) : StoredOrFlag(0) {}
```

That tripped me up (and that we probably should clean up)

On top of that we were lacking mangling tests for
concept template parameters.

We could use more but the goal of the PR is to address the regression.

Fixes #<!-- -->218820

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


2 Files Affected:

- (modified) clang/lib/AST/ItaniumMangle.cpp (+1-1) 
- (added) clang/test/CodeGenCXX/mangle-concept-template-param.cpp (+28) 


``````````diff
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 2c38dbfac0cb2..3a3cde3448f44 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -5351,7 +5351,7 @@ void CXXNameMangler::mangleExpression(const Expr *E, 
unsigned Arity,
       DiagnoseUnsupportedPackIndexTemplateName();
       break;
     }
-    mangleUnresolvedName(NestedNameSpecifier(), DTI->getName(),
+    mangleUnresolvedName(/*NestedNameSpecifier=*/std::nullopt, DTI->getName(),
                          DTI->template_arguments().data(),
                          DTI->getNumTemplateArgs(), Arity);
     break;
diff --git a/clang/test/CodeGenCXX/mangle-concept-template-param.cpp 
b/clang/test/CodeGenCXX/mangle-concept-template-param.cpp
new file mode 100644
index 0000000000000..31ed49804b8e8
--- /dev/null
+++ b/clang/test/CodeGenCXX/mangle-concept-template-param.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -verify -std=c++2c -emit-llvm -triple %itanium_abi_triple 
-o - %s -fclang-abi-compat=latest | FileCheck %s
+// expected-no-diagnostics
+
+// FIXME: Is the empty case case correct? These are not defined by the itanium 
ABI yet.
+namespace GH218820 {
+// CHECK: define {{.*}}@_ZN8GH2188201fITpTtTyEJEEEvvQfraa1CIiE(
+// CHECK: define {{.*}}@_ZN8GH2188201fIJNS_1CEEEEvvQfraa1CIiE(
+template <template <typename> concept... C>
+void f() requires (C<int> && ...) {}
+
+// CHECK: define {{.*}}@_ZN8GH2188201gITpTtTyEJEEEvvQfraa1VIiE(
+// CHECK: define {{.*}}@_ZN8GH2188201gIJNS_1VEEEEvvQfraa1VIiE(
+template <template <typename> auto... V>
+void g() requires (V<int> && ...) {}
+
+template <typename T>
+concept C = true;
+
+template <typename T>
+constexpr auto V = true;
+
+void h() {
+    f<>();
+    f<C>();
+    g<>();
+    g<V>();
+}
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/219998
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to