[clang] [Clang] Emit error for duplicate mangled names within a lambda (PR #107581)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 16 06:09:58 PDT 2024


================
@@ -0,0 +1,31 @@
+// REQUIRES: aarch64-registered-target
+
+// RUN: %clang_cc1 -triple aarch64 -emit-llvm -o - %s -verify -DTEST1
+// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -target-feature +sme2 -emit-llvm -o - %s -verify -DTEST2
----------------
sdesmalen-arm wrote:

Can you now change the filename, since it's now wider scope than just the SME attributes. Maybe `lambda-instantiation-require-different-mangled-names.cpp` or something?

The same issue exists for more generic ways to specify the calling convention, e.g. `__attribute__((preserve_none))`, which also affects other targets. For these, the compiler could select the worst-case calling convention for its instantiation (i.e. assume everything is clobbered), rather than emitting a diagnostic. But that would require explicit logic to select the right calling convention, which is out of scope of this PR.

nit: rather than using ifdef's, I'd recommend using the `split-file` tool instead (it does mean duplicating the `normal_fn` declaration)

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


More information about the cfe-commits mailing list