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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@254691 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/src/cxa_aux_runtime.cpp b/src/cxa_aux_runtime.cpp
index ad68e61..a455fad 100644
--- a/src/cxa_aux_runtime.cpp
+++ b/src/cxa_aux_runtime.cpp
@@ -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"
diff --git a/src/cxa_demangle.cpp b/src/cxa_demangle.cpp
index b6388ab..04dc711 100644
--- a/src/cxa_demangle.cpp
+++ b/src/cxa_demangle.cpp
@@ -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 @@
 
 }  // 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))
     {
diff --git a/src/cxa_exception.cpp b/src/cxa_exception.cpp
index 0767ab4..a8216df 100644
--- a/src/cxa_exception.cpp
+++ b/src/cxa_exception.cpp
@@ -156,7 +156,7 @@
 //  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 @@
 
 
 //  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 @@
 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 @@
 
   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 @@
 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 @@
 * 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 @@
 // 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 @@
   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 @@
 
     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 @@
 
     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 @@
     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)
diff --git a/src/cxa_guard.cpp b/src/cxa_guard.cpp
index 041797c..72e868f 100644
--- a/src/cxa_guard.cpp
+++ b/src/cxa_guard.cpp
@@ -7,6 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "__cxxabi_config.h"
+
 #include "abort_message.h"
 #include "config.h"
 
@@ -167,22 +169,22 @@
 {
 
 #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 @@
     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 @@
         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;
diff --git a/src/cxa_thread_atexit.cpp b/src/cxa_thread_atexit.cpp
index 5960bed..7962e28 100644
--- a/src/cxa_thread_atexit.cpp
+++ b/src/cxa_thread_atexit.cpp
@@ -14,8 +14,8 @@
 
 #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);
 }
diff --git a/src/cxa_vector.cpp b/src/cxa_vector.cpp
index 56e7096..c32a211 100644
--- a/src/cxa_vector.cpp
+++ b/src/cxa_vector.cpp
@@ -114,9 +114,9 @@
 // 
 //   __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 @@
 // 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 @@
 
 // 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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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 @@
 // 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;
diff --git a/src/cxa_virtual.cpp b/src/cxa_virtual.cpp
index 0da383a..ac81ad3 100644
--- a/src/cxa_virtual.cpp
+++ b/src/cxa_virtual.cpp
@@ -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!");
 }
diff --git a/src/private_typeinfo.h b/src/private_typeinfo.h
index 43d4768..ef98c3a 100644
--- a/src/private_typeinfo.h
+++ b/src/private_typeinfo.h
@@ -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 @@
     no
 };
 
-class __attribute__((__visibility__("default"))) __class_type_info;
+class _LIBCXXABI_TYPE_VIS __class_type_info;
 
 struct __dynamic_cast_info
 {
@@ -118,43 +115,41 @@
 };
 
 // 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 @@
 };
 
 // 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 @@
                                      //    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 @@
     __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