1 #ifndef abstract_handle_INCLUDED
2 #define abstract_handle_INCLUDED
12 #include "rose_msvc.h"
20 #if defined(__APPLE__) && defined(__MACH__)
23 #include<linux/limits.h>
83 typedef enum {e_name, e_position, e_numbering, e_int_label, e_str_label}
88 char str_v[PATH_MAX+256];
105 std::string toString();
134 virtual std::string
getName()
const;
145 #pragma message ("WARNING: MSVC does not handle covariant return types properly.")
147 virtual void *
getNode()
const {
return NULL;};
158 virtual std::string getFileName()
const;
164 virtual std::string toString()
const;
210 virtual ~
abstract_handle() {
if (m_specifier !=NULL)
delete m_specifier;}
213 virtual std::string get_construct_type_name();
216 virtual std::string toString();
222 virtual std::string toStringSelf();
225 virtual void fromStringSelf(
abstract_handle* p_handle,
const std::string& handle_str_item);
232 void set_parent_handle(abstract_handle* parent){ parent_handle= parent;}
237 {
return m_node == x.getNode();}
257 extern std::map<abstract_node*, abstract_handle*>
handle_map;
virtual std::string getName() const
Get the name of the construct if it is named, like function name.
virtual bool hasSourcePos() const
If the node has meaningful line and column numbers associated with a file.
virtual std::string getConstructTypeName() const
Get the construct' s type name, like function.
virtual bool hasName() const
If the node has legal names defined by language standards.
virtual abstract_node * getParent() const
Get parent node, used for generate parent handle automatically.
specifier_type_t
specifier type and values
virtual size_t getIntLabel() const
Get integer label.
virtual std::string getStringLabel() const
Get string label.
virtual void * getNode() const
Get the raw IR node associated with the current abstract node.
Users should provide a concrete node implementation especially a constructor/builder to avoid duplica...
to specify a construct using a specifier Can be used alone or with parent handles when relative speci...
std::map< abstract_node *, abstract_handle * > handle_map
maintain a map between nodes and handles, used for fast indexing and avoid redundant creation of hand...
construct specifier could be used to specify a construct by name, position, numbering,...
virtual abstract_node * getFileNode() const
Get the start source file position of the construct Get the abstract node for file containing the cur...
void fromString(source_position &, const std::string &input)
Parse a string (such as 12.10, 13, 0 etc )into source position data structure.
specifier * get_specifier()
allow multiple specifiers or not?
virtual size_t getNumbering(const abstract_node *another_node) const
Get the ordering of the construct relative to another construct in a higher scope Numbering start fro...
virtual abstract_node * findNode(std::string handle_str) const
Find a node from a string for a abstract handle's string format, starting from this node eg.
source position information:
String annotations to uniquely indicate any source constructs.