1 //===--------------------------- cxxabi.h ---------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 * This header provides the interface to the C++ ABI as defined at:
15 * http://www.codesourcery.com/cxx-abi/
21 #define _LIBCPPABI_VERSION 1001
22 #define LIBCXXABI_NORETURN __attribute__((noreturn))
24 // FIXME: This is also in unwind.h and libunwind.h, can we consolidate?
25 #if !defined(__USING_SJLJ_EXCEPTIONS__) && defined(__arm__) && \
26 !defined(__ARM_DWARF_EH__) && !defined(__APPLE__)
27 #define LIBCXXABI_ARM_EHABI 1
29 #define LIBCXXABI_ARM_EHABI 0
35 class type_info; // forward declaration
39 // runtime routines use C calling conventions, but are in __cxxabiv1 namespace
40 namespace __cxxabiv1 {
43 // 2.4.2 Allocating the Exception Object
44 extern void * __cxa_allocate_exception(size_t thrown_size) throw();
45 extern void __cxa_free_exception(void * thrown_exception) throw();
47 // 2.4.3 Throwing the Exception Object
48 extern LIBCXXABI_NORETURN void __cxa_throw(void * thrown_exception,
49 std::type_info * tinfo, void (*dest)(void *));
51 // 2.5.3 Exception Handlers
52 extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
53 extern void * __cxa_begin_catch(void * exceptionObject) throw();
54 extern void __cxa_end_catch();
55 #if LIBCXXABI_ARM_EHABI
56 extern bool __cxa_begin_cleanup(void * exceptionObject) throw();
57 extern void __cxa_end_cleanup();
59 extern std::type_info * __cxa_current_exception_type();
61 // 2.5.4 Rethrowing Exceptions
62 extern LIBCXXABI_NORETURN void __cxa_rethrow();
66 // 2.6 Auxiliary Runtime APIs
67 extern LIBCXXABI_NORETURN void __cxa_bad_cast(void);
68 extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
72 // 3.2.6 Pure Virtual Function API
73 extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
75 // 3.2.7 Deleted Virtual Function API
76 extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
78 // 3.3.2 One-time Construction API
80 extern int __cxa_guard_acquire(uint32_t*);
81 extern void __cxa_guard_release(uint32_t*);
82 extern void __cxa_guard_abort(uint32_t*);
84 extern int __cxa_guard_acquire(uint64_t*);
85 extern void __cxa_guard_release(uint64_t*);
86 extern void __cxa_guard_abort(uint64_t*);
89 // 3.3.3 Array Construction and Destruction API
90 extern void* __cxa_vec_new(size_t element_count,
93 void (*constructor)(void*),
94 void (*destructor)(void*) );
96 extern void* __cxa_vec_new2(size_t element_count,
99 void (*constructor)(void*),
100 void (*destructor)(void*),
101 void* (*alloc)(size_t),
102 void (*dealloc)(void*) );
104 extern void* __cxa_vec_new3(size_t element_count,
107 void (*constructor)(void*),
108 void (*destructor)(void*),
109 void* (*alloc)(size_t),
110 void (*dealloc)(void*, size_t) );
112 extern void __cxa_vec_ctor(void* array_address,
113 size_t element_count,
115 void (*constructor)(void*),
116 void (*destructor)(void*) );
119 extern void __cxa_vec_dtor(void* array_address,
120 size_t element_count,
122 void (*destructor)(void*) );
125 extern void __cxa_vec_cleanup(void* array_address,
126 size_t element_count,
128 void (*destructor)(void*) );
131 extern void __cxa_vec_delete(void* array_address,
134 void (*destructor)(void*) );
137 extern void __cxa_vec_delete2(void* array_address,
140 void (*destructor)(void*),
141 void (*dealloc)(void*) );
144 extern void __cxa_vec_delete3(void* __array_address,
147 void (*destructor)(void*),
148 void (*dealloc) (void*, size_t));
151 extern void __cxa_vec_cctor(void* dest_array,
153 size_t element_count,
155 void (*constructor) (void*, void*),
156 void (*destructor)(void*) );
159 // 3.3.5.3 Runtime API
160 extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
161 extern int __cxa_finalize(void*);
165 extern char* __cxa_demangle(const char* mangled_name,
170 // Apple additions to support C++ 0x exception_ptr class
171 // These are primitives to wrap a smart pointer around an exception object
172 extern void * __cxa_current_primary_exception() throw();
173 extern void __cxa_rethrow_primary_exception(void* primary_exception);
174 extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
175 extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
177 // Apple addition to support std::uncaught_exception()
178 extern bool __cxa_uncaught_exception() throw();
181 } // namespace __cxxabiv1
183 namespace abi = __cxxabiv1;
185 #endif // __cplusplus