[PATCH] D25208: [libc++] Make _LIBCPP_TYPE_VIS export members

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 12:29:48 PDT 2016


smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.

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.


https://reviews.llvm.org/D25208

Files:
  docs/DesignDocs/VisibilityMacros.rst
  include/__config


Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -560,15 +560,15 @@
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS
-#  if __has_attribute(__type_visibility__)
-#    define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
-#  else
-#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-#  endif
+#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
 #endif
 
 #ifndef _LIBCPP_TYPE_VIS_ONLY
-# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
+#  if __has_attribute(__type_visibility__)
+#    define _LIBCPP_TYPE_VIS_ONLY __attribute__ ((__type_visibility__("default")))
+#  else
+#    define _LIBCPP_TYPE_VIS_ONLY __attribute__ ((__visibility__("default")))
+#  endif
 #endif
 
 #ifndef _LIBCPP_FUNC_VIS_ONLY
Index: docs/DesignDocs/VisibilityMacros.rst
===================================================================
--- docs/DesignDocs/VisibilityMacros.rst
+++ docs/DesignDocs/VisibilityMacros.rst
@@ -29,17 +29,17 @@
   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_TYPE_VIS_ONLY**
   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_TYPE_VIS_ONLY**
-  The same as `_LIBCPP_TYPE_VIS` except that it may be applied to templates.
-
   **Windows Behavior**: DLLs do not support dllimport/export on class templates.
   The macro has an empty definition on this platform.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25208.73323.patch
Type: text/x-patch
Size: 1996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161003/5da0c083/attachment.bin>


More information about the cfe-commits mailing list