PandA-2024.02
Macros
tree_node_factory.cpp File Reference

tree node factory. More...

#include "token_interface.hpp"
#include "ext_tree_node.hpp"
#include "tree_basic_block.hpp"
#include "tree_manager.hpp"
#include "tree_node.hpp"
#include "tree_node_factory.hpp"
#include "tree_reindex.hpp"
#include "utility.hpp"
Include dependency graph for tree_node_factory.cpp:

Go to the source code of this file.

Macros

#define CREATE_TREE_NODE_CASE_BODY(tree_node_name, node_id)
 parser/compiler include More...
 
#define ATTR_SEQ
 
#define ATTR_MACRO(r, data, elem)
 
#define SET_NODE_ID_OPT(token, field, type)
 
#define SET_NODE_ID(token, field, type)
 
#define SET_VALUE_OPT(token, field, type)
 
#define SET_VALUE(token, field, type)
 
#define TREE_NOT_YET_IMPLEMENTED(token)
 

Detailed Description

tree node factory.

This class, exploiting the visitor design pattern, add a tree node to the tree_manager.

Author
Fabrizio Ferrandi fabri.nosp@m.zio..nosp@m.ferra.nosp@m.ndi@.nosp@m.polim.nosp@m.i.it $Revision$ $Date$ Last modified by $Author$

Definition in file tree_node_factory.cpp.

Macro Definition Documentation

◆ ATTR_MACRO

#define ATTR_MACRO (   r,
  data,
  elem 
)
Value:
attr_p = tree_node_schema.find(TOK(elem)) != tree_node_schema.end(); \
if(attr_p) \
dynamic_cast<attr*>(curr_tree_node_ptr)->list_attr.insert(TOK(elem));
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
struct definition of the field attr on function_decl, field_decl, var_decl tree node.
Definition: tree_node.hpp:774

Referenced by tree_node_factory::create_tree_node().

◆ ATTR_SEQ

#define ATTR_SEQ
Value:
(TOK_NEW)(TOK_DELETE)(TOK_ASSIGN)(TOK_MEMBER)(TOK_PUBLIC)(TOK_PROTECTED)(TOK_PRIVATE)(TOK_NORETURN)(TOK_VOLATILE)( \
TOK_NOINLINE)(TOK_ALWAYS_INLINE)(TOK_USED)(TOK_UNUSED)(TOK_CONST)(TOK_TRANSPARENT_UNION)(TOK_CONSTRUCTOR)( \
TOK_DESTRUCTOR)(TOK_MODE)(TOK_SECTION)(TOK_ALIGNED)(TOK_WEAK)(TOK_ALIAS)(TOK_NO_INSTRUMENT_FUNCTION)( \
TOK_MALLOC)(TOK_NO_STACK_LIMIT)(TOK_PURE)(TOK_DEPRECATED)(TOK_VECTOR_SIZE)(TOK_VISIBILITY)(TOK_TLS_MODEL)( \
TOK_NONNULL)(TOK_NOTHROW)(TOK_MAY_ALIAS)(TOK_WARN_UNUSED_RESULT)(TOK_FORMAT)(TOK_FORMAT_ARG)(TOK_NULL)( \
TOK_GLOBAL_INIT)(TOK_GLOBAL_FINI)(TOK_CONVERSION)(TOK_VIRTUAL)(TOK_LSHIFT)(TOK_MUTABLE)(TOK_PSEUDO_TMPL)( \
TOK_VECNEW)(TOK_VECDELETE)(TOK_POS)(TOK_NEG)(TOK_ADDR)(TOK_DEREF)(TOK_LNOT)(TOK_NOT)(TOK_PREINC)(TOK_PREDEC)( \
TOK_PLUSASSIGN)(TOK_PLUS)(TOK_MINUSASSIGN)(TOK_MINUS)(TOK_MULTASSIGN)(TOK_MULT)(TOK_DIVASSIGN)(TOK_DIV)( \
TOK_MODASSIGN)(TOK_MOD)(TOK_ANDASSIGN)(TOK_AND)(TOK_ORASSIGN)(TOK_OR)(TOK_XORASSIGN)(TOK_XOR)( \
TOK_LSHIFTASSIGN)(TOK_RSHIFTASSIGN)(TOK_RSHIFT)(TOK_EQ)(TOK_NE)(TOK_LT)(TOK_GT)(TOK_LE)(TOK_GE)(TOK_LAND)( \
TOK_LOR)(TOK_COMPOUND)(TOK_MEMREF)(TOK_REF)(TOK_SUBS)(TOK_POSTINC)(TOK_POSTDEC)(TOK_CALL)(TOK_THUNK)( \
TOK_THIS_ADJUSTING)(TOK_RESULT_ADJUSTING)(TOK_BITFIELD)

