[clang] [Sema] Mark alias/ifunc targets used and consider mangled names (PR #87130)

Nick Desaulniers via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 09:45:52 PDT 2024


================
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -triple %itanium_abi_triple -Wunused -x c -verify %s
+// RUN: %clang_cc1 -triple %itanium_abi_triple -Wunused -x c++ -verify=expected,cxx %s
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+static int f(void) { return 42; }
+int g(void) __attribute__((alias("f")));
----------------
nickdesaulniers wrote:

This seems wrong to me, a false negative.

FWICT, for C++ mode, even in an `extern "C"` block, it seems that functions with static linkage get mangled.  Or...  Oh, look, more behavioral differences from GCC: https://godbolt.org/z/sa4e7aYqj

We mangle, they do not.  That's going to lead to further compatibility issues when trying to use this function attribute.

---

Ah! right you pointed this out in your note.  Perhaps we should fix/change that first in clang?

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


More information about the cfe-commits mailing list