1 // RUN: %clang_cc1 -triple x86_64-linux -verify -emit-llvm-only -DERR %s
2 // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only -fdiagnostics-parseable-fixits -DERR %s 2>&1 | FileCheck %s --check-prefix=FIXIT
3 // RUN: %clang_cc1 -triple x86_64-linux -emit-llvm %s -o - | FileCheck %s
6 void *f1_ifunc(void) { return nullptr; }
7 void f1(void) __attribute__((alias("f1_ifunc")));
8 // expected-error@-1 {{alias must point to a defined variable or function}}
9 // expected-note@-2 {{must refer to its mangled name}}
10 // expected-note@-3 {{function by that name is mangled as}}
11 // FIXIT: fix-it:"{{.*}}":{[[@LINE-4]]:30-[[@LINE-4]]:47}:"alias(\"_Z8f1_ifuncv\")"
13 void *f6_resolver_resolver(void) { return 0; }
14 void *f6_resolver(void) __attribute__((alias("f6_resolver_resolver")));
15 // expected-error@-1 {{alias must point to a defined variable or function}}
16 // expected-note@-2 {{must refer to its mangled name}}
17 // expected-note@-3 {{function by that name is mangled as}}
18 // FIXIT: fix-it:"{{.*}}":{[[@LINE-4]]:40-[[@LINE-4]]:69}:"alias(\"_Z20f6_resolver_resolverv\")"
19 void f6(void) __attribute__((alias("f6_resolver")));
20 // expected-error@-1 {{alias must point to a defined variable or function}}
21 // expected-note@-2 {{must refer to its mangled name}}
22 // expected-note@-3 {{function by that name is mangled as}}
23 // FIXIT: fix-it:"{{.*}}":{[[@LINE-4]]:30-[[@LINE-4]]:50}:"alias(\"_Z11f6_resolverv\")"
25 __attribute__((unused
, alias("resolver"), deprecated("hahahaha, isn't C great?")))
27 // expected-error@-2 {{alias must point to a defined variable or function}}
28 // expected-note@-3 {{must refer to its mangled name}}
30 void *operator new(unsigned long) __attribute__((alias("A"))); // expected-error {{alias must point to a defined variable or function}} \
31 // expected-note {{the function or variable specified in an alias must refer to its mangled name}}
34 // CHECK: @_ZN4libc4log2Ed ={{.*}} alias double (double), ptr @log2
35 // CHECK: define{{.*}} @log2(
36 namespace libc
{ double log2(double x
); }
37 extern "C" double log2(double);
38 namespace std
{ using ::log2
; }
42 decltype(libc::log2
) __log2_impl__
__asm__("log2");
43 decltype(libc::log2
) log2
[[gnu::alias("log2")]];
44 double __log2_impl__(double x
) { return x
; }