Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Linker Class Reference

#include <linker.h>

Inheritance diagram for Linker::

Walker List of all members.

Public Methods

 Linker ()
 Create a new linker. More...

 ~Linker ()
 Destructor. More...

void clear ()
void link ()
 Link. More...

const proc_decl_map & procedures () const
 Access the list of procedure definitions. More...

virtual void at_id (idNode *the_id, Order ord)
 Fix each idNode (the walker part of this class). More...

virtual void at_call (callNode *the_call, Order ord)
 Special case: function calls. More...

declNode * lookup_symbol (unitNode *current, string name, bool &is_synthetic_decl)
 Look up a global variable. More...

procNode * lookup_procedure (declNode *decl)
 Lookup a procedure definition. More...


Static Public Attributes

bool debug = false

Private Methods

bool create_synthetic (declNode *local_decl)

Private Attributes

decl_name_map _external_symbols
 External variable definitions. More...

unit_decl_name_map _internal_symbols
 Internally linked (static) variables. More...

proc_decl_map _procedure_declarations
 Mapping from declarations to procedure definitions. More...

decl_name_map _synthetic
 Synthetic global variables. More...

unitNode * current_unit
 Used internally: the current unit being processed. More...


Constructor & Destructor Documentation

Linker::Linker (    ) 
 

Create a new linker.

The constructor does not perform the linking.

Linker::~Linker (    ) 
 

Destructor.

Destroy the linker object. In particular, destroy any synthetic declarations created.


Member Function Documentation

void Linker::at_call (  callNode *    the_call,
Order    ord
)  [virtual]
 

Special case: function calls.

The a function call can refer to an undeclared function. In this case, we create a declaration on the fly

Reimplemented from Walker.

void Linker::at_id (  idNode *    the_id,
Order    ord
)  [virtual]
 

Fix each idNode (the walker part of this class).

Reimplemented from Walker.

void Linker::clear (    ) 
 

@Brief Clear

Clear all the tables, delete all the synthetic declarations, in preparation for linking.

bool Linker::create_synthetic (  declNode *    local_decl )  [private]
 

void Linker::link (    ) 
 

Link.

This is main function of the Linker class. It visits all the top-level declarations in all the translation units and makes sure that each symbol refers to the actual definition, regardless of which translation unit it actually resides in.

procNode * Linker::lookup_procedure (  declNode *    decl ) 
 

Lookup a procedure definition.

Make sure that the input declNode comes from the lookup_symbol method.

declNode * Linker::lookup_symbol (  unitNode *    current,
string    name,
bool &    is_synthetic_decl
) 
 

Look up a global variable.

const proc_decl_map& Linker::procedures (    )  const [inline]
 

Access the list of procedure definitions.


Member Data Documentation

decl_name_map Linker::_external_symbols [private]
 

External variable definitions.

unit_decl_name_map Linker::_internal_symbols [private]
 

Internally linked (static) variables.

proc_decl_map Linker::_procedure_declarations [private]
 

Mapping from declarations to procedure definitions.

decl_name_map Linker::_synthetic [private]
 

Synthetic global variables.

These declarations are created for global variables that are always declared "extern", presumably because their actual definition is in some pre-compiled code elsewhere

unitNode* Linker::current_unit [private]
 

Used internally: the current unit being processed.

bool Linker::debug = false [static]
 


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:29 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001