[PATCH] D29157: [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export members

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 25 16:20:18 PST 2017


smeenai created this revision.

When building libc++ with hidden visibility, we want explicit template
instantiations to export members. This is consistent with existing
Windows behavior, and is necessary for clients to be able to link
against a hidden visibility built libc++ without running into lots of
missing symbols.

An unfortunate side effect, however, is that any template methods of a
class with an explicit instantiation will get default visibility when
instantiated, unless the methods are explicitly marked inline or hidden
visibility. This is not desirable for clients of libc++ headers who wish
to control their visibility, and led to PR30642.

Annotate all problematic methods with an explicit visibility specifier
to avoid this. The problematic methods were found by running
https://github.com/smeenai/bad-visibility-finder against the libc++
headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The
small methods were marked for inlining; the larger ones hidden.

It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally
intended to expand to default visibility, and was changed to expanding
to default type visibility to fix PR30642. The visibility macro
documentation was not updated accordingly, however, so this change makes
the macro consistent with its documentation again, while explicitly
fixing the methods which resulted in that PR.


https://reviews.llvm.org/D29157

Files:
  include/__config
  include/locale
  include/string

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29157.85833.patch
Type: text/x-patch
Size: 5098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170126/d70a4c88/attachment-0001.bin>


More information about the cfe-commits mailing list