mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-14 14:56:47 +00:00
On Windows, typeids are different between DLLs and EXEs, so comparing
type_info* will work for typeids from the same compiled file but fail for typeids from a DLL and an executable. Among other things, exceptions are not caught by handlers since can_catch() returns false. Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls is_equal() with use_strcmp=false so the string names are not compared. This patch compares typeids first (cheap) and only they are different calls strcmp. llvm-svn: 195502
This commit is contained in:
parent
374c2bb37e
commit
7c6bb6500e
@ -40,6 +40,18 @@
|
||||
#include <sys/syslog.h>
|
||||
#endif
|
||||
|
||||
// On Windows, typeids are different between DLLs and EXEs, so comparing
|
||||
// type_info* will work for typeids from the same compiled file but fail
|
||||
// for typeids from a DLL and an executable. Among other things, exceptions
|
||||
// are not caught by handlers since can_catch() returns false.
|
||||
//
|
||||
// Defining _LIBCXX_DYNAMIC_FALLBACK does not help since can_catch() calls
|
||||
// is_equal() with use_strcmp=false so the string names are not compared.
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace __cxxabiv1
|
||||
{
|
||||
|
||||
@ -62,7 +74,11 @@ inline
|
||||
bool
|
||||
is_equal(const std::type_info* x, const std::type_info* y, bool)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return x == y;
|
||||
#else
|
||||
return (x == y) || (strcmp(x->name(), y->name()) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCXX_DYNAMIC_FALLBACK
|
||||
|
Loading…
x
Reference in New Issue
Block a user