Referenced by tree_node_factory::create_tree_node().

◆ CREATE_TREE_NODE_CASE_BODY

#define CREATE_TREE_NODE_CASE_BODY (   tree_node_name,
  node_id 
)
Value:
{ \
auto tnn = new tree_node_name(node_id); \
tree_nodeRef cur = tree_nodeRef(tnn); \
TM.AddTreeNode(node_id, cur); \
curr_tree_node_ptr = tnn; \
tnn->visit(this); \
curr_tree_node_ptr = nullptr; \
break; \
}
refcount< tree_node > tree_nodeRef
RefCount type definition of the tree_node class structure.
Definition: tree_node.hpp:212

parser/compiler include

tree includes

Definition at line 56 of file tree_node_factory.cpp.

Referenced by tree_node_factory::create_tree_node().

◆ SET_NODE_ID

#define SET_NODE_ID (   token,
  field,
  type 
)
Value:
{ \
THROW_ASSERT(tree_node_schema.find(TOK(token)) != tree_node_schema.end(), \
std::string("tree_node_schema must have ") + STOK(token) + " value"); \
auto node_id = static_cast<unsigned>(std::stoul(tree_node_schema.find(TOK(token))->second)); \
dynamic_cast<type*>(curr_tree_node_ptr)->field = TM.GetTreeReindex(node_id); \
}
#define STOK(token)
Macro used to convert a token symbol into the corresponding string.
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.

Definition at line 664 of file tree_node_factory.cpp.

◆ SET_NODE_ID_OPT

#define SET_NODE_ID_OPT (   token,
  field,
  type 
)
Value:
if(tree_node_schema.find(TOK(token)) != tree_node_schema.end()) \
{ \
auto node_id = static_cast<unsigned>(std::stoul(tree_node_schema.find(TOK(token))->second)); \
dynamic_cast<type*>(curr_tree_node_ptr)->field = TM.GetTreeReindex(node_id); \
}
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.

Definition at line 657 of file tree_node_factory.cpp.

◆ SET_VALUE

#define SET_VALUE (   token,
  field,
  type 
)
Value:
THROW_ASSERT(tree_node_schema.find(TOK(token)) != tree_node_schema.end(), \
std::string("tree node schema must have ") + STOK(token) + " value"); \
dynamic_cast<type*>(curr_tree_node_ptr)->field = \
boost::lexical_cast<decltype(type::field)>(tree_node_schema.find(TOK(token))->second);
#define STOK(token)
Macro used to convert a token symbol into the corresponding string.
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

Definition at line 679 of file tree_node_factory.cpp.

◆ SET_VALUE_OPT

#define SET_VALUE_OPT (   token,
  field,
  type 
)
Value:
if(tree_node_schema.find(TOK(token)) != tree_node_schema.end()) \
{ \
dynamic_cast<type*>(curr_tree_node_ptr)->field = \
boost::lexical_cast<decltype(type::field)>(tree_node_schema.find(TOK(token))->second); \
}
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.

Definition at line 672 of file tree_node_factory.cpp.

◆ TREE_NOT_YET_IMPLEMENTED

#define TREE_NOT_YET_IMPLEMENTED (   token)
Value:
THROW_ASSERT(tree_node_schema.find(TOK(token)) == tree_node_schema.end(), \
std::string("field not yet supported ") + STOK(token))
#define STOK(token)
Macro used to convert a token symbol into the corresponding string.
#define TOK(token)
Macro used to convert a token symbol into a treeVocabularyTokenTypes.
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Definition: exceptions.hpp:289

Definition at line 685 of file tree_node_factory.cpp.


Generated on Mon Feb 12 2024 13:03:34 for PandA-2024.02 by doxygen 1.8.13