Commit 7063a736 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

fake the libcxxabi type-info shim

Summary: The actual shim type may sometimes not be linkable. So fake it - as long as the vtable is the same, it should not make a difference.

Reviewed By: luciang

Differential Revision: D28216291

fbshipit-source-id: 8c493a207cfb5414684147ddb850835bc0965bc5
parent 62c4eb40
...@@ -77,14 +77,16 @@ struct _LIBCXXABI_HIDDEN __cxa_exception { ...@@ -77,14 +77,16 @@ struct _LIBCXXABI_HIDDEN __cxa_exception {
_Unwind_Exception unwindHeader; _Unwind_Exception unwindHeader;
}; };
class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info { // named differently from the real shim type __shim_type_info and all members
// are pure virtual; as long as the vtable is the same, though, it should work
class __folly_shim_type_info : public std::type_info {
public: public:
_LIBCXXABI_HIDDEN virtual ~__shim_type_info(); virtual ~__folly_shim_type_info() = 0;
_LIBCXXABI_HIDDEN virtual void noop1() const; virtual void noop1() const = 0;
_LIBCXXABI_HIDDEN virtual void noop2() const; virtual void noop2() const = 0;
_LIBCXXABI_HIDDEN virtual bool can_catch( virtual bool can_catch(
const __shim_type_info* thrown_type, void*& adjustedPtr) const = 0; const std::type_info* thrown_type, void*& adjustedPtr) const = 0;
}; };
} // namespace __cxxabiv1 } // namespace __cxxabiv1
...@@ -157,9 +159,8 @@ void* exception_ptr_get_object( ...@@ -157,9 +159,8 @@ void* exception_ptr_get_object(
} }
auto object = cxxabi_get_object(ptr); auto object = cxxabi_get_object(ptr);
auto type = exception_ptr_get_type(ptr); auto type = exception_ptr_get_type(ptr);
auto stype = static_cast<abi::__shim_type_info const*>(type); auto starget = static_cast<abi::__folly_shim_type_info const*>(target);
auto starget = static_cast<abi::__shim_type_info const*>(target); return !target || starget->can_catch(type, object) ? object : nullptr;
return !target || starget->can_catch(stype, object) ? object : nullptr;
} }
#endif // defined(_LIBCPP_VERSION) #endif // defined(_LIBCPP_VERSION)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment