diff options
author | Tanya Lattner <tonic@nondot.org> | 2009-09-08 23:42:43 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2009-09-08 23:42:43 +0000 |
commit | a86f128b33ceba291810868753540244f532fa4b (patch) | |
tree | 6450fa863b66e35c1d0ebf1828f72db41ee395df /test | |
parent | 77d91743a56850cd32585b9b55f4c875970f942e (diff) |
Merge 81238 from mainline.
convert this to filecheck, hopefully it will fix PR4888. If nothing
else it will make tests run faster and make 4888 easier to diagnose.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_26@81286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/pragma-weak.c | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/test/CodeGen/pragma-weak.c b/test/CodeGen/pragma-weak.c index aee7fba122..497039a8f4 100644 --- a/test/CodeGen/pragma-weak.c +++ b/test/CodeGen/pragma-weak.c @@ -1,37 +1,53 @@ -// RUN: clang-cc -emit-llvm -o %t %s && +// RUN: clang-cc -emit-llvm %s -o - -verify | FileCheck %s + +// CHECK: @weakvar = weak global +// CHECK: @__weakvar_alias = common global +// CHECK: @correct_linkage = weak global + + +// CHECK: @both = alias void ()* @__both +// CHECK: @both2 = alias void ()* @__both2 +// CHECK: @both3 = alias weak void ()* @__both3 +// CHECK: @a3 = alias weak void ()* @__a3 +// CHECK: @weakvar_alias = alias weak i32* @__weakvar_alias +// CHECK: @foo = alias weak void ()* @__foo +// CHECK: @foo2 = alias weak void ()* @__foo2 +// CHECK: @stutter = alias weak void ()* @__stutter +// CHECK: @stutter2 = alias weak void ()* @__stutter2 +// CHECK: @declfirst = alias weak void ()* @__declfirst +// CHECK: @declfirstattr = alias weak void ()* @__declfirstattr +// CHECK: @mix2 = alias weak void ()* @__mix2 +// CHECK: @a1 = alias weak void ()* @__a1 +// CHECK: @xxx = alias weak void ()* @__xxx + + + +// CHECK: define weak void @weakdef() + #pragma weak weakvar int weakvar; -// RUN: grep '@weakvar = weak global' %t | count 1 && #pragma weak weakdef void weakdef(void) {} -// RUN: grep 'define weak void @weakdef()' %t | count 1 && #pragma weak param // expected-warning {{weak identifier 'param' never declared}} #pragma weak correct_linkage void f(int param) { int correct_linkage; } -int correct_linkage; -// RUN: grep '@correct_linkage = weak global' %t | count 1 && #pragma weak weakvar_alias = __weakvar_alias int __weakvar_alias; -// RUN: grep '@__weakvar_alias = common global' %t | count 1 && -// RUN: grep '@weakvar_alias = alias weak i32\* @__weakvar_alias' %t | count 1 && -//@weakvar_alias = alias weak i32* @__weakvar_alias #pragma weak foo = __foo void __foo(void) {} -// RUN: grep '@foo = alias weak void ()\* @__foo\>' %t | count 1 && -// RUN: grep 'define void @__foo()' %t | count 1 && +// CHECK: define void @__foo() void __foo2(void) {} #pragma weak foo2 = __foo2 -// RUN: grep '@foo2 = alias weak void ()\* @__foo2\>' %t | count 1 && -// RUN: grep 'define void @__foo2()' %t | count 1 && +// CHECK: define void @__foo2() ///// test errors @@ -53,14 +69,12 @@ typedef int __td2; #pragma weak stutter = __stutter #pragma weak stutter = __stutter void __stutter(void) {} -// RUN: grep '@stutter = alias weak void ()\* @__stutter\>' %t | count 1 && -// RUN: grep 'define void @__stutter()' %t | count 1 && +// CHECK: define void @__stutter() void __stutter2(void) {} #pragma weak stutter2 = __stutter2 #pragma weak stutter2 = __stutter2 -// RUN: grep '@stutter2 = alias weak void ()\* @__stutter2\>' %t | count 1 && -// RUN: grep 'define void @__stutter2()' %t | count 1 && +// CHECK: define void @__stutter2() // test decl/pragma weak order @@ -68,14 +82,12 @@ void __stutter2(void) {} void __declfirst(void); #pragma weak declfirst = __declfirst void __declfirst(void) {} -// RUN: grep '@declfirst = alias weak void ()\* @__declfirst\>' %t | count 1 && -// RUN: grep 'define void @__declfirst()' %t | count 1 && +// CHECK: define void @__declfirst() void __declfirstattr(void) __attribute((noinline)); #pragma weak declfirstattr = __declfirstattr void __declfirstattr(void) {} -// RUN: grep '@declfirstattr = alias weak void ()\* @__declfirstattr\>' %t | count 1 && -// RUN: grep 'define void @__declfirstattr()' %t | count 1 && +// CHECK: define void @__declfirstattr() //// test that other attributes are preserved @@ -84,7 +96,7 @@ void __declfirstattr(void) {} void mix(void); #pragma weak mix __attribute((weak)) void mix(void) { } -// RUN: grep 'define weak void @mix()' %t | count 1 && +// CHECK: define weak void @mix() // ensure following __attributes are preserved and that only a single // alias is generated @@ -92,8 +104,7 @@ __attribute((weak)) void mix(void) { } void __mix2(void) __attribute((noinline)); void __mix2(void) __attribute((noinline)); void __mix2(void) {} -// RUN: grep '@mix2 = alias weak void ()\* @__mix2\>' %t | count 1 && -// RUN: grep 'define void @__mix2()' %t | count 1 && +// CHECK: define void @__mix2() ////////////// test #pragma weak/__attribute combinations @@ -102,8 +113,7 @@ void __mix2(void) {} void both(void) __attribute((alias("__both"))); #pragma weak both = __both void __both(void) {} -// RUN: grep '@both = alias void ()\* @__both\>' %t | count 1 && -// RUN: grep 'define void @__both()' %t | count 1 && +// CHECK: define void @__both() // if the TARGET is previously declared then whichever aliasing method // comes first applies and subsequent aliases are discarded. @@ -113,23 +123,20 @@ void __both2(void); void both2(void) __attribute((alias("__both2"))); // first, wins #pragma weak both2 = __both2 void __both2(void) {} -// RUN: grep '@both2 = alias void ()\* @__both2\>' %t | count 1 && -// RUN: grep 'define void @__both2()' %t | count 1 && +// CHECK: define void @__both2() void __both3(void); #pragma weak both3 = __both3 // first, wins void both3(void) __attribute((alias("__both3"))); void __both3(void) {} -// RUN: grep '@both3 = alias weak void ()\* @__both3\>' %t | count 1 && -// RUN: grep 'define void @__both3()' %t | count 1 && +// CHECK: define void @__both3() ///////////// ensure that #pragma weak does not alter existing __attributes() void __a1(void) __attribute((noinline)); #pragma weak a1 = __a1 void __a1(void) {} -// RUN: grep '@a1 = alias weak void ()\* @__a1\>' %t | count 1 && -// RUN: grep 'define void @__a1()' %t | count 1 && +// CHECK: define void @__a1() // attributes introduced BEFORE a combination of #pragma weak and alias() // hold... @@ -137,13 +144,11 @@ void __a3(void) __attribute((noinline)); #pragma weak a3 = __a3 void a3(void) __attribute((alias("__a3"))); void __a3(void) {} -// RUN: grep '@a3 = alias weak void ()\* @__a3\>' %t | count 1 && -// RUN: grep 'define void @__a3()' %t | count 1 && +// CHECK: define void @__a3() #pragma weak xxx = __xxx __attribute((pure,noinline,const,fastcall)) void __xxx(void) { } -// RUN: grep '@xxx = alias weak void ()\* @__xxx\>' %t | count 1 && -// RUN: grep 'define .*fastcall.* void @__xxx()' %t | count 1 && +// CHECK: void @__xxx() /// TODO: stuff that still doesn't work @@ -155,4 +160,6 @@ void yyy(void){} void zzz(void){} #pragma weak yyy // NOTE: weak doesn't apply, not before or in same TopLevelDec(!) -// RUN: grep 'define void @yyy()' %t | count 1 +// CHECK: define void @yyy() + +int correct_linkage; |