[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / alias-unused-win.cpp
blob97d57a3bbd1e3106bb36a074d401ac12ba9dd1da
1 // RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -x c -verify %s
2 // RUN: %clang_cc1 -triple %ms_abi_triple -Wunused -verify=expected,cxx %s
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 static int f(void) { return 42; } // cxx-warning{{unused function 'f'}}
8 int g(void) __attribute__((alias("f")));
10 static int foo [] = { 42, 0xDEAD };
11 extern typeof(foo) bar __attribute__((unused, alias("foo")));
13 static int __attribute__((overloadable)) f0(int x) { return x; } // expected-warning{{unused function 'f0'}}
14 static float __attribute__((overloadable)) f0(float x) { return x; } // expected-warning{{unused function 'f0'}}
15 int g0(void) __attribute__((alias("?f0@@YAHH@Z")));
17 #ifdef __cplusplus
18 /// https://github.com/llvm/llvm-project/issues/88593
19 /// We report a warning in C++ mode because the internal linkage `resolver` gets
20 /// mangled as it does not have a language linkage. GCC does not mangle
21 /// `resolver` or report a warning.
22 static int f1() { return 42; } // cxx-warning{{unused function 'f1'}}
23 int g1(void) __attribute__((alias("?f1@@YAHXZ")));
26 namespace ns {
27 static int f3(int) { return 42; } // cxx-warning{{unused function 'f3'}}
28 static int f3() { return 42; } // cxx-warning{{unused function 'f3'}}
29 int g3() __attribute__((alias("?f3@ns@@YAHXZ")));
31 #endif