#include <linker.h>
Inheritance diagram for Linker::
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... |
|
Create a new linker. The constructor does not perform the linking. |
|
Destructor. Destroy the linker object. In particular, destroy any synthetic declarations created. |
|
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. |
|
Fix each idNode (the walker part of this class).
Reimplemented from Walker. |
|
@Brief Clear Clear all the tables, delete all the synthetic declarations, in preparation for linking. |
|
|
|
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. |
|
Lookup a procedure definition. Make sure that the input declNode comes from the lookup_symbol method. |
|
Look up a global variable.
|
|
Access the list of procedure definitions.
|
|
External variable definitions.
|
|
Internally linked (static) variables.
|
|
Mapping from declarations to procedure definitions.
|
|
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 |
|
Used internally: the current unit being processed.
|
|
|