diff options
author | Chris Lattner <sabre@nondot.org> | 2007-09-21 17:48:39 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-09-21 17:48:39 +0000 |
commit | 005609aedbd4bd763974168d82eaa1c5eb51d67b (patch) | |
tree | 4686fc39d444b685f5fefe87b10087decb7991ff /test/CFrontend | |
parent | 76dec10aa50c37fd6959dd01c21276ea6619e638 (diff) | |
download | external_llvm-005609aedbd4bd763974168d82eaa1c5eb51d67b.zip external_llvm-005609aedbd4bd763974168d82eaa1c5eb51d67b.tar.gz external_llvm-005609aedbd4bd763974168d82eaa1c5eb51d67b.tar.bz2 |
gcroot testcase, patch by Eric Christopher.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CFrontend')
-rw-r--r-- | test/CFrontend/2007-09-20-GcrootAttribute.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/CFrontend/2007-09-20-GcrootAttribute.c b/test/CFrontend/2007-09-20-GcrootAttribute.c new file mode 100644 index 0000000..aea9d54 --- /dev/null +++ b/test/CFrontend/2007-09-20-GcrootAttribute.c @@ -0,0 +1,28 @@ +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot | count 6 + +typedef struct foo_s +{ + int a; +} foo, __attribute__ ((gcroot)) *foo_p; + +foo my_foo; + +int alpha () +{ + foo my_foo2 = my_foo; + + return my_foo2.a; +} + +int bar (foo a) +{ + foo_p b; + return b->a; +} + +foo_p baz (foo_p a, foo_p b, foo_p *c) +{ + a = b = *c; + return a; +} |