|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages
enumNode Class ReferenceEnum type node.
More...
|
Garbage collection. | |
bool | mark |
static node_list | nodes |
static map< Node *, bool > | deleted_nodes |
Public Types | |
enum | Type_qualifiers { NONE = 0x0, CONST = 0x1, VOLATILE = 0x2, INLINE = 0x4, COMPATIBLE = 0x3 } |
Type qualifiers. More... | |
Public Member Functions | |
enumNode (const Coord coord=Coord::Unknown) | |
Create new enum type. | |
enumNode (idNode *id, decl_list *values, const Coord enum_coord, const Coord left_coord, const Coord right_coord) | |
Create a new enum during parsing. | |
virtual | ~enumNode () |
Destroy a enumNode. | |
virtual Node * | clone () const |
Clone the input node. | |
bool | qualified_equal_to (typeNode *node2, bool strict_toplevel, bool strict_recursive) |
Virtual type comparison routine. | |
virtual void | output_type (output_context &ct, Node *par, Assoc context, Type_qualifiers q) |
Output a type. | |
typeNode * | unwind_tdefs (Type_qualifiers &the_tq) |
Unwind typedefs. | |
typeNode * | no_tdef_type () |
typeNode * | follow_tdefs () |
Follow typedefs. | |
virtual typeNode * | usual_unary_conversion_type () |
Usual unary conversion type. | |
virtual typeNode * | base_type (bool TdefIndir) const |
Return the base data type of a node. | |
typeNode * | deep_base_type () |
virtual void | dataflow (FlowVal *v, FlowProblem &fp) |
Run the dataflow analyzer. | |
virtual void | output (output_context &ct, Node *par) |
Generate C code. | |
typeNode * | datatype () const |
Call base_type() with the argument true. | |
typeNode * | datatype_superior () const |
Call base_type() with the argument false. | |
Type predicates | |
virtual bool | is_int () const |
virtual bool | is_integer () const |
virtual bool | is_arithmetic () const |
virtual bool | is_scalar () 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. | |
bool | elaborated () const |
void | elaborated (bool elab) |
suespecNode * | spec () const |
void | spec (suespecNode *s) |
Parser methods | |
void | set_name_fields (idNode *id, decl_list *fields, bool elaborated, const Coord left_coord, const Coord the_right_coord) |
sueNode * | set_name_fields_and (idNode *id, decl_list *fields, bool elaborated, const Coord left_coord, const Coord the_right_coord) |
void | set_name (idNode *id, const Coord coord) |
sueNode * | set_name_and (idNode *id, const Coord coord) |
void | force_new (const Coord coord) |
sueNode * | force_new_and (const Coord coord) |
bool | same_tag_as (sueNode *other) |
void | tag_conflict (sueNode *new_sue) |
Accessors | |
Methods to get and set fields in the class. | |
string | type_qualifiers_name () |
Return a string representation of this typeNode's type qualifiers. | |
typeNode * | type () const |
Return this typeNode's subtype. | |
void | type (typeNode *the_type) |
Set this typeNode's subtype. | |
typeNode * | get_type () |
Return this typeNode's subtype, and set it to be empty. | |
Type_qualifiers | type_qualifiers () const |
Return this typeNode's type qualifiers. | |
void | type_qualifiers (Type_qualifiers the_tq) |
Set this typeNode's type qualifiers. | |
void | add_type_qualifiers (Type_qualifiers the_tq) |
Add a new type qualifier to this typeNode. | |
typeNode * | add_type_qualifiers_and (Type_qualifiers the_tq) |
Add a new type qualifier to this typeNode, and return the typeNode. | |
void | remove_type_qualifiers (Type_qualifiers the_tq) |
Remove a type qualifier from this typeNode. | |
int | alloc_size (void) const |
Indicates the size of memory necessary for this type. | |
void | alloc_size (int size) |
Sets the size necessary for this type. | |
int | alloc_align (void) const |
Indicates the word alignment necessary for this type. | |
void | alloc_align (int align) |
Sets the alignment necessary for this type. | |
Parser methods | |
void | finish () |
typeNode * | finish_and () |
void | set_base_type (typeNode *base) |
typeNode * | set_base_type_and (typeNode *base) |
void | verify_sue_complete () |
Type comparison operators | |
These operators are used to compare types. They recursively descend the compound types and verify the structure. There are several different variations, depending on the level of strictness. In all cases, typedefs are followed so they don't interfere with the comparison. All operators use the static equal_to() method.
| |
bool | operator== (typeNode &second) |
Strict type comparison. | |
bool | operator<= (typeNode &second) |
Weaker type comparison. | |
bool | operator!= (typeNode &second) |
Strict type inequality. | |
Type predicates | |
These methods support a variety of useful type predicates, most of which are self-explanatory. Each typeNode subclass overrides the methods for which it returns true. | |
virtual bool | is_char () const |
virtual bool | is_float () const |
virtual bool | is_void () const |
virtual bool | is_ellipsis () const |
virtual bool | is_aggregate () const |
virtual bool | is_derived () const |
virtual bool | is_pointer () const |
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 string | type_qualifiers_name (Type_qualifiers tq) |
Convert type qualifiers to string. | |
static typeNode * | integral_promotions (typeNode *old_type) |
Integral promotions. | |
static pair< typeNode *, typeNode * > | usual_arithmetic_conversions (typeNode *left, typeNode *right) |
Usual arithmetic conversions. | |
static bool | equal_to (typeNode *first, typeNode *second, bool strict_toplevel, bool strict_recursive) |
Type comparison. | |
static void | report () |
Report node count statistics. |
This class represents enum types. Note that it does not represent the definition of the enums, but just an instant of the type. Any time the source refers to one of the enum constants, or has a variable or parameter that accepts the enum, this is the type associated. The actual definition resides in an suespecNode.
The NodeType is Enum.
Definition at line 2814 of file ast.h.
|
Type qualifiers.
This enum holds the possible type qualifiers. The special |
|
Create new enum type. The new enum type has no tag and doesn't refer to any definition. Use the sueNode::spec() methods to get and set the reference to the definition, which also contains the name.
Referenced by clone(). |
|
Create a new enum during parsing.
|
|
Destroy a enumNode.
|
|
Add a new type qualifier to this typeNode.
Definition at line 1707 of file ast.h. References typeNode::_type_qualifiers. Referenced by typeNode::add_type_qualifiers_and(). |
|
Add a new type qualifier to this typeNode, and return the typeNode.
Definition at line 1713 of file ast.h. References typeNode::add_type_qualifiers(). |
|
Sets the alignment necessary for this type.
Definition at line 1731 of file ast.h. References typeNode::_alloc_align. |
|
Indicates the word alignment necessary for this type.
Definition at line 1728 of file ast.h. References typeNode::_alloc_align. |
|
Sets the size necessary for this type.
Definition at line 1725 of file ast.h. References typeNode::_alloc_size. |
|
Indicates the size of memory necessary for this type.
Definition at line 1722 of file ast.h. References typeNode::_alloc_size. |
|
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 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. Reimplemented in tdefNode. |
|
Dispatch a Changer. This abstract method works much the walker, but allows the tree to be changed.
Implements Node. |
|
Clone the input node. This is not a "deep" clone, so be careful. For a deep clone, use the ref_clone_changer class.
Implements Node. Definition at line 2881 of file ast.h. References enumNode(). |
|
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.
|
|
|
|
Definition at line 2629 of file ast.h. References sueNode::_elaborated. |
|
Definition at line 2628 of file ast.h. References sueNode::_elaborated. |
|
Type comparison. This static method compares two types, descending into the subtypes and following typedefs as necessary. The two boolean arguments control how strict the algorithm is with respect to type qualifiers. Passing true requires all type qualifiers to be the same. Passing false only requires those type qualifiers that affect compatibility to be the same. (Was TypeEqualQualified in type.c) This routine relies on the qualified_equal_to() methods on each kind of typeNode to perform the appropriate comparison and dispatch to the sub-type when necessary.
Referenced by typeNode::operator<=(), and typeNode::operator==(). |
|
Reimplemented in primNode. |
|
Reimplemented in primNode. |
|
Follow typedefs. Follow the chain of typedefs from this type, returning the underlying (non-typedef) type.
|
|
|
|
|
|
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 typeNode's subtype, and set it to be empty.
Definition at line 1685 of file ast.h. References typeNode::_type. |
|
Integral promotions.
This method is used during parsing to convert smaller types (
|
|
Reimplemented in arrayNode, and structNode. |
|
Reimplemented from typeNode. |
|
Reimplemented in primNode. |
|
|
|
Reimplemented in primNode. |
|
Reimplemented in primNode. |
|
Reimplemented from typeNode. |
|
Reimplemented from typeNode. |
|
|
|
Reimplemented from typeNode. |
|
Reimplemented in primNode. |
|
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. |
|
|
|
Strict type inequality. This is just a negation of the operator==
|
|
Weaker type comparison. Compare this type to the given type, masking off type qualifiers that don't affect compatibility of types.
Definition at line 1788 of file ast.h. References typeNode::equal_to(). |
|
Strict type comparison. Compare this type to the given type, requiring all type qualifiers to be the same.
Definition at line 1776 of file ast.h. References typeNode::equal_to(). |
|
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.
Implements Node. |
|
Output a type.
Implements typeNode. |
|
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. |
|
Virtual type comparison routine. Each typeNode subclass overrides this routine to provide its specific type comparison. This is used by the static equal_to() method to perform general deep type comparison.
Reimplemented from typeNode. |
|
Remove a type qualifier from this typeNode.
Definition at line 1718 of file ast.h. References typeNode::_type_qualifiers. |
|
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. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2632 of file ast.h. References sueNode::_spec. |
|
Definition at line 2631 of file ast.h. References sueNode::_spec. |
|
|
|
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 typeNode's subtype. To set the subtype to be empty, call this method with a value of NULL. Definition at line 1692 of file ast.h. References typeNode::_type. |
|
Return this typeNode's subtype.
Reimplemented from Node. Definition at line 1680 of file ast.h. References typeNode::_type. Referenced by tree_visitor::at_ptr(), and funcNode::returns(). |
|
Set this typeNode's type qualifiers.
Definition at line 1700 of file ast.h. References typeNode::_type_qualifiers. |
|
Return this typeNode's type qualifiers.
Definition at line 1696 of file ast.h. References typeNode::_type_qualifiers. Referenced by typeNode::type_qualifiers_name(). |
|
Return a string representation of this typeNode's type qualifiers.
Definition at line 1703 of file ast.h. References typeNode::type_qualifiers(). |
|
Convert type qualifiers to string. This method is used when generating C code to convert the type qualifiers into string form.
|
|
Unwind typedefs.
|
|
Usual arithmetic conversions. From ANSI 6.2.1.5: Many binary operators that expect operands of arithmetic type cause conversions and yield result types in a similar way. The purpose is to yield a common type, which is also the type of the result. This method takes the types of the left and right operands and returns a pair of types indicating the conversions of the two operands, respectively. When necessary, these conversion include the integral promotions.
|
|
Usual unary conversion type. The purpose of this method escapes me. The constNode class seems to use it, but all it does is return itself. No other typeNode overrides it. |
|
|
|
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.
Implements Node. |
|
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.
Implements Node. |
|
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