xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/cleanup-stack.c (revision 4684ddb6aab0b36791c8099bc705d6140b3d05d0)
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t
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;
15 
16   {
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     }
22   }
23 
24   return var;
25 }
26