2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_UTIL_ABI_CXX_H_
17 #define incl_HPHP_UTIL_ABI_CXX_H_
24 //////////////////////////////////////////////////////////////////////
27 * Given a pointer to somewhere in a C++ function, returns that function's name
28 * or a hex string representation of the address if it can't find the
29 * function's name. Attempts to demangle C++ function names.
31 std::string
getNativeFunctionName(void* codeAddr
);
33 template<typename Ret
, typename
... Args
>
34 inline std::string
getNativeFunctionName(Ret (*ptr
)(Args
...)) {
35 return getNativeFunctionName(reinterpret_cast<void*>(ptr
));
39 * Get the vtable offset corresponding to a method pointer. NB: only works
40 * for single inheritance. For no inheritance at all, use
41 * getMethodPtr. ABI-specific, don't play on or around.
43 template <typename MethodPtr
>
44 int64_t getVTableOffset(MethodPtr meth
) {
53 template <typename MethodPtr
>
59 template <typename MethodPtr
>
60 constexpr void* getMethodPtr(MethodPtr meth
) {
61 return ((MethodPtrU
<MethodPtr
>*)(&meth
))->ptr
;
64 //////////////////////////////////////////////////////////////////////