PUMA Library Reference Manual
Puma::CTranslationUnit Class Reference

#include <Puma/CTranslationUnit.h>

Description

Abstraction of a translation unit.

A translation unit is a single implementation file that a compiler can translate to an object file. In particular it contains all the code from included header files.

A translation unit is created by the parser (see Puma::Parser). It encapsulates the input file and the parse results (syntax trees, semantic database). When it is destroyed, it also destroys the parse results.

Public Member Functions

 CTranslationUnit (Unit &u, CProject &p)
 Constructor. More...
 
 ~CTranslationUnit ()
 Destructor. More...
 
void tree (CTree *t)
 Set the C/C++ syntax tree. More...
 
void cpp_tree (PreTree *t)
 Set the preprocessor syntax tree. More...
 
CTreetree () const
 Get the C/C++ syntax tree. More...
 
PreTreecpp_tree () const
 Get the C preprocessor syntax tree. More...
 
Unitunit () const
 Get the token unit of the input file. More...
 
CSemDatabasedb () const
 Get the semantic information database. More...
 
UnitManagerlocal_units () const
 Get the unit manager for local units (macro expansions etc). More...
 

Constructor & Destructor Documentation

Puma::CTranslationUnit::CTranslationUnit ( Unit u,
CProject p 
)
inline

Constructor.

Parameters
uThe token unit of the input file.
pThe project information object.
Puma::CTranslationUnit::~CTranslationUnit ( )

Destructor.

Destroys the C/C++ syntax tree and the preprocessor syntax tree. The semantic information objects are destroyed when the semantic database member object is destroyed. If this is a template instance translation unit then destroy the unit too.

Member Function Documentation

void Puma::CTranslationUnit::cpp_tree ( PreTree t)
inline

Set the preprocessor syntax tree.

Parameters
tThe root node of the syntax tree.
PreTree* Puma::CTranslationUnit::cpp_tree ( ) const
inline

Get the C preprocessor syntax tree.

CSemDatabase& Puma::CTranslationUnit::db ( ) const
inline

Get the semantic information database.

UnitManager& Puma::CTranslationUnit::local_units ( ) const
inline

Get the unit manager for local units (macro expansions etc).

void Puma::CTranslationUnit::tree ( CTree t)
inline

Set the C/C++ syntax tree.

Parameters
tThe root node of the syntax tree.
CTree* Puma::CTranslationUnit::tree ( ) const
inline

Get the C/C++ syntax tree.

Unit* Puma::CTranslationUnit::unit ( ) const
inline

Get the token unit of the input file.