|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
subdeclNode Class ReferenceIndexed declaration.
More...
|
Garbage collection. | |
bool | mark |
static node_list | nodes |
static map< Node *, bool > | deleted_nodes |
Public Types | |
enum | Decl_location { UNKNOWN, TOP, BLOCK, FORMAL, SU, ENUM, PROC } |
Declaration location. More... | |
enum | Storage_class { NONE, AUTO, EXTERN, REGISTER, STATIC, TYPEDEF } |
Storage class specifier. More... | |
Public Member Functions | |
subdeclNode (declNode *orig, int index) | |
Create a sub-declaration. | |
virtual | ~subdeclNode () |
Destroy a subdeclNode. | |
string | name_with_index () |
Get the name with index. | |
virtual Node * | clone () const |
Clone the input node. | |
virtual void | output (output_context &ct, Node *par) |
Generate C code. | |
typeNode * | base_type (bool TdefIndir) const |
Return the base data type of a node. | |
typeNode * | no_tdef_type () |
Return the type. | |
virtual void | dataflow (FlowVal *v, FlowProblem &fp) |
Run the dataflow analyzer. | |
virtual void | grab_pragmas (void) |
Attaches pragmas to this defNode. | |
typeNode * | datatype () const |
Call base_type() with the argument true. | |
typeNode * | datatype_superior () const |
Call base_type() with the argument false. | |
Accessors | |
Methods to get and set fields in the class. | |
virtual declNode * | original () |
SSA original declaration. | |
int | index () const |
AST Traversal | |
virtual void | visit (Visitor *the_visitor) |
Dispatch a Visitor. | |
virtual void | walk (Walker &the_walker) |
Dispatch a Walker. | |
virtual Node * | change (Changer &the_changer, bool redispatch=false) |
Dispatch a Changer. | |
Accessors | |
Methods to get and set fields in the class. | |
typeNode * | type () const |
Return this declNode's base C data type. | |
void | type (typeNode *the_type) |
Set this declNode's base C data type. | |
typeNode * | get_type () |
Return this declNode's base C data type, and set the base C data type to be empty. | |
string & | name () |
Return the name of the variable declared by this declNode. | |
void | name (string name) |
Set the name of the variable declared by this declNode. | |
Decl_location | decl_location () const |
Return a Decl_location indicating the syntactic context in which this declaration occured. | |
void | decl_location (Decl_location loc) |
Set the syntactic context in which this declaration occured. | |
Storage_class | storage_class () const |
Return the storage class of the variable declared by this declNode. | |
void | storage_class (Storage_class sc) |
Set the storage class of the variable declared by this declNode. | |
bool | is_redundant_extern () const |
Return true iff this declaration is a redundant extern declaration. | |
void | set_redundant_extern (bool v) |
Set whether this declaration is a redundant extern declaration. | |
void | inc_references () |
Increment the number of identifier nodes that point to this declaration. | |
exprNode * | init () const |
Return the AST used to initialize the variable declared by this declNode. | |
void | init (exprNode *init) |
Define the AST node used to initialize the variable declared by this declNode. | |
exprNode * | bitsize () const |
Return this Node's bitsize. | |
void | bitsize (exprNode *bitsize) |
Define the bitsize for this declNode. | |
int | references () const |
Return the number of idNodes that point to this declaration. | |
void | references (int references) |
Set the number of idNodes that point to this declaration. | |
id_list & | ref_list () |
const id_list & | ref_list () const |
attrib_list & | attribs () |
Return a mutable reference to this declaration's attribute list. | |
const attrib_list & | attribs () const |
Return an immutable reference to this declaration's attribute list. | |
void | merge_attribs (attrib_list *attribs) |
Add each attribute in the given attribute list to this declNode's attribute list. | |
Parser methods | |
void | set_type (typeNode *the_type, Storage_class sc, ScopeState redeclare) |
declNode * | set_type_and (typeNode *the_type, Storage_class sc, ScopeState redeclare) |
declNode * | set_type_and (declNode *the_decltype, Storage_class sc, ScopeState redeclare) |
void | inherit_type (decl_list *others, ScopeState redeclare) |
declNode * | inherit_type_and (decl_list *others, ScopeState redeclare) |
void | modify_type (typeNode *the_type) |
declNode * | modify_type_and (typeNode *the_type) |
declNode * | modify_type_and (declNode *the_type) |
void | set_init (exprNode *init) |
declNode * | set_init_and (exprNode *init) |
void | add_parameter_types (decl_list *types) |
declNode * | add_parameter_types_and (decl_list *types) |
void | finish (Storage_class sc) |
declNode * | finish_and (Storage_class sc) |
Accessors | |
Methods to get and set fields in the class. | |
text_list & | pragmas () |
Accessors | |
Methods to get and set fields in the class. | |
NodeType | typ () const |
Get the node type. | |
Coord | coord () const |
Get the source location. | |
void | coord (const Coord coord) |
Set the source location. | |
bool | parenthesized () const |
Get the parenthesized boolean. | |
void | parenthesized (bool paren) |
Set the parenthesized boolean. | |
annote_list & | annotations () |
Get the annotations list. | |
FlowVal * | gen () const |
Get the "gen" flow value. | |
void | gen (FlowVal *g) |
Set the "gen" flow value. | |
FlowVal * | kill () const |
Get the "kill" flow value. | |
void | kill (FlowVal *k) |
Set the "kill" flow value. | |
Static Public Member Functions | |
static void | report () |
Report node count statistics. | |
Output methods. | |
Actual Storage Type
These two methods are used when generating C code to convert the Storage_class and Decl_location values into strings. | |
static string | storage_class_name (Storage_class sc) |
Return a string value containing the C code for this Declaration's storage class. | |
static string | decl_location_name (Decl_location dl) |
Return a string value containing the C code for this Declaration's location. | |
Private Attributes | |
REF declNode * | _original |
int | _index |
Subclass of declNode used to create derived indexed declarations. It is currently only used in the SSA pass, which creates a series of indexed version of each variable. A subdeclNode consists of a base declaration and a subscript. For example, the indexed declaration for has the declaration for x as it base and has a subscript of 1. Sometimes, the subdeclNode's base is also refered to as its "original" declaration. The subdeclNode's subscript is also called its version or its index.
The NodeType is Decl.
Definition at line 1239 of file ast.h.
|
Declaration location. This type is used to record some syntactic context information about the declaration. This information is computed by the id_lookup_walker.
|
|
Storage class specifier.
This type indicates any storage class information associated with the declaration. It is overloaded to also indicate when a declaration is a |
|
Create a sub-declaration. This constructor creates a new sub-declaration of the given input declaration. The index indicates which version (or subscript) to associate with the sub-declaration.
Referenced by clone(). |
|
Destroy a subdeclNode.
|
|
|
|
|
|
Get the annotations list. This method returns a modifiable reference to the list of annotations on the node. Users can add new annotations, search for annotations, or remove annotations. Users are responsible for ensuring that every element of the annotation list points to a valid annotation. In particular, no element should be NULL.
Definition at line 274 of file ast.h. References Node::_annotations. |
|
Return an immutable reference to this declaration's attribute list.
Definition at line 1108 of file ast.h. References declNode::_attribs. |
|
Return a mutable reference to this declaration's attribute list.
Definition at line 1103 of file ast.h. References declNode::_attribs. Referenced by tree_visitor::at_decl(). |
|
Return the base data type of a node. This method differs from the Node::type() method in two respects. First, it follows some of the simple type inferences. For example, calling it on an idNode will return the type of its declaration. Second, the boolean argument indicates whether or not to follow typedef links.
Reimplemented from Node. |
|
Define the bitsize for this declNode. To set the bitsize of this declNode to be empty, call this method with a value of NULL. Definition at line 1085 of file ast.h. References declNode::_bitsize. |
|
Return this Node's bitsize.
Definition at line 1078 of file ast.h. References declNode::_bitsize. Referenced by tree_visitor::at_decl(). |
|
Dispatch a Changer. This abstract method works much the walker, but allows the tree to be changed.
Reimplemented from declNode. |
|
Clone the input node. This is not a "deep" clone, so be careful. For a deep clone, use the ref_clone_changer class.
Reimplemented from declNode. Definition at line 1300 of file ast.h. References subdeclNode(). |
|
Set the source location. This location should indicate the position in the source text that this Node represents, or Coord::Unknown if it does not represent any node in the source text. It is not common to set the source location of a node. Currently, only the compiler error messages actually make use of it.
Definition at line 243 of file ast.h. References Node::_coord. |
|
Get the source location. The Coord class holds a location in the input source (file, line, position). During parsing, each AST node created records the position of the source text that it represents. However, subsequent phases may create or change nodes, so no guarantee is given about how the source location corresponds to the original source text.
Definition at line 230 of file ast.h. References Node::_coord. |
|
Run the dataflow analyzer. Each subclass overrides this method to define it's semantics for dataflow analysis. It alters the input flow value to reflect the effect of the node within the given flow problem, calling dataflow() on it's subtrees as necessary. See the dataflow analysis documentation for more information.
Implements Node. |
|
Call base_type() with the argument true.
|
|
Call base_type() with the argument false.
|
|
Set the syntactic context in which this declaration occured.
Definition at line 1033 of file ast.h. References declNode::_decl_location. |
|
Return a Decl_location indicating the syntactic context in which this declaration occured.
Definition at line 1028 of file ast.h. References declNode::_decl_location. |
|
Return a string value containing the C code for this Declaration's location.
|
|
|
|
|
|
Set the "gen" flow value. This value is used in dataflow analyses to store information that is generated at this node. Note that each node has exactly one "gen" flow value. In order to set the flow value to be empty, call this method with a value of NULL.
Definition at line 297 of file ast.h. References Node::_gen. |
|
Get the "gen" flow value. This value is used in dataflow analyses to store information that is generated at this node. Note that each node has exactly one "gen" flow value.
Definition at line 284 of file ast.h. References Node::_gen. |
|
Return this declNode's base C data type, and set the base C data type to be empty.
Definition at line 1006 of file ast.h. References declNode::_type. |
|
Attaches pragmas to this defNode. Used by parser to attach the current pragmas to a defNode. |
|
Increment the number of identifier nodes that point to this declaration.
Definition at line 1061 of file ast.h. References declNode::_references. |
|
Definition at line 1273 of file ast.h. References _index. |
|
|
|
|
|
Define the AST node used to initialize the variable declared by this declNode. To set the initializer of this declNode to be empty, call this method with a value of NULL. Definition at line 1074 of file ast.h. References declNode::_init. |
|
Return the AST used to initialize the variable declared by this declNode.
Definition at line 1066 of file ast.h. References declNode::_init. Referenced by tree_visitor::at_decl(). |
|
Return true iff this declaration is a redundant extern declaration. Redundant extern declarations are allowed in C. Definition at line 1051 of file ast.h. References declNode::_is_redundant_extern. |
|
Set the "kill" flow value. This value is used in dataflow analyses to store information that is killed at this node. Note that each node has exactly one "kill" flow value. To set the flow value to be empty, call this method with a value of NULL.
Definition at line 320 of file ast.h. References Node::_kill. |
|
Get the "kill" flow value. This value is used in dataflow analyses to store information that is killed at this node. Note that each node has exactly one "kill" flow value.
Definition at line 307 of file ast.h. References Node::_kill. |
|
Add each attribute in the given attribute list to this declNode's attribute list.
|
|
|
|
|
|
|
|
Set the name of the variable declared by this declNode.
Definition at line 1023 of file ast.h. References declNode::_name. |
|
Return the name of the variable declared by this declNode.
Definition at line 1018 of file ast.h. References declNode::_name. |
|
Get the name with index.
This method returns the name of the declaration, with its index appended. For example, when this method is called on the subdeclaration for
|
|
Return the type. Return the type after following any typedefs to the real type.
|
|
SSA original declaration. For use with subdeclNode when the code is in SSA form. This method returns the original declaration from which the sub-declaration was derived.
Reimplemented from declNode. Definition at line 1272 of file ast.h. References _original, and declNode::original(). |
|
Generate C code. Each subclass overrides this method to define how to produce the output C code. To use this method, pass an output_context and a null parent.
Reimplemented from declNode. |
|
Set the parenthesized boolean. This boolean determines whether this expression will be parenthesized in the output. Note that that the parentheses will always be added when they are needed to disambiguate the output. This variable only controls the use of "un-necessary" parentheses.
Definition at line 262 of file ast.h. References Node::_parenthesized. |
|
Get the parenthesized boolean.
Definition at line 250 of file ast.h. References Node::_parenthesized. |
|
Definition at line 749 of file ast.h. References defNode::_pragmas. |
|
Definition at line 1098 of file ast.h. References declNode::_ref_list. |
|
Definition at line 1097 of file ast.h. References declNode::_ref_list. Referenced by ref_clone_changer::at_decl(). |
|
Set the number of idNodes that point to this declaration.
Definition at line 1095 of file ast.h. References declNode::_references. |
|
Return the number of idNodes that point to this declaration.
Definition at line 1090 of file ast.h. References declNode::_references. |
|
Report node count statistics. The code can be configured to gather statistics about node usage according to type. This method prints the current state of that accounting information to standard out. |
|
|
|
|
|
Set whether this declaration is a redundant extern declaration.
Definition at line 1056 of file ast.h. References declNode::_is_redundant_extern. |
|
|
|
|
|
|
|
Set the storage class of the variable declared by this declNode.
Definition at line 1043 of file ast.h. References declNode::_storage_class. |
|
Return the storage class of the variable declared by this declNode.
Definition at line 1038 of file ast.h. References declNode::_storage_class. Referenced by has_struct_walker::at_decl(). |
|
Return a string value containing the C code for this Declaration's storage class.
|
|
Get the node type. This has nothing to do with types in the source code. It indicates what kind of AST node this is (e.g., a unary expression node or a while node).
Definition at line 216 of file ast.h. References Node::_typ. Referenced by gcWalker::delete_nodes(), and NodeInfo::nodeIndex(). |
|
Set this declNode's base C data type. To set the data type to be empty, call this method with a value of NULL. Definition at line 1013 of file ast.h. References declNode::_type. |
|
Return this declNode's base C data type.
Reimplemented from Node. Definition at line 1000 of file ast.h. References declNode::_type. Referenced by tree_visitor::at_decl(). |
|
Dispatch a Visitor. This abstract method is the entry point for the visitor design pattern. Each node subclass defines a visit() method that calls the appropriate at_ method in the visitor. For more information see the Visitor documentation.
Reimplemented from declNode. |
|
Dispatch a Walker. This abstract method works much like the visitor, but instead walks the entire underlying subtree calling the appropriate at_ method at each node. For more information see the Walker documentation.
Reimplemented from declNode. |
|
Definition at line 1244 of file ast.h. Referenced by index(). |
|
Definition at line 1243 of file ast.h. Referenced by original(). |
|
Definition at line 165 of file ast.h. Referenced by gcWalker::delete_nodes(). |
|
Definition at line 168 of file ast.h. Referenced by gcWalker::at_binary(), and gcWalker::delete_nodes(). |
|
Definition at line 162 of file ast.h. Referenced by gcWalker::delete_nodes(), and gcWalker::gcWalker(). |
Generated on February 1, 2006
Back to the C-Breeze home page