Add sub-controls for Hack array compat runtime checks
[hiphop-php.git] / hphp / runtime / base / member-reflection.h
blob22233e9b818e2a5457d515c92454222aff6c2d48
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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 +----------------------------------------------------------------------+
17 #ifndef incl_HPHP_MEMBER_REFLECTION_H_
18 #define incl_HPHP_MEMBER_REFLECTION_H_
20 #include "hphp/runtime/base/mixed-array.h"
22 namespace HPHP {
24 ///////////////////////////////////////////////////////////////////////////////
26 #define HPHP_REFLECTABLES_UNQ \
27 X(TypedValue)\
28 /* vm metadata */\
29 X(Func)\
30 X(Class)\
31 /* arrays */\
32 X(ArrayData)\
33 X(MixedArray)\
34 X(EmptyArray)\
35 X(APCLocalArray)\
36 X(GlobalsArray)\
37 /* other php types */\
38 X(StringData)\
39 X(ObjectData)\
40 X(ResourceData)\
41 X(RefData)\
42 /* collections */\
43 X(c_Pair)\
44 X(BaseVector)\
45 X(HashCollection)\
46 /* */
48 #define HPHP_REFLECTABLES \
49 HPHP_REFLECTABLES_UNQ\
50 X(MixedArray::Elm)\
51 /* */
53 #define X(name) struct name;
54 HPHP_REFLECTABLES_UNQ
55 #undef X
57 ///////////////////////////////////////////////////////////////////////////////
60 * Initialize the module by dynamically linking in generated code.
62 * Returns true on success, else false.
64 bool init_member_reflection();
67 * Given an object pointer `base' and an internal pointer `internal' for
68 * `base', get the name of the data member referred to by `internal'.
70 * Returns nullptr if reflection is not supported for the base type, or if the
71 * internal pointer is invalid.
73 #define X(name) \
74 const char* nameof_member(const HPHP::name* base, const void* internal);
75 HPHP_REFLECTABLES
76 #undef X
78 template <typename T>
79 const char* nameof_member(const T* /*base*/, const void* /*internal*/) {
80 return nullptr;
83 ///////////////////////////////////////////////////////////////////////////////
85 namespace detail {
87 constexpr const char* const kMemberReflectionTableName =
88 "g_member_reflection_vtable_impl";
92 ///////////////////////////////////////////////////////////////////////////////
96 #endif