Puma Reference Manual Puma::CTranslationUnit Class Reference



Puma::CTranslationUnit Class Reference

Abstraction of a translation unit. More...

#include <Puma/CTranslationUnit.h>

List of all members.

Public Member Functions

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

Detailed 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.


Constructor & Destructor Documentation

Constructor.

Parameters:
uThe token unit of the input file.
pThe project information object.

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.

Get the C preprocessor syntax tree.

Get the semantic information database.

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.