Author: compnerd Date: Thu Dec 3 20:14:58 2015 New Revision: 254691 URL: http://llvm.org/viewvc/llvm-project?rev=254691&view=rev Log: ibc++abi: mark visibility
Mark functions and types with the appropriate visibility. This is particularly useful for environments which explicitly indicate origin of functions (Windows). This aids in generating libc++abi as a DSO which exposes only the public interfaces. Modified: libcxxabi/trunk/include/__cxxabi_config.h libcxxabi/trunk/include/cxxabi.h libcxxabi/trunk/src/cxa_aux_runtime.cpp libcxxabi/trunk/src/cxa_demangle.cpp libcxxabi/trunk/src/cxa_exception.cpp libcxxabi/trunk/src/cxa_guard.cpp libcxxabi/trunk/src/cxa_thread_atexit.cpp libcxxabi/trunk/src/cxa_vector.cpp libcxxabi/trunk/src/cxa_virtual.cpp libcxxabi/trunk/src/private_typeinfo.h Modified: libcxxabi/trunk/include/__cxxabi_config.h URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/__cxxabi_config.h?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/include/__cxxabi_config.h (original) +++ libcxxabi/trunk/include/__cxxabi_config.h Thu Dec 3 20:14:58 2015 @@ -17,4 +17,28 @@ #define LIBCXXABI_ARM_EHABI 0 #endif +#if !defined(__has_attribute) +#define __has_attribute(_attribute_) 0 +#endif + +#if defined(_LIBCXXABI_DLL) + #if defined(cxxabi_EXPORTS) + #define _LIBCXXABI_HIDDEN + #define _LIBCXXABI_FUNC_VIS __declspec(dllexport) + #define _LIBCXXABI_TYPE_VIS __declspec(dllexport) + #else + #define _LIBCXXABI_HIDDEN + #define _LIBCXXABI_FUNC_VIS __declspec(dllimport) + #define _LIBCXXABI_TYPE_VIS __declspec(dllimport) + #endif +#else + #define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden"))) + #define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default"))) + #if __has_attribute(__type_visibility__) + #define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default"))) + #else + #define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default"))) + #endif +#endif + #endif // ____CXXABI_CONFIG_H Modified: libcxxabi/trunk/include/cxxabi.h URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/include/cxxabi.h?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/include/cxxabi.h (original) +++ libcxxabi/trunk/include/cxxabi.h Thu Dec 3 20:14:58 2015 @@ -26,7 +26,11 @@ #ifdef __cplusplus namespace std { +#if defined(_WIN32) +class _LIBCXXABI_TYPE_VIS type_info; // forward declaration +#else class type_info; // forward declaration +#endif } @@ -35,113 +39,132 @@ namespace __cxxabiv1 { extern "C" { // 2.4.2 Allocating the Exception Object -extern void *__cxa_allocate_exception(size_t thrown_size) throw(); -extern void __cxa_free_exception(void *thrown_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_allocate_exception(size_t thrown_size) throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_free_exception(void *thrown_exception) throw(); // 2.4.3 Throwing the Exception Object -extern LIBCXXABI_NORETURN void __cxa_throw(void *thrown_exception, - std::type_info *tinfo, - void (*dest)(void *)); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw(void *thrown_exception, std::type_info *tinfo, + void (*dest)(void *)); // 2.5.3 Exception Handlers -extern void *__cxa_get_exception_ptr(void *exceptionObject) throw(); -extern void *__cxa_begin_catch(void *exceptionObject) throw(); -extern void __cxa_end_catch(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_get_exception_ptr(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_begin_catch(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void __cxa_end_catch(); #if LIBCXXABI_ARM_EHABI -extern bool __cxa_begin_cleanup(void *exceptionObject) throw(); -extern void __cxa_end_cleanup(); +extern _LIBCXXABI_FUNC_VIS bool +__cxa_begin_cleanup(void *exceptionObject) throw(); +extern _LIBCXXABI_FUNC_VIS void __cxa_end_cleanup(); #endif -extern std::type_info *__cxa_current_exception_type(); +extern _LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type(); // 2.5.4 Rethrowing Exceptions -extern LIBCXXABI_NORETURN void __cxa_rethrow(); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_rethrow(); // 2.6 Auxiliary Runtime APIs -extern LIBCXXABI_NORETURN void __cxa_bad_cast(void); -extern LIBCXXABI_NORETURN void __cxa_bad_typeid(void); -extern LIBCXXABI_NORETURN void __cxa_throw_bad_array_new_length(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw_bad_array_new_length(void); // 3.2.6 Pure Virtual Function API -extern LIBCXXABI_NORETURN void __cxa_pure_virtual(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_pure_virtual(void); // 3.2.7 Deleted Virtual Function API -extern LIBCXXABI_NORETURN void __cxa_deleted_virtual(void); +extern _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_deleted_virtual(void); // 3.3.2 One-time Construction API #ifdef __arm__ -extern int __cxa_guard_acquire(uint32_t *); -extern void __cxa_guard_release(uint32_t *); -extern void __cxa_guard_abort(uint32_t *); +extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint32_t *); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint32_t *); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint32_t *); #else -extern int __cxa_guard_acquire(uint64_t *); -extern void __cxa_guard_release(uint64_t *); -extern void __cxa_guard_abort(uint64_t *); +extern _LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(uint64_t *); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_release(uint64_t *); +extern _LIBCXXABI_FUNC_VIS void __cxa_guard_abort(uint64_t *); #endif // 3.3.3 Array Construction and Destruction API -extern void *__cxa_vec_new(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *)); - -extern void *__cxa_vec_new2(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *), void *(*alloc)(size_t), - void (*dealloc)(void *)); - -extern void *__cxa_vec_new3(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *), 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, void (*constructor)(void *), - void (*destructor)(void *)); - -extern void __cxa_vec_dtor(void *array_address, size_t element_count, - size_t element_size, void (*destructor)(void *)); - -extern void __cxa_vec_cleanup(void *array_address, size_t element_count, - size_t element_size, void (*destructor)(void *)); - -extern void __cxa_vec_delete(void *array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *)); - -extern void __cxa_vec_delete2(void *array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *), - void (*dealloc)(void *)); - -extern void __cxa_vec_delete3(void *__array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *), - void (*dealloc)(void *, size_t)); - -extern void __cxa_vec_cctor(void *dest_array, void *src_array, - size_t element_count, size_t element_size, - void (*constructor)(void *, void *), - void (*destructor)(void *)); +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *)); + +extern _LIBCXXABI_FUNC_VIS void * +__cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *, size_t)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size, + void (*constructor)(void *), void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void __cxa_vec_delete(void *array_address, + size_t element_size, + size_t padding_size, + void (*destructor)(void *)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_delete3(void *__array_address, size_t element_size, + size_t padding_size, void (*destructor)(void *), + void (*dealloc)(void *, size_t)); + +extern _LIBCXXABI_FUNC_VIS void +__cxa_vec_cctor(void *dest_array, void *src_array, size_t element_count, + size_t element_size, void (*constructor)(void *, void *), + void (*destructor)(void *)); // 3.3.5.3 Runtime API -extern int __cxa_atexit(void (*f)(void *), void *p, void *d); -extern int __cxa_finalize(void *); +extern _LIBCXXABI_FUNC_VIS int __cxa_atexit(void (*f)(void *), void *p, + void *d); +extern _LIBCXXABI_FUNC_VIS int __cxa_finalize(void *); // 3.4 Demangler API -extern char *__cxa_demangle(const char *mangled_name, char *output_buffer, - size_t *length, int *status); +extern _LIBCXXABI_FUNC_VIS char *__cxa_demangle(const char *mangled_name, + char *output_buffer, + size_t *length, int *status); // Apple additions to support C++ 0x exception_ptr class // These are primitives to wrap a smart pointer around an exception object -extern void *__cxa_current_primary_exception() throw(); -extern void __cxa_rethrow_primary_exception(void *primary_exception); -extern void __cxa_increment_exception_refcount(void *primary_exception) throw(); -extern void __cxa_decrement_exception_refcount(void *primary_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_rethrow_primary_exception(void *primary_exception); +extern _LIBCXXABI_FUNC_VIS void +__cxa_increment_exception_refcount(void *primary_exception) throw(); +extern _LIBCXXABI_FUNC_VIS void +__cxa_decrement_exception_refcount(void *primary_exception) throw(); // Apple extension to support std::uncaught_exception() -extern bool __cxa_uncaught_exception() throw(); -extern unsigned int __cxa_uncaught_exceptions() throw(); +extern _LIBCXXABI_FUNC_VIS bool __cxa_uncaught_exception() throw(); +extern _LIBCXXABI_FUNC_VIS unsigned int __cxa_uncaught_exceptions() throw(); #ifdef __linux__ // Linux TLS support. Not yet an official part of the Itanium ABI. // https://sourceware.org/glibc/wiki/Destructor%20support%20for%20thread_local%20variables -extern int __cxa_thread_atexit(void (*)(void *), void *, void *) throw(); +extern _LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*)(void *), void *, + void *) throw(); #endif } // extern "C" Modified: libcxxabi/trunk/src/cxa_aux_runtime.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_aux_runtime.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_aux_runtime.cpp (original) +++ libcxxabi/trunk/src/cxa_aux_runtime.cpp Thu Dec 3 20:14:58 2015 @@ -16,14 +16,16 @@ namespace __cxxabiv1 { extern "C" { -LIBCXXABI_NORETURN -void __cxa_bad_cast(void) { throw std::bad_cast(); } +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) { + throw std::bad_cast(); +} -LIBCXXABI_NORETURN -void __cxa_bad_typeid(void) { throw std::bad_typeid(); } +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void) { + throw std::bad_typeid(); +} -LIBCXXABI_NORETURN -void __cxa_throw_bad_array_new_length(void) { +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw_bad_array_new_length(void) { throw std::bad_array_new_length(); } } // extern "C" Modified: libcxxabi/trunk/src/cxa_demangle.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_demangle.cpp (original) +++ libcxxabi/trunk/src/cxa_demangle.cpp Thu Dec 3 20:14:58 2015 @@ -10,6 +10,8 @@ #define _LIBCPP_EXTERN_TEMPLATE(...) #define _LIBCPP_NO_EXCEPTIONS +#include "__cxxabi_config.h" + #include <vector> #include <algorithm> #include <string> @@ -4922,7 +4924,7 @@ struct Db } // unnamed namespace -extern "C" __attribute__((__visibility__("default"))) char * +extern "C" _LIBCXXABI_FUNC_VIS char * __cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status) { if (mangled_name == nullptr || (buf != nullptr && n == nullptr)) { Modified: libcxxabi/trunk/src/cxa_exception.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_exception.cpp (original) +++ libcxxabi/trunk/src/cxa_exception.cpp Thu Dec 3 20:14:58 2015 @@ -156,7 +156,7 @@ extern "C" { // object. Zero-fill the object. If memory can't be allocated, call // std::terminate. Return a pointer to the memory to be used for the // user's exception object. -void *__cxa_allocate_exception(size_t thrown_size) throw() { +_LIBCXXABI_FUNC_VIS void *__cxa_allocate_exception(size_t thrown_size) throw() { size_t actual_size = cxa_exception_size_from_exception_thrown_size(thrown_size); __cxa_exception* exception_header = static_cast<__cxa_exception*>(do_malloc(actual_size)); if (NULL == exception_header) @@ -167,7 +167,7 @@ void *__cxa_allocate_exception(size_t th // Free a __cxa_exception object allocated with __cxa_allocate_exception. -void __cxa_free_exception(void *thrown_object) throw() { +_LIBCXXABI_FUNC_VIS void __cxa_free_exception(void *thrown_object) throw() { do_free(cxa_exception_from_thrown_object(thrown_object)); } @@ -218,9 +218,8 @@ handler, _Unwind_RaiseException may retu will call terminate, assuming that there was no handler for the exception. */ -LIBCXXABI_NORETURN -void __cxa_throw(void *thrown_object, std::type_info *tinfo, - void (*dest)(void *)) { +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void +__cxa_throw(void *thrown_object, std::type_info *tinfo, void (*dest)(void *)) { __cxa_eh_globals *globals = __cxa_get_globals(); __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -252,6 +251,7 @@ The adjusted pointer is computed by the Requires: exception is native */ +_LIBCXXABI_FUNC_VIS void *__cxa_get_exception_ptr(void *unwind_exception) throw() { #if LIBCXXABI_ARM_EHABI return reinterpret_cast<void*>( @@ -267,6 +267,7 @@ void *__cxa_get_exception_ptr(void *unwi The routine to be called before the cleanup. This will save __cxa_exception in __cxa_eh_globals, so that __cxa_end_cleanup() can recover later. */ +_LIBCXXABI_FUNC_VIS bool __cxa_begin_cleanup(void *unwind_arg) throw() { _Unwind_Exception* unwind_exception = static_cast<_Unwind_Exception*>(unwind_arg); __cxa_eh_globals* globals = __cxa_get_globals(); @@ -438,7 +439,7 @@ For a foreign exception: * If it has been rethrown, there is nothing to do. * Otherwise delete the exception and pop the catch stack to empty. */ -void __cxa_end_catch() { +_LIBCXXABI_FUNC_VIS void __cxa_end_catch() { static_assert(sizeof(__cxa_exception) == sizeof(__cxa_dependent_exception), "sizeof(__cxa_exception) must be equal to " "sizeof(__cxa_dependent_exception)"); @@ -515,7 +516,7 @@ void __cxa_end_catch() { // Note: exception_header may be masquerading as a __cxa_dependent_exception // and that's ok. exceptionType is there too. // However watch out for foreign exceptions. Return null for them. -std::type_info *__cxa_current_exception_type() { +_LIBCXXABI_FUNC_VIS std::type_info *__cxa_current_exception_type() { // get the current exception __cxa_eh_globals *globals = __cxa_get_globals_fast(); if (NULL == globals) @@ -540,8 +541,7 @@ If the exception is native: Note: exception_header may be masquerading as a __cxa_dependent_exception and that's ok. */ -LIBCXXABI_NORETURN -void __cxa_rethrow() { +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_rethrow() { __cxa_eh_globals* globals = __cxa_get_globals(); __cxa_exception* exception_header = globals->caughtExceptions; if (NULL == exception_header) @@ -586,7 +586,8 @@ void __cxa_rethrow() { Requires: If thrown_object is not NULL, it is a native exception. */ -void __cxa_increment_exception_refcount(void *thrown_object) throw() { +_LIBCXXABI_FUNC_VIS void +__cxa_increment_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -602,7 +603,8 @@ void __cxa_increment_exception_refcount( Requires: If thrown_object is not NULL, it is a native exception. */ -void __cxa_decrement_exception_refcount(void *thrown_object) throw() { +_LIBCXXABI_FUNC_VIS void +__cxa_decrement_exception_refcount(void *thrown_object) throw() { if (thrown_object != NULL ) { __cxa_exception* exception_header = cxa_exception_from_thrown_object(thrown_object); @@ -625,7 +627,7 @@ void __cxa_decrement_exception_refcount( been no exceptions thrown, ever, on this thread, we can return NULL without the need to allocate the exception-handling globals. */ -void *__cxa_current_primary_exception() throw() { +_LIBCXXABI_FUNC_VIS void *__cxa_current_primary_exception() throw() { // get the current exception __cxa_eh_globals* globals = __cxa_get_globals_fast(); if (NULL == globals) Modified: libcxxabi/trunk/src/cxa_guard.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_guard.cpp (original) +++ libcxxabi/trunk/src/cxa_guard.cpp Thu Dec 3 20:14:58 2015 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include "__cxxabi_config.h" + #include "abort_message.h" #include "config.h" @@ -167,22 +169,22 @@ extern "C" { #if LIBCXXABI_HAS_NO_THREADS -int __cxa_guard_acquire(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(guard_type *guard_object) { return !is_initialized(guard_object); } -void __cxa_guard_release(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS void __cxa_guard_release(guard_type *guard_object) { *guard_object = 0; set_initialized(guard_object); } -void __cxa_guard_abort(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS void __cxa_guard_abort(guard_type *guard_object) { *guard_object = 0; } #else // !LIBCXXABI_HAS_NO_THREADS -int __cxa_guard_acquire(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(guard_type *guard_object) { char* initialized = (char*)guard_object; if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_acquire failed to acquire mutex"); @@ -223,7 +225,7 @@ int __cxa_guard_acquire(guard_type *guar return result; } -void __cxa_guard_release(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS void __cxa_guard_release(guard_type *guard_object) { if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_release failed to acquire mutex"); *guard_object = 0; @@ -234,7 +236,7 @@ void __cxa_guard_release(guard_type *gua abort_message("__cxa_guard_release failed to broadcast condition variable"); } -void __cxa_guard_abort(guard_type *guard_object) { +_LIBCXXABI_FUNC_VIS void __cxa_guard_abort(guard_type *guard_object) { if (pthread_mutex_lock(&guard_mut)) abort_message("__cxa_guard_abort failed to acquire mutex"); *guard_object = 0; Modified: libcxxabi/trunk/src/cxa_thread_atexit.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_thread_atexit.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_thread_atexit.cpp (original) +++ libcxxabi/trunk/src/cxa_thread_atexit.cpp Thu Dec 3 20:14:58 2015 @@ -14,8 +14,8 @@ extern "C" { #ifdef HAVE___CXA_THREAD_ATEXIT_IMPL -int __cxa_thread_atexit(void (*dtor)(void *), void *obj, - void *dso_symbol) throw() { +_LIBCXXABI_FUNC_VIS int __cxa_thread_atexit(void (*dtor)(void *), void *obj, + void *dso_symbol) throw() { extern int __cxa_thread_atexit_impl(void (*)(void *), void *, void *); return __cxa_thread_atexit_impl(dtor, obj, dso_symbol); } Modified: libcxxabi/trunk/src/cxa_vector.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_vector.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_vector.cpp (original) +++ libcxxabi/trunk/src/cxa_vector.cpp Thu Dec 3 20:14:58 2015 @@ -114,9 +114,9 @@ extern "C" { // // __cxa_vec_new2(element_count, element_size, padding_size, constructor, // destructor, &::operator new[], &::operator delete[]) -void *__cxa_vec_new(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *)) { return __cxa_vec_new2 ( element_count, element_size, padding_size, constructor, destructor, &::operator new [], &::operator delete [] ); } @@ -139,10 +139,10 @@ void *__cxa_vec_new(size_t element_count // not be called. // // Neither alloc nor dealloc may be NULL. -void *__cxa_vec_new2(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *), void *(*alloc)(size_t), - void (*dealloc)(void *)) { +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new2(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *)) { const size_t heap_size = element_count * element_size + padding_size; char * const heap_block = static_cast<char *> ( alloc ( heap_size )); char *vec_base = heap_block; @@ -167,10 +167,10 @@ void *__cxa_vec_new2(size_t element_coun // Same as __cxa_vec_new2 except that the deallocation function takes both // the object address and its size. -void *__cxa_vec_new3(size_t element_count, size_t element_size, - size_t padding_size, void (*constructor)(void *), - void (*destructor)(void *), void *(*alloc)(size_t), - void (*dealloc)(void *, size_t)) { +_LIBCXXABI_FUNC_VIS void * +__cxa_vec_new3(size_t element_count, size_t element_size, size_t padding_size, + void (*constructor)(void *), void (*destructor)(void *), + void *(*alloc)(size_t), void (*dealloc)(void *, size_t)) { const size_t heap_size = element_count * element_size + padding_size; char * const heap_block = static_cast<char *> ( alloc ( heap_size )); char *vec_base = heap_block; @@ -203,9 +203,11 @@ void *__cxa_vec_new3(size_t element_coun // pointers may be NULL. If either is NULL, no action is taken when it // would have been called. -void __cxa_vec_cctor(void *dest_array, void *src_array, size_t element_count, - size_t element_size, void (*constructor)(void *, void *), - void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void __cxa_vec_cctor(void *dest_array, void *src_array, + size_t element_count, + size_t element_size, + void (*constructor)(void *, void *), + void (*destructor)(void *)) { if ( NULL != constructor ) { size_t idx = 0; char *src_ptr = static_cast<char *>(src_array); @@ -227,9 +229,9 @@ void __cxa_vec_cctor(void *dest_array, v // exception. If the destructor throws an exception, call terminate(). The // constructor and/or destructor pointers may be NULL. If either is NULL, // no action is taken when it would have been called. -void __cxa_vec_ctor(void *array_address, size_t element_count, - size_t element_size, void (*constructor)(void *), - void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void +__cxa_vec_ctor(void *array_address, size_t element_count, size_t element_size, + void (*constructor)(void *), void (*destructor)(void *)) { if ( NULL != constructor ) { size_t idx; char *ptr = static_cast <char *> ( array_address ); @@ -248,8 +250,10 @@ void __cxa_vec_ctor(void *array_address, // elements if possible. If the destructor throws a second exception, call // terminate(). The destructor pointer may be NULL, in which case this // routine does nothing. -void __cxa_vec_dtor(void *array_address, size_t element_count, - size_t element_size, void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void __cxa_vec_dtor(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)) { if ( NULL != destructor ) { char *ptr = static_cast <char *> (array_address); size_t idx = element_count; @@ -272,8 +276,10 @@ void __cxa_vec_dtor(void *array_address, // size of its elements, call the given destructor on each element. If the // destructor throws an exception, call terminate(). The destructor pointer // may be NULL, in which case this routine does nothing. -void __cxa_vec_cleanup(void *array_address, size_t element_count, - size_t element_size, void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void __cxa_vec_cleanup(void *array_address, + size_t element_count, + size_t element_size, + void (*destructor)(void *)) { if ( NULL != destructor ) { char *ptr = static_cast <char *> (array_address); size_t idx = element_count; @@ -308,8 +314,10 @@ void __cxa_vec_cleanup(void *array_addre // function be called even if the destructor throws an exception derives // from the resolution to DR 353 to the C++ standard, which was adopted in // April, 2003. -void __cxa_vec_delete(void *array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *)) { +_LIBCXXABI_FUNC_VIS void __cxa_vec_delete(void *array_address, + size_t element_size, + size_t padding_size, + void (*destructor)(void *)) { __cxa_vec_delete2 ( array_address, element_size, padding_size, destructor, &::operator delete [] ); } @@ -318,9 +326,9 @@ void __cxa_vec_delete(void *array_addres // deallocation instead of the default delete function. If dealloc throws // an exception, the result is undefined. The dealloc pointer may not be // NULL. -void __cxa_vec_delete2(void *array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *), - void (*dealloc)(void *)) { +_LIBCXXABI_FUNC_VIS void +__cxa_vec_delete2(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *)) { if ( NULL != array_address ) { char *vec_base = static_cast <char *> (array_address); char *heap_block = vec_base - padding_size; @@ -338,9 +346,9 @@ void __cxa_vec_delete2(void *array_addre // function takes both the object address and its size. If dealloc throws // an exception, the result is undefined. The dealloc pointer may not be // NULL. -void __cxa_vec_delete3(void *array_address, size_t element_size, - size_t padding_size, void (*destructor)(void *), - void (*dealloc)(void *, size_t)) { +_LIBCXXABI_FUNC_VIS void +__cxa_vec_delete3(void *array_address, size_t element_size, size_t padding_size, + void (*destructor)(void *), void (*dealloc)(void *, size_t)) { if ( NULL != array_address ) { char *vec_base = static_cast <char *> (array_address); char *heap_block = vec_base - padding_size; Modified: libcxxabi/trunk/src/cxa_virtual.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_virtual.cpp?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/cxa_virtual.cpp (original) +++ libcxxabi/trunk/src/cxa_virtual.cpp Thu Dec 3 20:14:58 2015 @@ -12,12 +12,12 @@ namespace __cxxabiv1 { extern "C" { -LIBCXXABI_NORETURN +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_pure_virtual(void) { abort_message("Pure virtual function called!"); } -LIBCXXABI_NORETURN +_LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_deleted_virtual(void) { abort_message("Deleted virtual function called!"); } Modified: libcxxabi/trunk/src/private_typeinfo.h URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.h?rev=254691&r1=254690&r2=254691&view=diff ============================================================================== --- libcxxabi/trunk/src/private_typeinfo.h (original) +++ libcxxabi/trunk/src/private_typeinfo.h Thu Dec 3 20:14:58 2015 @@ -10,53 +10,50 @@ #ifndef __PRIVATE_TYPEINFO_H_ #define __PRIVATE_TYPEINFO_H_ +#include "__cxxabi_config.h" + #include <typeinfo> #include <cstddef> namespace __cxxabiv1 { #pragma GCC visibility push(hidden) -class __attribute__((__visibility__("default"))) __shim_type_info - : public std::type_info { +class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__shim_type_info(); + _LIBCXXABI_HIDDEN virtual ~__shim_type_info(); - __attribute__((__visibility__("hidden"))) virtual void noop1() const; - __attribute__((__visibility__("hidden"))) virtual void noop2() const; - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *thrown_type, void *&adjustedPtr) const = 0; + _LIBCXXABI_HIDDEN virtual void noop1() const; + _LIBCXXABI_HIDDEN virtual void noop2() const; + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *thrown_type, + void *&adjustedPtr) const = 0; }; -class __attribute__((__visibility__("default"))) __fundamental_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __fundamental_type_info : public __shim_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__fundamental_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN virtual ~__fundamental_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__((__visibility__("default"))) __array_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __array_type_info : public __shim_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__array_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN virtual ~__array_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__((__visibility__("default"))) __function_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __function_type_info : public __shim_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__function_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN virtual ~__function_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__((__visibility__("default"))) __enum_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __enum_type_info : public __shim_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__enum_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN virtual ~__enum_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; enum @@ -68,7 +65,7 @@ enum no }; -class __attribute__((__visibility__("default"))) __class_type_info; +class _LIBCXXABI_TYPE_VIS __class_type_info; struct __dynamic_cast_info { @@ -118,43 +115,41 @@ struct __dynamic_cast_info }; // Has no base class -class __attribute__((__visibility__("default"))) __class_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __class_type_info : public __shim_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__class_type_info(); + _LIBCXXABI_HIDDEN virtual ~__class_type_info(); - __attribute__((__visibility__("hidden"))) void - process_static_type_above_dst(__dynamic_cast_info *, const void *, - const void *, int) const; - __attribute__((__visibility__("hidden"))) void - process_static_type_below_dst(__dynamic_cast_info *, const void *, int) const; - __attribute__((__visibility__("hidden"))) void - process_found_base_class(__dynamic_cast_info *, void *, int) const; - __attribute__((__visibility__("hidden"))) virtual void - search_above_dst(__dynamic_cast_info *, const void *, const void *, int, - bool) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN void process_static_type_above_dst(__dynamic_cast_info *, + const void *, + const void *, int) const; + _LIBCXXABI_HIDDEN void process_static_type_below_dst(__dynamic_cast_info *, + const void *, int) const; + _LIBCXXABI_HIDDEN void process_found_base_class(__dynamic_cast_info *, void *, + int) const; + _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, + const void *, const void *, + int, bool) const; + _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const; - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; + _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const; }; // Has one non-virtual public base class at offset zero -class __attribute__((__visibility__("default"))) __si_class_type_info - : public __class_type_info { +class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info { public: const __class_type_info *__base_type; - __attribute__((__visibility__("hidden"))) virtual ~__si_class_type_info(); + _LIBCXXABI_HIDDEN virtual ~__si_class_type_info(); - __attribute__((__visibility__("hidden"))) virtual void - search_above_dst(__dynamic_cast_info *, const void *, const void *, int, - bool) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, + const void *, const void *, + int, bool) const; + _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const; }; @@ -177,8 +172,7 @@ public: }; // Has one or more base classes -class __attribute__((__visibility__("default"))) __vmi_class_type_info - : public __class_type_info { +class _LIBCXXABI_TYPE_VIS __vmi_class_type_info : public __class_type_info { public: unsigned int __flags; unsigned int __base_count; @@ -191,19 +185,18 @@ public: // more derived objects }; - __attribute__((__visibility__("hidden"))) virtual ~__vmi_class_type_info(); + _LIBCXXABI_HIDDEN virtual ~__vmi_class_type_info(); - __attribute__((__visibility__("hidden"))) virtual void - search_above_dst(__dynamic_cast_info *, const void *, const void *, int, - bool) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, + const void *, const void *, + int, bool) const; + _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const; - __attribute__((__visibility__("hidden"))) virtual void + _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const; }; -class __attribute__((__visibility__("default"))) __pbase_type_info - : public __shim_type_info { +class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info { public: unsigned int __flags; const __shim_type_info *__pointee; @@ -216,32 +209,28 @@ public: __incomplete_class_mask = 0x10 }; - __attribute__((__visibility__("hidden"))) virtual ~__pbase_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; + _LIBCXXABI_HIDDEN virtual ~__pbase_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; }; -class __attribute__((__visibility__("default"))) __pointer_type_info - : public __pbase_type_info { +class _LIBCXXABI_TYPE_VIS __pointer_type_info : public __pbase_type_info { public: - __attribute__((__visibility__("hidden"))) virtual ~__pointer_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; - __attribute__((__visibility__("hidden"))) bool - can_catch_nested(const __shim_type_info *) const; + _LIBCXXABI_HIDDEN virtual ~__pointer_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; + _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const; }; -class __attribute__((__visibility__("default"))) __pointer_to_member_type_info +class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info : public __pbase_type_info { public: const __class_type_info *__context; - __attribute__(( - __visibility__("hidden"))) virtual ~__pointer_to_member_type_info(); - __attribute__((__visibility__("hidden"))) virtual bool - can_catch(const __shim_type_info *, void *&) const; - __attribute__((__visibility__("hidden"))) bool - can_catch_nested(const __shim_type_info *) const; + _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info(); + _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, + void *&) const; + _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const; }; #pragma GCC visibility pop _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits