Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / alias.cpp
bloba468c31d369ed02bf9d8108bf5cf44b726245d0a
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
5 #ifdef ERR
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?")))
26 void func();
27 // expected-error@-2 {{alias must point to a defined variable or function}}
28 // expected-note@-3 {{must refer to its mangled name}}
29 #endif
31 // CHECK: @_ZN4libc4log2Ed ={{.*}} alias double (double), ptr @log2
32 // CHECK: define{{.*}} @log2(
33 namespace libc { double log2(double x); }
34 extern "C" double log2(double);
35 namespace std { using ::log2; }
36 using std::log2;
38 namespace libc {
39 decltype(libc::log2) __log2_impl__ __asm__("log2");
40 decltype(libc::log2) log2 [[gnu::alias("log2")]];
41 double __log2_impl__(double x) { return x; }