[libc++abi] Add _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS

It's useful to be able to disable visibility annotations entirely; for
example, if we're building libc++abi static to include in another library,
and we don't want any libc++abi functions getting exported out of that
library. This is a generalization of _LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT.

Differential Revision: https://reviews.llvm.org/D26950

llvm-svn: 288692
This commit is contained in:
Shoaib Meenai 2016-12-05 19:42:11 +00:00
parent 07522bb187
commit 1bc40a8e2d
1 changed files with 14 additions and 7 deletions

View File

@ -22,7 +22,7 @@
#endif
#if defined(_WIN32)
#if defined(_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT)
#if defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
#define _LIBCXXABI_HIDDEN
#define _LIBCXXABI_DATA_VIS
#define _LIBCXXABI_FUNC_VIS
@ -39,13 +39,20 @@
#define _LIBCXXABI_TYPE_VIS __declspec(dllimport)
#endif
#else
#define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
#define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
#define _LIBCXXABI_FUNC_VIS __attribute__((__visibility__("default")))
#if __has_attribute(__type_visibility__)
#define _LIBCXXABI_TYPE_VIS __attribute__((__type_visibility__("default")))
#if !defined(_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS)
#define _LIBCXXABI_HIDDEN __attribute__((__visibility__("hidden")))
#define _LIBCXXABI_DATA_VIS __attribute__((__visibility__("default")))
#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
#else
#define _LIBCXXABI_TYPE_VIS __attribute__((__visibility__("default")))
#define _LIBCXXABI_HIDDEN
#define _LIBCXXABI_DATA_VIS
#define _LIBCXXABI_FUNC_VIS
#define _LIBCXXABI_TYPE_VIS
#endif
#endif