Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Mangle Class Reference

Maps identifier occurrences to a unique global name. More...

#include <mangle.h>

Collaboration diagram for Mangle:

Collaboration graph
[legend]
List of all members.

Public Methods

 Mangle ()
void enter_scope (const std::string &scopename, char symprefix)
void leave_scope ()
std::string & insert (Ptree &name, char symprefix)
bool lookup_global_name (Ptree &name, std::string *out_global_name)

Private Types

typedef std::hash_map< void *,
std::string > 
Bind_map
typedef std::deque< std::string > Scopes

Private Methods

std::string current_scope ()

Private Attributes

Scopes _scope
Bind_map _map
std::string _current_scope
Abstract_scope_env

Detailed Description

Maps identifier occurrences to a unique global name.

Identifiers are assigned a global name when they are declared using insert(); later, an (potentially scope-qualified) aidentifier occurrence can be mapped to the global name by calling lookup_global_name().

Global names are scoped using the name and type of the scope in which they were declared. Use the enter_scope() and leave_scope() functions around invocations of insert() to define the scope.

Definition at line 29 of file mangle.h.


Member Typedef Documentation

typedef std::hash_map<void*,std::string> Mangle::Bind_map [private]
 

Definition at line 31 of file mangle.h.

typedef std::deque<std::string> Mangle::Scopes [private]
 

Definition at line 32 of file mangle.h.


Constructor & Destructor Documentation

Mangle::Mangle  
 

Definition at line 13 of file mangle.cc.


Member Function Documentation

std::string Mangle::current_scope   [private]
 

Definition at line 43 of file mangle.cc.

References _scope.

Referenced by insert().

void Mangle::enter_scope const std::string &    scopename,
char    symprefix
 

Definition at line 21 of file mangle.cc.

References _env, _scope, and Abstract_scope::get_unique_name().

Referenced by Translate_visitor::visit_function().

std::string & Mangle::insert Ptree   name,
char    symprefix
 

Definition at line 58 of file mangle.cc.

References _env, _map, Abstract_scope::add_symbol(), current_scope(), Abstract_scope::lookup_here(), s_None, Symbol::st_Defined, Ptree::ToString(), and Symbol_pair::untag.

Referenced by Translate_visitor::visit_function(), and Translate_visitor::visit_name_declaration().

void Mangle::leave_scope  
 

Definition at line 33 of file mangle.cc.

References _env, _scope, and Abstract_scope::get_parent().

Referenced by Translate_visitor::visit_function().

bool Mangle::lookup_global_name Ptree   name,
std::string *    out_global_name
 

Definition at line 85 of file mangle.cc.

References _env, _map, Abstract_scope::lookup_unqualified(), Ptree::ToString(), and Symbol_pair::untag.

Referenced by Translate_visitor::visit_funcall(), and Translate_visitor::visit_name().


Member Data Documentation

std::string Mangle::_current_scope [private]
 

Definition at line 36 of file mangle.h.

Abstract_scope* Mangle::_env [private]
 

Definition at line 37 of file mangle.h.

Referenced by enter_scope(), insert(), leave_scope(), and lookup_global_name().

Bind_map Mangle::_map [private]
 

Definition at line 35 of file mangle.h.

Referenced by insert(), and lookup_global_name().

Scopes Mangle::_scope [private]
 

Definition at line 34 of file mangle.h.

Referenced by current_scope(), enter_scope(), and leave_scope().


The documentation for this class was generated from the following files:
Generated on Mon Feb 10 17:35:52 2003 for VFiasco Semantics Compiler by doxygen1.2.15