blob: ec69b55ce0f03836fbea150fb21bb3fcf85f1542 [file] [log] [blame]
Howard Hinnantd213ffd2011-05-05 15:27:28 +00001//===--------------------------- cxxabi.h ---------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef __CXXABI_H
11#define __CXXABI_H
12
13/*
14 * This header provides the interface to the C++ ABI as defined at:
15 * http://www.codesourcery.com/cxx-abi/
16 */
17
18#include <stddef.h>
19#include <stdint.h>
20
Marshall Clow4c2acbc2011-06-03 02:04:41 +000021#define LIBCXXABI_NORETURN
22
Howard Hinnantd213ffd2011-05-05 15:27:28 +000023namespace std {
24 class type_info; // forward declaration
25}
26
27
28// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
29namespace __cxxabiv1 {
30 extern "C" {
31
32// 2.4.2 Allocating the Exception Object
33extern void * __cxa_allocate_exception(size_t thrown_size) throw();
34extern void __cxa_free_exception(void * thrown_exception) throw();
35
36// 2.4.3 Throwing the Exception Object
37extern void __cxa_throw(void * thrown_exception, struct std::type_info * tinfo,
38 void (*dest)(void *));
39
40// 2.5.3 Exception Handlers
41extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
42extern void * __cxa_begin_catch(void * exceptionObject) throw();
43extern void __cxa_end_catch();
44extern std::type_info * __cxa_current_exception_type();
45
46// 2.5.4 Rethrowing Exceptions
47extern void __cxa_rethrow();
48
49
50
51// 2.6 Auxiliary Runtime APIs
Marshall Clow4c2acbc2011-06-03 02:04:41 +000052extern LIBCXXABI_NORETURN void __cxa_bad_cast(void);
53extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
Howard Hinnantd213ffd2011-05-05 15:27:28 +000054
55
56
57// 3.2.6 Pure Virtual Function API
Marshall Clow4c2acbc2011-06-03 02:04:41 +000058extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
Howard Hinnantd213ffd2011-05-05 15:27:28 +000059
Howard Hinnant92827182011-05-24 22:01:16 +000060// 3.2.7 Deleted Virtual Function API
Marshall Clow4c2acbc2011-06-03 02:04:41 +000061extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
Howard Hinnant92827182011-05-24 22:01:16 +000062
Howard Hinnantd213ffd2011-05-05 15:27:28 +000063// 3.3.2 One-time Construction API
64extern int __cxa_guard_acquire(uint64_t*);
65extern void __cxa_guard_release(uint64_t*);
66extern void __cxa_guard_abort(uint64_t*);
67
68// 3.3.3 Array Construction and Destruction API
69extern void* __cxa_vec_new(size_t element_count,
70 size_t element_size,
71 size_t padding_size,
72 void (*constructor)(void*),
73 void (*destructor)(void*) );
74
75extern void* __cxa_vec_new2(size_t element_count,
76 size_t element_size,
77 size_t padding_size,
78 void (*constructor)(void*),
79 void (*destructor)(void*),
80 void* (*alloc)(size_t),
81 void (*dealloc)(void*) );
82
83extern void* __cxa_vec_new3(size_t element_count,
84 size_t element_size,
85 size_t padding_size,
86 void (*constructor)(void*),
87 void (*destructor)(void*),
88 void* (*alloc)(size_t),
89 void (*dealloc)(void*, size_t) );
90
91extern void __cxa_vec_ctor(void* array_address,
92 size_t element_count,
93 size_t element_size,
94 void (*constructor)(void*),
95 void (*destructor)(void*) );
96
97
98extern void __cxa_vec_dtor(void* array_address,
99 size_t element_count,
100 size_t element_size,
101 void (*destructor)(void*) );
102
103
104extern void __cxa_vec_cleanup(void* array_address,
105 size_t element_count,
106 size_t element_size,
107 void (*destructor)(void*) );
108
109
110extern void __cxa_vec_delete(void* array_address,
111 size_t element_size,
112 size_t padding_size,
113 void (*destructor)(void*) );
114
115
116extern void __cxa_vec_delete2(void* array_address,
117 size_t element_size,
118 size_t padding_size,
119 void (*destructor)(void*),
120 void (*dealloc)(void*) );
121
122
123extern void __cxa_vec_delete3(void* __array_address,
124 size_t element_size,
125 size_t padding_size,
126 void (*destructor)(void*),
127 void (*dealloc) (void*, size_t));
128
129
130extern void __cxa_vec_cctor(void* dest_array,
131 void* src_array,
132 size_t element_count,
133 size_t element_size,
134 void (*constructor) (void*, void*),
135 void (*destructor)(void*) );
136
137
138// 3.3.5.3 Runtime API
139extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
140extern int __cxa_finalize(void*);
141
142
143// 3.4 Demangler API
144extern char* __cxa_demangle(const char* mangled_name,
145 char* output_buffer,
146 size_t* length,
147 int* status);
148
149 } // extern "C"
150} // namespace __cxxabiv1
151namespace abi = __cxxabiv1;
152
153
154
155
156
157// Below are Apple extensions to support implementing C++ ABI in a seperate dylib
158namespace __cxxabiapple {
159 extern "C" {
160
161// Apple additions to support multiple STL stacks that share common
162// terminate, unexpected, and new handlers
163extern void (*__cxa_terminate_handler)();
164extern void (*__cxa_unexpected_handler)();
165extern void (*__cxa_new_handler)();
166
167// Apple additions to support C++ 0x exception_ptr class
168// These are primitives to wrap a smart pointer around an exception object
169extern void * __cxa_current_primary_exception() throw();
170extern void __cxa_rethrow_primary_exception(void* primary_exception);
171extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
172extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
173
174// Apple addition to support std::uncaught_exception()
175extern bool __cxa_uncaught_exception() throw();
176
177 } // extern "C"
178} // namespace __cxxabiv1
179
180
181
182#endif // __CXXABI_H