[libc++] Fix the LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT setting
When the __config_site header is generated, but LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
wasn't specified, _LIBCPP_HAS_MERGED_TYPEINFO_NAMES_DEFAULT would be defined
to 0, which was the NonUnique RTTI comparison implementation. The intent
was to use the Unique RTTI comparison implementation in that case, which
caused https://llvm.org/PR45549.
Instead, use a proper "switch" to select the RTTI comparison implementation.
Note that 0 can't be used as a value, because that is treated the same
by CMake as a variable that is just not defined.
Differential Revision: https://reviews.llvm.org/D80037
Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: d0fcdcd28f95d699b27d2026ede964a7f9cff9dd
diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst
index 262558e..0fbb669 100644
--- a/docs/BuildingLibcxx.rst
+++ b/docs/BuildingLibcxx.rst
@@ -380,18 +380,24 @@
See ``include/__config`` for the list of ABI macros.
-.. option:: LIBCXX_HAS_MERGED_TYPEINFO_NAMES_DEFAULT
+.. option:: LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION
- **Default**: ``None``. When defined this option overrides the libraries default configuration
- for whether merged type info names are present.
+ **Default**: ``None``, which lets the library figure out which implementation
+ to use based on the object format.
+
+ This setting defines what implementation to use for comparing typeinfo objects.
+ There are two main implementations, which differ on whether we make the assumption
+ that type info names for a type have been fully merged are unique across the entire
+ program. This may not be the case for libraries built with ``-Bsymbolic`` or due to
+ compiler or linker bugs (Ex. llvm.org/PR37398).
- Build ``std::type_info`` with the assumption that type info names for a type have been fully
- merged are unique across the entire program. This may not be the case for libraries built with
- ``-Bsymbolic`` or due to compiler or linker bugs (Ex. llvm.org/PR37398).
+ When the value is set to ``1``, we assume that typeinfos are unique across the
+ whole program, and typeinfo comparisons compare only the pointer value.
- When the value is ``ON`` typeinfo comparisons compare only the pointer value, otherwise ``strcmp``
- is used as a fallback.
+ When the value is set to ``2``, we do not assume that typeinfos are unique across
+ the whole program. We first compare the pointers, and then use ``strcmp`` on the
+ typeinfo names as a fallback.
.. _LLVM-specific variables: