summaryrefslogtreecommitdiffstats
path: root/libcxx/docs/DesignDocs
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2016-10-12 13:48:14 +0000
committerShoaib Meenai <smeenai@fb.com>2016-10-12 13:48:14 +0000
commit9f50fffc0487b74b1828afc4f63d2a8df586df51 (patch)
tree7442a8436e2e98a785225667c1b7743ec4bad9e8 /libcxx/docs/DesignDocs
parent08190943cb62415df6357bed412479c5d94f0ea3 (diff)
downloadbcm5719-llvm-9f50fffc0487b74b1828afc4f63d2a8df586df51.tar.gz
bcm5719-llvm-9f50fffc0487b74b1828afc4f63d2a8df586df51.zip
[libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
The behavior of this macro actually needs to apply universally on Windows and not just when using the Microsoft CRT. Update the macro definition and documentation accordingly. Differential Revision: https://reviews.llvm.org/D25145 llvm-svn: 284016
Diffstat (limited to 'libcxx/docs/DesignDocs')
-rw-r--r--libcxx/docs/DesignDocs/VisibilityMacros.rst17
1 files changed, 9 insertions, 8 deletions
diff --git a/libcxx/docs/DesignDocs/VisibilityMacros.rst b/libcxx/docs/DesignDocs/VisibilityMacros.rst
index f45d67b17ea..67886e392ae 100644
--- a/libcxx/docs/DesignDocs/VisibilityMacros.rst
+++ b/libcxx/docs/DesignDocs/VisibilityMacros.rst
@@ -112,14 +112,15 @@ Visibility Macros
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.
+ **Windows Behavior**: The `operator new` and `operator delete` overloads
+ should not be marked as `dllimport`; if they were, source files including the
+ `<new>` header (either directly or transitively) would lose the ability to use
+ local overloads of `operator new` and `operator delete`. On Windows, this
+ macro therefore expands to `__declspec(dllexport)` when building the library
+ and has an empty definition otherwise. A related caveat is that libc++ must be
+ included on the link line before `msvcrt.lib`, otherwise Microsoft's
+ definitions of `operator new` and `operator delete` inside `msvcrt.lib` will
+ end up being used instead of libc++'s.
Links
=====
OpenPOWER on IntegriCloud