Import source to librtti

Summary:

- Import initial source

Test Plan:
NA
This commit is contained in:
Rongsong Shen 2026-01-29 17:22:53 +08:00
commit c8c1749347
23 changed files with 969 additions and 0 deletions

30
include/rtti/utils.h Normal file
View file

@ -0,0 +1,30 @@
#if !defined(_RTTI_UTILS_H_)
#define _RTTI_UTILS_H_ 1
#define RTTI_GET_METHOD(result, obj, intf, method) \
do { \
typeinfo_t* type_ = NULL; \
meta_obj_t* obj_ = NULL; \
\
(result) = NULL; \
\
if ((obj) == NULL) { \
break; \
} \
\
obj_ = DATA_TO_OBJ(obj); \
\
type_ = obj_->type; \
if (type_ == NULL) { \
break; \
} \
\
if (type_->interfaces.intf == NULL) { \
break; \
} \
\
(result) = type_->interfaces.intf->method; \
} while (0)
#endif