summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-27 15:27:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-27 15:27:20 +0000
commita39fc6dd2afab9cb14286e00f2f6ef2370002c40 (patch)
treef69a30a34f74928d8628a0163d866a38de7a320e /clang/test
parent24a669d225f9cacf1cd3846e333f9690a06d1e1c (diff)
downloadbcm5719-llvm-a39fc6dd2afab9cb14286e00f2f6ef2370002c40.tar.gz
bcm5719-llvm-a39fc6dd2afab9cb14286e00f2f6ef2370002c40.zip
Handle and warn on aliases to weak aliases.
This produces valid IR now that llvm rejects aliases to weak aliases and warns the user that the resolution is not changed if the weak alias is overridden. llvm-svn: 204935
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/alias.c6
-rw-r--r--clang/test/Sema/attr-alias-elf.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGen/alias.c b/clang/test/CodeGen/alias.c
index efa94b340bb..4a89b13be95 100644
--- a/clang/test/CodeGen/alias.c
+++ b/clang/test/CodeGen/alias.c
@@ -14,6 +14,8 @@ void f0(void) { }
extern void f1(void);
extern void f1(void) __attribute((alias("f0")));
// CHECKBASIC-DAG: @f1 = alias void ()* @f0
+// CHECKBASIC-DAG: @test8_foo = alias weak bitcast (void ()* @test8_bar to void (...)*)
+// CHECKBASIC-DAG: @test8_zed = alias bitcast (void ()* @test8_bar to void (...)*)
// CHECKBASIC: define void @f0() [[NUW:#[0-9]+]] {
// Make sure that aliases cause referenced values to be emitted.
@@ -48,3 +50,7 @@ int outer_weak(int a) { return inner_weak_a(a); }
// CHECKBASIC: attributes [[NUW]] = { nounwind{{.*}} }
// CHECKCC: attributes [[NUW]] = { nounwind{{.*}} }
+
+void test8_bar() {}
+void test8_foo() __attribute__((weak, alias("test8_bar")));
+void test8_zed() __attribute__((alias("test8_foo")));
diff --git a/clang/test/Sema/attr-alias-elf.c b/clang/test/Sema/attr-alias-elf.c
index 88bd7b70958..01bc1879dc4 100644
--- a/clang/test/Sema/attr-alias-elf.c
+++ b/clang/test/Sema/attr-alias-elf.c
@@ -52,3 +52,7 @@ extern int b3;
extern int a4 __attribute__((alias("b4"))); // expected-error {{alias must point to a defined variable or function}}
typedef int b4;
+
+void test2_bar() {}
+void test2_foo() __attribute__((weak, alias("test2_bar")));
+void test2_zed() __attribute__((alias("test2_foo"))); // expected-warning {{alias will always resolve to test2_bar even if weak definition of alias test2_foo is overridden}}
OpenPOWER on IntegriCloud