diff options
author | Shoaib Meenai <smeenai@fb.com> | 2017-03-02 03:22:18 +0000 |
---|---|---|
committer | Shoaib Meenai <smeenai@fb.com> | 2017-03-02 03:22:18 +0000 |
commit | 6b7349243eb2ba9c7875dd79833e5608ca6e0e13 (patch) | |
tree | fc72e0af9ef836c60789167ab6d7e0cf861b1a09 /docs | |
parent | 24e8dbdd2d8d6ce75681d0bc9579c72c5942fc92 (diff) |
[libc++] Make _LIBCPP_TYPE_VIS export members
Summary:
Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some
of their members exported, otherwise we have a lot of link errors when
linking against a libc++ built with hidden visibility. This also makes
_LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it
already exports members.
With this change made, any template methods of a class marked
_LIBCPP_TYPE_VIS will also get default visibility when instantiatied,
which is not desirable for clients of libc++ headers who wish to control
their visibility; this is the same issue as PR30642. Annotate all
problematic methods with an explicit visibility specifier to avoid this.
The problematic methods were found by running bad-visibility-finder [1]
against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The
small methods were marked for inlining; the larger ones hidden.
[1] https://github.com/smeenai/bad-visibility-finder
Reviewers: mclow.lists, EricWF
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25208
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@296732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/DesignDocs/VisibilityMacros.rst | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/DesignDocs/VisibilityMacros.rst b/docs/DesignDocs/VisibilityMacros.rst index 397dde3ee..694882dd2 100644 --- a/docs/DesignDocs/VisibilityMacros.rst +++ b/docs/DesignDocs/VisibilityMacros.rst @@ -47,18 +47,17 @@ Visibility Macros A synonym for `_LIBCPP_INLINE_VISIBILITY` **_LIBCPP_TYPE_VIS** + Mark a type's typeinfo, vtable and members as having default visibility. + This attribute cannot be used on class templates. + +**_LIBCPP_TEMPLATE_VIS** Mark a type's typeinfo and vtable as having default visibility. - `_LIBCPP_TYPE_VIS`. This macro has no effect on the visibility of the - type's member functions. This attribute cannot be used on class templates. + This macro has no effect on the visibility of the type's member functions. **GCC Behavior**: GCC does not support Clang's `type_visibility(...)` attribute. With GCC the `visibility(...)` attribute is used and member functions are affected. -**_LIBCPP_TEMPLATE_VIS** - The same as `_LIBCPP_TYPE_VIS` except that it may be applied to class - templates. - **Windows Behavior**: DLLs do not support dllimport/export on class templates. The macro has an empty definition on this platform. |