brintos

brintos / llvm-project-archived public Read only

0
0
Text · 889 B · 160b897 Raw
36 lines · c
1// FIXME: UNSUPPORTED as currently it cannot be built by lit properly.2// UNSUPPORTED: true3// RUN: %clangxx_builtins %s %librt -o %t && %run %t4 5#include <stdlib.h>6#include <stdio.h>7 8extern void foo_clean(void* x);9extern void bar_clean(void* x);10extern void register_foo_local(int* x);11extern void register_bar_local(int* x);12extern void done_foo();13extern 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 cleanup20 * routines for foo() and bar() were called by the personality21 * function.22 */23 24void bar() {25    int x __attribute__((cleanup(bar_clean))) = 0;26    register_bar_local(&x);27    done_bar();28}29 30void foo() {31    int x __attribute__((cleanup(foo_clean))) = 0;32    register_foo_local(&x);33    bar();34    done_foo();35}36