[PATCH] D54810: [libcxx] Apply namespace-scope hidden visibility to libc++

Louis Dionne via Phabricator reviews at reviews.llvm.org
Wed Nov 21 13:28:12 PST 2018


ldionne created this revision.
ldionne added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.

This is technically not a functional change because all symbols that
should be exported from the shared library are already marked with
explicit visibility annotations. However, applying this attribute
at the namespace scope will allow us to drop many visibility
annotations in the future, which is a nice simplification.

This commit also solves the problem of different symbols being exported
depending on the build mode in use (see PR38138). With this change, stray
symbols are not exported from the dylib due to implicit instantiations,
and as a result we export the same symbols in Debug and Release modes.


Repository:
  rCXX libc++

https://reviews.llvm.org/D54810

Files:
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -793,7 +793,7 @@
 #define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
 
 // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
-#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE {
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std _LIBCPP_HIDDEN { inline namespace _LIBCPP_ABI_NAMESPACE {
 #define _LIBCPP_END_NAMESPACE_STD  } }
 #define _VSTD std::_LIBCPP_ABI_NAMESPACE
 _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54810.174974.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181121/72c7469b/attachment.bin>


More information about the libcxx-commits mailing list