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

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 10:48:45 PDT 2024


================
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -x c -verify %s
+// RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -verify=expected,cxx %s
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+static int f(void) { return 42; } // cxx-warning{{unused function 'f'}}
+int g(void) __attribute__((alias("f")));
+
+static int foo [] = { 42, 0xDEAD };
+extern typeof(foo) bar __attribute__((unused, alias("foo")));
+
+static int __attribute__((overloadable)) f0(int x) { return x; } // expected-warning{{unused function 'f0'}}
+static float __attribute__((overloadable)) f0(float x) { return x; } // expected-warning{{unused function 'f0'}}
+int g0(void) __attribute__((alias("?f0@@YAHH at Z")));
----------------
MaskRay wrote:

> I'm guessing this test file is demonstrating the lack of msabi mangling support? And will function as a change detector in the future?

Yes, a change detector. The test shall be pre-committed once good enough.

llvm-cxxfilt seems Itanium only.... I compiled the file locally and used `llvm-objdump -t a.o` to get the symbol name.

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


More information about the cfe-commits mailing list