Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t |
Daniel Dunbar | 159c763 | 2009-05-11 22:30:29 +0000 | [diff] [blame] | 2 | // RUN: grep "ret i32 9" %t |
| 3 | |
| 4 | struct s0 { |
| 5 | int *var; |
| 6 | int addend; |
| 7 | }; |
| 8 | |
| 9 | static void f0(struct s0 *p) { |
| 10 | *p->var += p->addend; |
| 11 | } |
| 12 | |
| 13 | int f1(void) { |
| 14 | int var = 0; |
Anders Carlsson | 0ae7b2b | 2009-03-17 05:53:35 +0000 | [diff] [blame] | 15 | |
| 16 | { |
Daniel Dunbar | 159c763 | 2009-05-11 22:30:29 +0000 | [diff] [blame] | 17 | struct s0 x __attribute__((cleanup(f0))) = { &var, 2 }; |
| 18 | struct s0 y __attribute__((cleanup(f0))) = { &var, 3 }; |
| 19 | { |
| 20 | struct s0 y __attribute__((cleanup(f0))) = { &var, 4 }; |
| 21 | } |
Anders Carlsson | 0ae7b2b | 2009-03-17 05:53:35 +0000 | [diff] [blame] | 22 | } |
Daniel Dunbar | 159c763 | 2009-05-11 22:30:29 +0000 | [diff] [blame] | 23 | |
| 24 | return var; |
Anders Carlsson | 0ae7b2b | 2009-03-17 05:53:35 +0000 | [diff] [blame] | 25 | } |