PUMA Library Reference Manual
Loading...
Searching...
No Matches
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.
 
 ~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).
 

Constructor & Destructor Documentation

◆ CTranslationUnit()

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

Constructor.

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

◆ ~CTranslationUnit()

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

◆ cpp_tree() [1/2]

PreTree * Puma::CTranslationUnit::cpp_tree ( ) const
inline

Get the C preprocessor syntax tree.

◆ cpp_tree() [2/2]

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

Set the preprocessor syntax tree.

Parameters
tThe root node of the syntax tree.

◆ db()

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

Get the semantic information database.

◆ local_units()

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

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

◆ tree() [1/2]

CTree * Puma::CTranslationUnit::tree ( ) const
inline

Get the C/C++ syntax tree.

◆ tree() [2/2]

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

Set the C/C++ syntax tree.

Parameters
tThe root node of the syntax tree.

◆ unit()

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

Get the token unit of the input file.