diff options
| author | Louis Dionne <ldionne@apple.com> | 2018-10-29 17:30:04 +0000 |
|---|---|---|
| committer | Louis Dionne <ldionne@apple.com> | 2018-10-29 17:30:04 +0000 |
| commit | e9d85264ac4cdf505c7497612d3fe7630590c52f (patch) | |
| tree | 489fd2dbd3218bee162954d2c233dafe0413408a /libcxx/include | |
| parent | bfd32d437757d8015460cfed214eb61af85af88e (diff) | |
| download | bcm5719-llvm-e9d85264ac4cdf505c7497612d3fe7630590c52f.tar.gz bcm5719-llvm-e9d85264ac4cdf505c7497612d3fe7630590c52f.zip | |
[libc++] Use exclude_from_explicit_instantiation instead of always_inline
Summary:
This commit adopts the exclude_from_explicit_instantiation attribute discussed
at [1] and reviewed in [2] in libc++ to supplant the use of __always_inline__
for visibility purposes.
This change means that users wanting to link together translation units built
with different versions of libc++'s headers into the same final linked image
MUST define the _LIBCPP_HIDE_FROM_ABI_PER_TU macro to 1 when building those
TUs. Doing otherwise will lead to ODR violations and ABI issues.
[1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html
[2]: https://reviews.llvm.org/D51789
Reviewers: rsmith, EricWF
Subscribers: dexonsmith, libcxx-commits
Differential Revision: https://reviews.llvm.org/D52405
llvm-svn: 345516
Diffstat (limited to 'libcxx/include')
| -rw-r--r-- | libcxx/include/__config | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index f6020748e1b..6f133b678a0 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -787,6 +787,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD # define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE #endif +#if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) +#else + // Try to approximate the effect of exclude_from_explicit_instantiation + // (which is that entities are not assumed to be provided by explicit + // template instantitations in the dylib) by always inlining those entities. +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE +#endif + #ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU # ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT # define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 @@ -799,7 +808,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD # if _LIBCPP_HIDE_FROM_ABI_PER_TU # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE # else -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION # endif #endif |

