ROSE  0.11.96.11
Functions
Rose::AST::IO Namespace Reference

Description

Function used to load, merge, prune, link, delete.

Functions

ROSE_DLL_API void load (SgProject *project, std::list< std::string > const &filepaths)
 Load ASTs that have been saved to files. More...
 
ROSE_DLL_API void merge (SgProject *project)
 Performs sharing of AST nodes followed by linking accross translation units. More...
 
ROSE_DLL_API void share (SgProject *project)
 Eliminates duplicated nodes from the AST. More...
 
ROSE_DLL_API void prune (SgProject *project)
 Removes nodes that are not reachable from the project node. More...
 
ROSE_DLL_API void link (SgProject *project)
 Links declarations from multiple translation units. More...
 
ROSE_DLL_API void clear ()
 Empties the memory pool of all nodes.
 
ROSE_DLL_API void free ()
 Delete all memory allocated by ROSE.
 

Function Documentation

◆ load()

ROSE_DLL_API void Rose::AST::IO::load ( SgProject project,
std::list< std::string > const &  filepaths 
)

Load ASTs that have been saved to files.

Parameters
projectthe project to which the files will be happened
filepathsa std::list of path to AST files

This function happens the content of each AST file to the given project. It is used by the command line option: -rose:ast:read. This function will leave the AST in an inconsistent state and Rose::AST::merge must be run to fix it.

◆ merge()

ROSE_DLL_API void Rose::AST::IO::merge ( SgProject project)

Performs sharing of AST nodes followed by linking accross translation units.

Parameters
projectThis function is mainly used after loading ASTs from files. It is used by the command line option: -rose:ast:read and -rose:ast:merge. It simply calls three functions in sequence: Rose::AST::share, Rose::AST::prune, and Rose::AST::link. It also provides statistics if Rose is in verbose > 0.

◆ share()

ROSE_DLL_API void Rose::AST::IO::share ( SgProject project)

Eliminates duplicated nodes from the AST.

Parameters
projectThis function is mainly used when two or more translation units are merged together. Particularly, the ASTs of header files is duplicated when included from different translation-units.

◆ prune()

ROSE_DLL_API void Rose::AST::IO::prune ( SgProject project)

Removes nodes that are not reachable from the project node.

Parameters
projectThis function is mainly used after sharing redundant nodes. It can also be useful to clean-up after transfortions.

◆ link()

ROSE_DLL_API void Rose::AST::IO::link ( SgProject project)

Links declarations from multiple translation units.

Parameters
projectThis function provide functionalities similar to a linker in a compiler toolchain. It links forward declarations and definitions of variables, functions, classes, etc.