ROSE  0.11.96.11
Classes | Typedefs | Enumerations | Functions | Variables
AbstractHandle Namespace Reference

Description

String annotations to uniquely indicate any source constructs.

A reference implementation of abstract handles for language constructs Used for specifying a unique language construct in source files.

Users are required to implement the interface using their own IR node types.

Goal : Only define interfaces and abstract implementation independent to any particular compilers or tools

We provide ROSE's implementation.

Essentially, you can use a string to uniquely specify any language constructs in your source code and convert the string to AST node.

This is useful to pass string options to translators so they can operate on the desired language constructs (e.g. for loops)

Example use in outliner: outline the for loop at line 12 of the input code ./outline -rose:outline:abstract_handle "ForStatement<position,12>" -c inputCode_OutlineLoop2.c Outline the 2nd for statement of the input code

./outline -rose:outline:abstract_handle "FunctionDeclaration<name,initialize>::ForStatement<numbering,2>" -c inputCode_OutlineLoop2.c Outline the statement at line 5 of the input code ./outline -rose:outline:abstract_handle "Statement<position,5>" -c declarations.c

Classes

class  abstract_handle
 to specify a construct using a specifier Can be used alone or with parent handles when relative specifiers are used More...
 
class  abstract_node
 Users should provide a concrete node implementation especially a constructor/builder to avoid duplicated creation of abstract_node. More...
 
class  roseNode
 Concrete roseNode derived from abstract_node. More...
 
struct  source_position
 source position information: More...
 
struct  source_position_pair
 
class  specifier
 construct specifier could be used to specify a construct by name, position, numbering, labels, etc (e_name, foo) (e_position, 15) More...
 
union  u_specifier_value
 

Typedefs

typedef union AbstractHandle::u_specifier_value specifier_value_t
 

Enumerations

enum  specifier_type_t {
  e_name,
  e_position,
  e_numbering,
  e_int_label,
  e_str_label
}
 specifier type and values
 

Functions

std::string toString (const source_position &)
 
std::string toString (const source_position_pair &)
 
bool isEqual (const source_position &pos1, const source_position &pos2)
 
bool isEqual (const source_position_pair &pair1, const source_position_pair &pair2)
 
void fromString (source_position &, const std::string &input)
 Parse a string (such as 12.10, 13, 0 etc )into source position data structure.
 
void fromString (source_position_pair &, const std::string &input)
 Parse a string into source position pair data structure.
 
void fromString (specifier &, const std::string &input)
 
ROSE_DLL_API roseNodebuildroseNode (SgNode *snode)
 A builder function to avoid duplicated building.
 
ROSE_DLL_API abstract_handlebuildAbstractHandle (SgNode *snode)
 A default builder function handles all details: file use name, others use numbering

 
ROSE_DLL_API SgLocatedNodeconvertHandleToNode (const std::string &handle)
 Convert an abstract handle string to a located node in AST.
 

Variables

std::map< abstract_node *, abstract_handle * > handle_map
 maintain a map between nodes and handles, used for fast indexing and avoid redundant creation of handles for nodes Should update the map after each creation