1 // FIXME: XFAIL as currently it cannot be built by lit properly.
3 // RUN: %clangxx_builtins %s %librt -o %t && %run %t
4 /* ===-- gcc_personality_test.c - Tests __gcc_personality_v0 -------------===
6 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 * See https://llvm.org/LICENSE.txt for license information.
8 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10 * ===----------------------------------------------------------------------===
17 extern void foo_clean(void* x
);
18 extern void bar_clean(void* x
);
19 extern void register_foo_local(int* x
);
20 extern void register_bar_local(int* x
);
21 extern void done_foo();
22 extern void done_bar();
26 * foo() is called by main() in gcc_personality_test_helper.cxx.
27 * done_bar() is implemented in C++ and will throw an exception.
28 * main() will catch the exception and verify that the cleanup
29 * routines for foo() and bar() were called by the personality
34 int x
__attribute__((cleanup(bar_clean
))) = 0;
35 register_bar_local(&x
);
40 int x
__attribute__((cleanup(foo_clean
))) = 0;
41 register_foo_local(&x
);