Update private_typeinfo's `is_equal` implementation after r361913
The libc++ typeinfo implementation is being improved to better handle non-merged type names. This patch takes advantage of that more correct behavior by delegating to std::type_infos default operator== instead of doing pointer equality ourselves. However, libc++ still expects unique RTTI by default, and so we should still fall back to strcmp when explicitly requested. llvm-svn: 361916
This commit is contained in:
parent
99e040b3c9
commit
360ead7648
|
@ -58,14 +58,12 @@ static inline
|
||||||
bool
|
bool
|
||||||
is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
|
is_equal(const std::type_info* x, const std::type_info* y, bool use_strcmp)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
// Use std::type_info's default comparison unless we've explicitly asked
|
||||||
|
// for strcmp.
|
||||||
if (!use_strcmp)
|
if (!use_strcmp)
|
||||||
return x == y;
|
return *x == *y;
|
||||||
return strcmp(x->name(), y->name()) == 0;
|
// Still allow pointer equality to short circut.
|
||||||
#else
|
return x == y || strcmp(x->name(), y->name()) == 0;
|
||||||
(void) use_strcmp;
|
|
||||||
return (x == y) || (strcmp(x->name(), y->name()) == 0);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace __cxxabiv1
|
namespace __cxxabiv1
|
||||||
|
|
Loading…
Reference in New Issue