1 // FIXME: UNSUPPORTED as currently it cannot be built by lit properly. 2 // UNSUPPORTED: true 3 // RUN: %clangxx_builtins %s %librt -o %t && %run %t 4 5 #include <stdlib.h> 6 #include <stdio.h> 7 8 extern void foo_clean(void* x); 9 extern void bar_clean(void* x); 10 extern void register_foo_local(int* x); 11 extern void register_bar_local(int* x); 12 extern void done_foo(); 13 extern void done_bar(); 14 15 16 /* 17 * foo() is called by main() in gcc_personality_test_helper.cxx. 18 * done_bar() is implemented in C++ and will throw an exception. 19 * main() will catch the exception and verify that the cleanup 20 * routines for foo() and bar() were called by the personality 21 * function. 22 */ 23 bar()24void bar() { 25 int x __attribute__((cleanup(bar_clean))) = 0; 26 register_bar_local(&x); 27 done_bar(); 28 } 29 foo()30void foo() { 31 int x __attribute__((cleanup(foo_clean))) = 0; 32 register_foo_local(&x); 33 bar(); 34 done_foo(); 35 } 36