[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:53 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")));
+
+static int foo [] = { 42, 0xDEAD }; // cxx-warning{{variable 'foo' is not needed and will not be emitted}}
----------------
nickdesaulniers wrote:

Why should we warn here? Is it because `bar` is itself unused, or because its `alias` isn't mangled?

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


More information about the cfe-commits mailing list