blob: d163dd40a97c8a43260d8f9c7495735a2f769e73 [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
21namespace std {
22 class type_info; // forward declaration
23}
24
25
26// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
27namespace __cxxabiv1 {
28 extern "C" {
29
30// 2.4.2 Allocating the Exception Object
31extern void * __cxa_allocate_exception(size_t thrown_size) throw();
32extern void __cxa_free_exception(void * thrown_exception) throw();
33
34// 2.4.3 Throwing the Exception Object
35extern void __cxa_throw(void * thrown_exception, struct std::type_info * tinfo,
36 void (*dest)(void *));
37
38// 2.5.3 Exception Handlers
39extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
40extern void * __cxa_begin_catch(void * exceptionObject) throw();
41extern void __cxa_end_catch();
42extern std::type_info * __cxa_current_exception_type();
43
44// 2.5.4 Rethrowing Exceptions
45extern void __cxa_rethrow();
46
47
48
49// 2.6 Auxiliary Runtime APIs
50extern void __cxa_bad_cast();
51extern void __cxa_bad_typeid();
52
53
54
55// 3.2.6 Pure Virtual Function API
56extern void __cxa_pure_virtual(void);
57
58// 3.3.2 One-time Construction API
59extern int __cxa_guard_acquire(uint64_t*);
60extern void __cxa_guard_release(uint64_t*);
61extern void __cxa_guard_abort(uint64_t*);
62
63// 3.3.3 Array Construction and Destruction API
64extern void* __cxa_vec_new(size_t element_count,
65 size_t element_size,
66 size_t padding_size,
67 void (*constructor)(void*),
68 void (*destructor)(void*) );
69
70extern void* __cxa_vec_new2(size_t element_count,
71 size_t element_size,
72 size_t padding_size,
73 void (*constructor)(void*),
74 void (*destructor)(void*),
75 void* (*alloc)(size_t),
76 void (*dealloc)(void*) );
77
78extern void* __cxa_vec_new3(size_t element_count,
79 size_t element_size,
80 size_t padding_size,
81 void (*constructor)(void*),
82 void (*destructor)(void*),
83 void* (*alloc)(size_t),
84 void (*dealloc)(void*, size_t) );
85
86extern void __cxa_vec_ctor(void* array_address,
87 size_t element_count,
88 size_t element_size,
89 void (*constructor)(void*),
90 void (*destructor)(void*) );
91
92
93extern void __cxa_vec_dtor(void* array_address,
94 size_t element_count,
95 size_t element_size,
96 void (*destructor)(void*) );
97
98
99extern void __cxa_vec_cleanup(void* array_address,
100 size_t element_count,
101 size_t element_size,
102 void (*destructor)(void*) );
103
104
105extern void __cxa_vec_delete(void* array_address,
106 size_t element_size,
107 size_t padding_size,
108 void (*destructor)(void*) );
109
110
111extern void __cxa_vec_delete2(void* array_address,
112 size_t element_size,
113 size_t padding_size,
114 void (*destructor)(void*),
115 void (*dealloc)(void*) );
116
117
118extern void __cxa_vec_delete3(void* __array_address,
119 size_t element_size,
120 size_t padding_size,
121 void (*destructor)(void*),
122 void (*dealloc) (void*, size_t));
123
124
125extern void __cxa_vec_cctor(void* dest_array,
126 void* src_array,
127 size_t element_count,
128 size_t element_size,
129 void (*constructor) (void*, void*),
130 void (*destructor)(void*) );
131
132
133// 3.3.5.3 Runtime API
134extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
135extern int __cxa_finalize(void*);
136
137
138// 3.4 Demangler API
139extern char* __cxa_demangle(const char* mangled_name,
140 char* output_buffer,
141 size_t* length,
142 int* status);
143
144 } // extern "C"
145} // namespace __cxxabiv1
146namespace abi = __cxxabiv1;
147
148
149
150
151
152// Below are Apple extensions to support implementing C++ ABI in a seperate dylib
153namespace __cxxabiapple {
154 extern "C" {
155
156// Apple additions to support multiple STL stacks that share common
157// terminate, unexpected, and new handlers
158extern void (*__cxa_terminate_handler)();
159extern void (*__cxa_unexpected_handler)();
160extern void (*__cxa_new_handler)();
161
162// Apple additions to support C++ 0x exception_ptr class
163// These are primitives to wrap a smart pointer around an exception object
164extern void * __cxa_current_primary_exception() throw();
165extern void __cxa_rethrow_primary_exception(void* primary_exception);
166extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
167extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
168
169// Apple addition to support std::uncaught_exception()
170extern bool __cxa_uncaught_exception() throw();
171
172 } // extern "C"
173} // namespace __cxxabiv1
174
175
176
177#endif // __CXXABI_H