#include "attrib.h" #include "gcc_includes.h" #include #include static std::unordered_set targets; static tree handle_spslr_attribute(tree* node, tree name, tree args, int flags, bool* no_add_attrs) { if (!node) return NULL_TREE; if (TREE_CODE(*node) != RECORD_TYPE) return *node; // Only allowed on structs tree type_name_tree = TYPE_IDENTIFIER(*node); if (type_name_tree == NULL_TREE) return *node; std::string name_str{ IDENTIFIER_POINTER(type_name_tree) }; targets.insert(name_str); return *node; } static struct attribute_spec spslr_attribute = { SPSRL_ATTRIBUTE, 0, 0, false, false, false, false, handle_spslr_attribute, NULL }; void register_attributes(void* event_data, void* data) { register_attribute(&spslr_attribute); } bool is_target(const char* name) { std::string str{ name }; return targets.find(str) != targets.end(); }