2011-05-05 23:27:28 +08:00
|
|
|
//===--------------------------- cxxabi.h ---------------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef __CXXABI_H
|
|
|
|
#define __CXXABI_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This header provides the interface to the C++ ABI as defined at:
|
|
|
|
* http://www.codesourcery.com/cxx-abi/
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2012-02-03 04:47:05 +08:00
|
|
|
#define _LIBCPPABI_VERSION 1001
|
2011-08-02 13:01:17 +08:00
|
|
|
#define LIBCXXABI_NORETURN __attribute__((noreturn))
|
2011-06-03 10:04:41 +08:00
|
|
|
|
2014-06-26 06:49:13 +08:00
|
|
|
// FIXME: This is also in unwind.h and libunwind.h, can we consolidate?
|
|
|
|
#if !defined(__USING_SJLJ_EXCEPTIONS__) && defined(__arm__) && \
|
|
|
|
!defined(__ARM_DWARF_EH__) && !defined(__APPLE__)
|
|
|
|
#define LIBCXXABI_ARM_EHABI 1
|
|
|
|
#else
|
|
|
|
#define LIBCXXABI_ARM_EHABI 0
|
|
|
|
#endif
|
|
|
|
|
2011-08-02 13:15:26 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
2011-05-05 23:27:28 +08:00
|
|
|
namespace std {
|
2011-06-08 03:56:49 +08:00
|
|
|
class type_info; // forward declaration
|
2011-05-05 23:27:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// runtime routines use C calling conventions, but are in __cxxabiv1 namespace
|
|
|
|
namespace __cxxabiv1 {
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
// 2.4.2 Allocating the Exception Object
|
2012-01-31 00:02:11 +08:00
|
|
|
extern void * __cxa_allocate_exception(size_t thrown_size) throw();
|
|
|
|
extern void __cxa_free_exception(void * thrown_exception) throw();
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
// 2.4.3 Throwing the Exception Object
|
2011-07-20 22:27:46 +08:00
|
|
|
extern LIBCXXABI_NORETURN void __cxa_throw(void * thrown_exception,
|
|
|
|
std::type_info * tinfo, void (*dest)(void *));
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
// 2.5.3 Exception Handlers
|
2012-01-31 00:02:11 +08:00
|
|
|
extern void * __cxa_get_exception_ptr(void * exceptionObject) throw();
|
|
|
|
extern void * __cxa_begin_catch(void * exceptionObject) throw();
|
2011-05-05 23:27:28 +08:00
|
|
|
extern void __cxa_end_catch();
|
2014-06-26 06:49:13 +08:00
|
|
|
#if LIBCXXABI_ARM_EHABI
|
2014-05-10 08:42:10 +08:00
|
|
|
extern bool __cxa_begin_cleanup(void * exceptionObject) throw();
|
|
|
|
extern void __cxa_end_cleanup();
|
|
|
|
#endif
|
2011-05-05 23:27:28 +08:00
|
|
|
extern std::type_info * __cxa_current_exception_type();
|
|
|
|
|
|
|
|
// 2.5.4 Rethrowing Exceptions
|
2011-07-20 22:27:46 +08:00
|
|
|
extern LIBCXXABI_NORETURN void __cxa_rethrow();
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2.6 Auxiliary Runtime APIs
|
2011-06-03 10:04:41 +08:00
|
|
|
extern LIBCXXABI_NORETURN void __cxa_bad_cast(void);
|
|
|
|
extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void);
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 3.2.6 Pure Virtual Function API
|
2011-06-03 10:04:41 +08:00
|
|
|
extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void);
|
2011-05-05 23:27:28 +08:00
|
|
|
|
2011-05-25 06:01:16 +08:00
|
|
|
// 3.2.7 Deleted Virtual Function API
|
2011-06-03 10:04:41 +08:00
|
|
|
extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void);
|
2011-05-25 06:01:16 +08:00
|
|
|
|
2011-05-05 23:27:28 +08:00
|
|
|
// 3.3.2 One-time Construction API
|
2012-03-15 03:30:00 +08:00
|
|
|
#if __arm__
|
2011-06-08 02:46:10 +08:00
|
|
|
extern int __cxa_guard_acquire(uint32_t*);
|
|
|
|
extern void __cxa_guard_release(uint32_t*);
|
|
|
|
extern void __cxa_guard_abort(uint32_t*);
|
|
|
|
#else
|
2011-05-05 23:27:28 +08:00
|
|
|
extern int __cxa_guard_acquire(uint64_t*);
|
|
|
|
extern void __cxa_guard_release(uint64_t*);
|
|
|
|
extern void __cxa_guard_abort(uint64_t*);
|
2011-06-08 02:46:10 +08:00
|
|
|
#endif
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
// 3.3.3 Array Construction and Destruction API
|
|
|
|
extern void* __cxa_vec_new(size_t element_count,
|
2011-06-08 03:56:49 +08:00
|
|
|
size_t element_size,
|
2011-05-05 23:27:28 +08:00
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*constructor)(void*),
|
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
extern void* __cxa_vec_new2(size_t element_count,
|
2011-06-08 03:56:49 +08:00
|
|
|
size_t element_size,
|
2011-05-05 23:27:28 +08:00
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*constructor)(void*),
|
|
|
|
void (*destructor)(void*),
|
2011-05-05 23:27:28 +08:00
|
|
|
void* (*alloc)(size_t),
|
|
|
|
void (*dealloc)(void*) );
|
|
|
|
|
|
|
|
extern void* __cxa_vec_new3(size_t element_count,
|
2011-06-08 03:56:49 +08:00
|
|
|
size_t element_size,
|
2011-05-05 23:27:28 +08:00
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*constructor)(void*),
|
|
|
|
void (*destructor)(void*),
|
2011-05-05 23:27:28 +08:00
|
|
|
void* (*alloc)(size_t),
|
|
|
|
void (*dealloc)(void*, size_t) );
|
|
|
|
|
|
|
|
extern void __cxa_vec_ctor(void* array_address,
|
|
|
|
size_t element_count,
|
|
|
|
size_t element_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*constructor)(void*),
|
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_dtor(void* array_address,
|
|
|
|
size_t element_count,
|
2011-06-08 03:56:49 +08:00
|
|
|
size_t element_size,
|
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_cleanup(void* array_address,
|
|
|
|
size_t element_count,
|
|
|
|
size_t element_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_delete(void* array_address,
|
|
|
|
size_t element_size,
|
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_delete2(void* array_address,
|
|
|
|
size_t element_size,
|
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*destructor)(void*),
|
2011-05-05 23:27:28 +08:00
|
|
|
void (*dealloc)(void*) );
|
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_delete3(void* __array_address,
|
|
|
|
size_t element_size,
|
|
|
|
size_t padding_size,
|
2011-06-08 03:56:49 +08:00
|
|
|
void (*destructor)(void*),
|
|
|
|
void (*dealloc) (void*, size_t));
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
extern void __cxa_vec_cctor(void* dest_array,
|
2011-06-08 03:56:49 +08:00
|
|
|
void* src_array,
|
|
|
|
size_t element_count,
|
|
|
|
size_t element_size,
|
|
|
|
void (*constructor) (void*, void*),
|
|
|
|
void (*destructor)(void*) );
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
// 3.3.5.3 Runtime API
|
|
|
|
extern int __cxa_atexit(void (*f)(void*), void* p, void* d);
|
|
|
|
extern int __cxa_finalize(void*);
|
|
|
|
|
|
|
|
|
|
|
|
// 3.4 Demangler API
|
|
|
|
extern char* __cxa_demangle(const char* mangled_name,
|
2011-06-08 03:56:49 +08:00
|
|
|
char* output_buffer,
|
|
|
|
size_t* length,
|
|
|
|
int* status);
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
// Apple additions to support C++ 0x exception_ptr class
|
|
|
|
// These are primitives to wrap a smart pointer around an exception object
|
2012-01-31 00:02:11 +08:00
|
|
|
extern void * __cxa_current_primary_exception() throw();
|
2011-05-05 23:27:28 +08:00
|
|
|
extern void __cxa_rethrow_primary_exception(void* primary_exception);
|
2012-01-31 00:02:11 +08:00
|
|
|
extern void __cxa_increment_exception_refcount(void* primary_exception) throw();
|
|
|
|
extern void __cxa_decrement_exception_refcount(void* primary_exception) throw();
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
// Apple addition to support std::uncaught_exception()
|
2012-01-31 00:02:11 +08:00
|
|
|
extern bool __cxa_uncaught_exception() throw();
|
2011-05-05 23:27:28 +08:00
|
|
|
|
|
|
|
} // extern "C"
|
|
|
|
} // namespace __cxxabiv1
|
|
|
|
|
2012-02-18 02:45:44 +08:00
|
|
|
namespace abi = __cxxabiv1;
|
2011-05-05 23:27:28 +08:00
|
|
|
|
2014-06-26 06:49:13 +08:00
|
|
|
#endif // __cplusplus
|
|
|
|
|
2011-05-05 23:27:28 +08:00
|
|
|
#endif // __CXXABI_H
|