2012-10-06 07:12:53 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s
|
|
|
|
// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s
|
2009-03-19 16:27:24 +08:00
|
|
|
|
|
|
|
int g0;
|
2012-10-06 07:12:53 +08:00
|
|
|
// CHECKBASIC: @g0 = common global i32 0
|
2012-10-06 07:12:48 +08:00
|
|
|
static int bar1 = 42;
|
2012-10-06 07:12:53 +08:00
|
|
|
// CHECKBASIC: @bar1 = internal global i32 42
|
2012-10-06 07:12:48 +08:00
|
|
|
|
2009-03-19 16:27:24 +08:00
|
|
|
extern int g1;
|
|
|
|
extern int g1 __attribute((alias("g0")));
|
2013-10-15 00:18:39 +08:00
|
|
|
// CHECKBASIC-DAG: @g1 = alias i32* @g0
|
2012-10-06 07:12:48 +08:00
|
|
|
|
|
|
|
void f0(void) { }
|
|
|
|
extern void f1(void);
|
|
|
|
extern void f1(void) __attribute((alias("f0")));
|
2013-10-15 00:18:39 +08:00
|
|
|
// CHECKBASIC-DAG: @f1 = alias void ()* @f0
|
2014-07-31 06:52:16 +08:00
|
|
|
// CHECKBASIC-DAG: @test8_foo = weak alias bitcast (void ()* @test8_bar to void (...)*)
|
2014-06-03 10:42:01 +08:00
|
|
|
// CHECKBASIC-DAG: @test8_zed = alias bitcast (void ()* @test8_bar to void (...)*)
|
2014-05-06 04:21:03 +08:00
|
|
|
// CHECKBASIC-DAG: @test9_zed = alias void ()* @test9_bar
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKBASIC: define void @f0() [[NUW:#[0-9]+]] {
|
2009-03-23 05:21:57 +08:00
|
|
|
|
|
|
|
// Make sure that aliases cause referenced values to be emitted.
|
|
|
|
// PR3200
|
|
|
|
static inline int foo1() { return 0; }
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECKBASIC-LABEL: define internal i32 @foo1()
|
2009-03-23 05:21:57 +08:00
|
|
|
int foo() __attribute__((alias("foo1")));
|
|
|
|
int bar() __attribute__((alias("bar1")));
|
|
|
|
|
2009-03-23 05:39:12 +08:00
|
|
|
extern int test6();
|
|
|
|
void test7() { test6(); } // test6 is emitted as extern.
|
|
|
|
|
|
|
|
// test6 changes to alias.
|
|
|
|
int test6() __attribute__((alias("test7")));
|
|
|
|
|
2012-10-06 07:12:53 +08:00
|
|
|
static int inner(int a) { return 0; }
|
|
|
|
static int inner_weak(int a) { return 0; }
|
|
|
|
extern __typeof(inner) inner_a __attribute__((alias("inner")));
|
|
|
|
static __typeof(inner_weak) inner_weak_a __attribute__((weakref, alias("inner_weak")));
|
|
|
|
// CHECKCC: @inner_a = alias i32 (i32)* @inner
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKCC: define internal arm_aapcs_vfpcc i32 @inner(i32 %a) [[NUW:#[0-9]+]] {
|
2012-10-06 07:12:53 +08:00
|
|
|
|
|
|
|
int outer(int a) { return inner(a); }
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKCC: define arm_aapcs_vfpcc i32 @outer(i32 %a) [[NUW]] {
|
2012-10-06 07:56:20 +08:00
|
|
|
// CHECKCC: call arm_aapcs_vfpcc i32 @inner(i32 %{{.*}})
|
2012-10-06 07:12:53 +08:00
|
|
|
|
|
|
|
int outer_weak(int a) { return inner_weak_a(a); }
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKCC: define arm_aapcs_vfpcc i32 @outer_weak(i32 %a) [[NUW]] {
|
2012-10-06 07:56:20 +08:00
|
|
|
// CHECKCC: call arm_aapcs_vfpcc i32 @inner_weak(i32 %{{.*}})
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKCC: define internal arm_aapcs_vfpcc i32 @inner_weak(i32 %a) [[NUW]] {
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKBASIC: attributes [[NUW]] = { nounwind{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-27 07:08:48 +08:00
|
|
|
// CHECKCC: attributes [[NUW]] = { nounwind{{.*}} }
|
2014-03-27 23:27:20 +08:00
|
|
|
|
|
|
|
void test8_bar() {}
|
|
|
|
void test8_foo() __attribute__((weak, alias("test8_bar")));
|
|
|
|
void test8_zed() __attribute__((alias("test8_foo")));
|
2014-05-06 04:21:03 +08:00
|
|
|
|
|
|
|
void test9_bar(void) { }
|
|
|
|
void test9_zed(void) __attribute__((section("test")));
|
|
|
|
void test9_zed(void) __attribute__((alias("test9_bar")));
|