[libc++] Towards a simpler extern template story in libc++
The flexibility around extern template instantiation declarations in
libc++ result in a very complicated model, especially when support for
slightly different configurations (like the debug mode or assertions
in the dylib) are taken into account. That results in unexpected bugs
like http://llvm.org/PR50534 (and there have been multiple similar
bugs in the past, notably around the debug mode).
This patch gets rid of the _LIBCPP_DISABLE_EXTERN_TEMPLATE knob, which
I don't think is fundamental. Indeed, the motivation for that knob was to
avoid taking a dependency on the library, however that can be done better
by linking against the static library instead. And in fact, some parts of
the headers will always depend on things defined in the library, which
defeats the original goal of _LIBCPP_DISABLE_EXTERN_TEMPLATE.
Differential Revision: https://reviews.llvm.org/D103960
NOKEYCHECK=True
GitOrigin-RevId: 2ae52326dab0a771b6167bc61a858389ac609ccc
diff --git a/docs/DesignDocs/VisibilityMacros.rst b/docs/DesignDocs/VisibilityMacros.rst
index e5aa500..a165fc4 100644
--- a/docs/DesignDocs/VisibilityMacros.rst
+++ b/docs/DesignDocs/VisibilityMacros.rst
@@ -130,7 +130,7 @@
**_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS**
Mark the member functions, typeinfo, and vtable of the type named in
- a `_LIBCPP_EXTERN_TEMPLATE` declaration as being exported by the libc++ library.
+ an extern template declaration as being exported by the libc++ library.
This attribute must be specified on all extern class template declarations.
This macro is used to override the `_LIBCPP_TEMPLATE_VIS` attribute
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index cb4691f..2042b35 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -120,6 +120,11 @@
the library has been built with support for the debug mode, and it will be
enabled automatically (no need to define ``_LIBCPP_DEBUG``).
+- The ``_LIBCPP_DISABLE_EXTERN_TEMPLATE`` macro is not honored anymore when defined by
+ users of libc++. Instead, users not wishing to take a dependency on libc++ should link
+ against the static version of libc++, which will result in no dependency being
+ taken against the shared library.
+
ABI Changes
-----------
diff --git a/docs/UsingLibcxx.rst b/docs/UsingLibcxx.rst
index 1f46f0a..55dbb36 100644
--- a/docs/UsingLibcxx.rst
+++ b/docs/UsingLibcxx.rst
@@ -225,11 +225,6 @@
build of libc++ which does not export any symbols, which can be useful when
building statically for inclusion into another library.
-**_LIBCPP_DISABLE_EXTERN_TEMPLATE**:
- This macro is used to disable extern template declarations in the libc++
- headers. The intended use case is for clients who wish to use the libc++
- headers without taking a dependency on the libc++ library itself.
-
**_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS**:
This macro disables the additional diagnostics generated by libc++ using the
`diagnose_if` attribute. These additional diagnostics include checks for: