Hi mclow.lists, danalbert, chandlerc, rsmith,

Currently functions and types that are pure implementation must be individually 
annotated with a DSO visibility attribute. This requires tedious repetition and 
is prone to errors.

As it stands there are a number of symbols within libc++ that do not have a 
visibility attribute. These symbols may or may be compiled into the DSO 
depending on the compilation flags. This leads to the DSO providing an unstable 
and unmanageable set of symbols.

This patch creates a nested namespace `__libcpp_internal` that sets the 
visibility to "hidden" for all symbols within it. Classes and functions that 
are pure implementation details should live within this namespace. This way the 
symbols don't have to be individually annotated. 

Slowly but surely symbols should be moved to this namespace. Migrating code 
into this namespace will be tricky. We will have to ensure that no platform 
already ships a DSO that contains the candidate symbols.

http://reviews.llvm.org/D8652

Files:
  include/__config

Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -554,6 +554,15 @@
 
 #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
 
+#define _LIBCPP_BEGIN_NAMESPACE_INTERNAL namespace __libcpp_internal 
_LIBCPP_HIDDEN {
+#define _LIBCPP_END_NAMESPACE_INTERNAL }
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+  _LIBCPP_BEGIN_NAMESPACE_INTERNAL
+  _LIBCPP_END_NAMESPACE_INTERNAL
+  using namespace __libcpp_internal;
+_LIBCPP_END_NAMESPACE_STD
+
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
 typedef unsigned short char16_t;
 typedef unsigned int   char32_t;

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -554,6 +554,15 @@
 
 #endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
 
+#define _LIBCPP_BEGIN_NAMESPACE_INTERNAL namespace __libcpp_internal _LIBCPP_HIDDEN {
+#define _LIBCPP_END_NAMESPACE_INTERNAL }
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+  _LIBCPP_BEGIN_NAMESPACE_INTERNAL
+  _LIBCPP_END_NAMESPACE_INTERNAL
+  using namespace __libcpp_internal;
+_LIBCPP_END_NAMESPACE_STD
+
 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
 typedef unsigned short char16_t;
 typedef unsigned int   char32_t;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to