ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
annVariable Class Reference

Local variable. More...

#include <annvariable.h>

Collaboration diagram for annVariable:

Public Member Functions

 annVariable (std::string name, std::string procedure_name, bool is_new, bool is_global, bool is_external, bool is_formal, bool is_io)
 Create a new annotation variable. More...
 
 ~annVariable ()
 Destructor. More...
 
std::string & name ()
 Clear. More...
 
bool is_new () const
 
bool is_used () const
 
bool is_defined () const
 
bool is_global () const
 
bool is_external () const
 
bool is_formal () const
 
bool is_io () const
 
bool is_deleted () const
 
bool is_property_variable () const
 
void set_used ()
 
void set_defined ()
 
void set_global ()
 
void set_external ()
 
void set_formal ()
 
void set_io ()
 
void set_deleted ()
 
void set_property_variable ()
 
void print (std::ostream &o) const
 

Private Attributes

std::string _name
 the variable name More...
 
Flags

bindings

This field maps each context of use of this variable to it's actual pointer value in that context. We store all the contexts (and not just the current bindings) for two reasons. First, we use this data structure to store the memoryBlocks that represent heap allocations (uses of "new" in the on_exit annotations). Second, we use these contexts during other phases of the compiler, such as reports and actions. TestSynthetic declaration node

bool _is_new
 
bool _is_used
 
bool _is_defined
 
bool _is_global
 
bool _is_external
 
bool _is_formal
 
bool _is_io
 
bool _is_deleted
 
bool _is_property_variable
 

Friends

std::ostream & operator<< (std::ostream &o, const annVariable &var)
 Get the bindings. More...
 

Detailed Description

Local variable.

This class represents a local variable in the procedure annotations. A local variable has a name and a binding that is used to associate the actual memory objects assigned to it.

Definition at line 34 of file annvariable.h.

Constructor & Destructor Documentation

annVariable::annVariable ( std::string  name,
std::string  procedure_name,
bool  is_new,
bool  is_global,
bool  is_external,
bool  is_formal,
bool  is_io 
)

Create a new annotation variable.

The is_external boolean determines whether or not to create a synthetic declNode for this variable. For external variables, we'll get the real declNode from the header files.

annVariable::~annVariable ( )

Destructor.

Note: we have to be careful here because we want to delete the synthetic declarations, but not the real ones (see the constructor above).

Member Function Documentation

std::string& annVariable::name ( )
inline

Clear.

Clear all the bindings.

Definition at line 119 of file annvariable.h.

References _name.

bool annVariable::is_new ( ) const
inline

Definition at line 124 of file annvariable.h.

References _is_new.

bool annVariable::is_used ( ) const
inline

Definition at line 125 of file annvariable.h.

References _is_used.

bool annVariable::is_defined ( ) const
inline

Definition at line 126 of file annvariable.h.

References _is_defined.

bool annVariable::is_global ( ) const
inline

Definition at line 127 of file annvariable.h.

References _is_global.

bool annVariable::is_external ( ) const
inline

Definition at line 128 of file annvariable.h.

References _is_external.

bool annVariable::is_formal ( ) const
inline

Definition at line 129 of file annvariable.h.

References _is_formal.

bool annVariable::is_io ( ) const
inline

Definition at line 130 of file annvariable.h.

References _is_io.

bool annVariable::is_deleted ( ) const
inline

Definition at line 131 of file annvariable.h.

References _is_deleted.

bool annVariable::is_property_variable ( ) const
inline

Definition at line 132 of file annvariable.h.

References _is_property_variable.

void annVariable::set_used ( )
inline

Definition at line 134 of file annvariable.h.

References _is_used.

void annVariable::set_defined ( )
inline

Definition at line 135 of file annvariable.h.

References _is_defined.

void annVariable::set_global ( )
inline

Definition at line 136 of file annvariable.h.

References _is_global.

void annVariable::set_external ( )
inline

Definition at line 144 of file annvariable.h.

References _is_external.

void annVariable::set_formal ( )
inline

Definition at line 146 of file annvariable.h.

References _is_formal.

void annVariable::set_io ( )
inline

Definition at line 154 of file annvariable.h.

References _is_io.

void annVariable::set_deleted ( )
inline

Definition at line 155 of file annvariable.h.

References _is_deleted.

void annVariable::set_property_variable ( )
inline

Definition at line 156 of file annvariable.h.

References _is_property_variable.

void annVariable::print ( std::ostream &  o) const

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const annVariable var 
)
friend

Get the bindings.

Return the set of memoryBlocks bound to the variable in the given calling context. For globals, there is only one binding (this is taken care of internally). Get a fresh binding

This is used by the Analyzer when it is setting up the new bindings at a call site. It first clears the existing pointerValue then returns it. Create bindings

Set up a binding for the given calling context and initialize it with the given memoryBlock. Check for a binding

See if the variable has a binding in the given calling context.

Definition at line 213 of file annvariable.h.

Member Data Documentation

std::string annVariable::_name
private

the variable name

Definition at line 40 of file annvariable.h.

Referenced by name().

bool annVariable::_is_new
private

Definition at line 72 of file annvariable.h.

Referenced by is_new().

bool annVariable::_is_used
private

Definition at line 73 of file annvariable.h.

Referenced by is_used(), and set_used().

bool annVariable::_is_defined
private

Definition at line 74 of file annvariable.h.

Referenced by is_defined(), and set_defined().

bool annVariable::_is_global
private

Definition at line 75 of file annvariable.h.

Referenced by is_global(), and set_global().

bool annVariable::_is_external
private

Definition at line 76 of file annvariable.h.

Referenced by is_external(), and set_external().

bool annVariable::_is_formal
private

Definition at line 77 of file annvariable.h.

Referenced by is_formal(), and set_formal().

bool annVariable::_is_io
private

Definition at line 78 of file annvariable.h.

Referenced by is_io(), and set_io().

bool annVariable::_is_deleted
private

Definition at line 79 of file annvariable.h.

Referenced by is_deleted(), and set_deleted().

bool annVariable::_is_property_variable
private

Definition at line 80 of file annvariable.h.

Referenced by is_property_variable(), and set_property_variable().


The documentation for this class was generated from the following file: