This revision was automatically updated to reflect the committed changes.
Closed by commit rL282644: [libc++] Clarify _LIBCPP_NEW_DELETE_VIS for Windows 
(authored by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D25042?vs=72911&id=72915#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25042

Files:
  libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
  libcxx/trunk/include/new

Index: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
===================================================================
--- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
+++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
@@ -108,6 +108,19 @@
   versioning namespace. This allows throwing and catching some exception types
   between libc++ and libstdc++.
 
+**_LIBCPP_NEW_DELETE_VIS**
+  Mark a symbol as being exported by the libc++ library. This macro must be
+  applied to all `operator new` and `operator delete` overloads.
+
+  **Windows Behavior**: When using the Microsoft CRT, all the `operator new` 
and
+  `operator delete` overloads are defined statically in `msvcrt.lib`. Marking
+  them as `dllimport` in the libc++ `<new>` header is therefore undesirable: if
+  we were to mark them as `dllimport` and then link against libc++, source 
files
+  which included `<new>` would end up linking against libc++'s `operator new`
+  and `operator delete`, while source files which did not include `<new>` would
+  end up linking against msvcrt's `operator new` and `operator delete`, which
+  would be a confusing and potentially error-prone inconsistency.
+
 Links
 =====
 
Index: libcxx/trunk/include/new
===================================================================
--- libcxx/trunk/include/new
+++ libcxx/trunk/include/new
@@ -125,8 +125,8 @@
 
 }  // std
 
-#if defined(_WIN32) && !defined(cxx_EXPORTS)
-# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
+#if defined(_LIBCPP_MSVCRT) && !defined(_LIBCPP_BUILDING_LIBRARY)
+# define _LIBCPP_NEW_DELETE_VIS
 #else
 # define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
 #endif


Index: libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
===================================================================
--- libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
+++ libcxx/trunk/docs/DesignDocs/VisibilityMacros.rst
@@ -108,6 +108,19 @@
   versioning namespace. This allows throwing and catching some exception types
   between libc++ and libstdc++.
 
+**_LIBCPP_NEW_DELETE_VIS**
+  Mark a symbol as being exported by the libc++ library. This macro must be
+  applied to all `operator new` and `operator delete` overloads.
+
+  **Windows Behavior**: When using the Microsoft CRT, all the `operator new` and
+  `operator delete` overloads are defined statically in `msvcrt.lib`. Marking
+  them as `dllimport` in the libc++ `<new>` header is therefore undesirable: if
+  we were to mark them as `dllimport` and then link against libc++, source files
+  which included `<new>` would end up linking against libc++'s `operator new`
+  and `operator delete`, while source files which did not include `<new>` would
+  end up linking against msvcrt's `operator new` and `operator delete`, which
+  would be a confusing and potentially error-prone inconsistency.
+
 Links
 =====
 
Index: libcxx/trunk/include/new
===================================================================
--- libcxx/trunk/include/new
+++ libcxx/trunk/include/new
@@ -125,8 +125,8 @@
 
 }  // std
 
-#if defined(_WIN32) && !defined(cxx_EXPORTS)
-# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
+#if defined(_LIBCPP_MSVCRT) && !defined(_LIBCPP_BUILDING_LIBRARY)
+# define _LIBCPP_NEW_DELETE_VIS
 #else
 # define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
 #endif
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to