[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / builtins / Unit / gcc_personality_test.c
blob9b2d412fca28ae52957c90c3d84be9207d386554
1 // FIXME: XFAIL as currently it cannot be built by lit properly.
2 // XFAIL: *
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 * ===----------------------------------------------------------------------===
14 #include <stdlib.h>
15 #include <stdio.h>
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
30 * function.
33 void bar() {
34 int x __attribute__((cleanup(bar_clean))) = 0;
35 register_bar_local(&x);
36 done_bar();
39 void foo() {
40 int x __attribute__((cleanup(foo_clean))) = 0;
41 register_foo_local(&x);
42 bar();
43 done_foo();