C-Breeze
C Compiler Infrastructure

[ Project home page]

suespecNode Class Reference
[The AST nodes]

Struct/Union/Enum definition. More...

#include <ast.h>

Inheritance diagram for suespecNode:

typeNode Node List of all members.

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

 suespecNode (const char *name, decl_list *fields, NodeType owner, unitNode *the_unit, const Coord coord)
 Create a new SUE definition.
virtual ~suespecNode ()
 Destroy a suespecNode.
bool same_tag_as (suespecNode *other)
 Same tag test.
void update (decl_list *fields, sueNode *sue, const Coord right)
 Update the s/u/e with fields.
declNodefind_field (const string &name)
 Find a field by name.
virtual Nodeclone () const
 Clone the input node.
virtual void output_type (output_context &ct, Node *par, Assoc context, Type_qualifiers q)
 Output a type.
virtual bool qualified_equal_to (typeNode *other, bool strict_toplevel, bool strict_recursive)
 Virtual type comparison routine.
typeNodeunwind_tdefs (Type_qualifiers &the_tq)
 Unwind typedefs.
typeNodeno_tdef_type ()
typeNodefollow_tdefs ()
 Follow typedefs.
virtual typeNodeusual_unary_conversion_type ()
 Usual unary conversion type.
virtual typeNodebase_type (bool TdefIndir) const
 Return the base data type of a node.
typeNodedeep_base_type ()
virtual void dataflow (FlowVal *v, FlowProblem &fp)
 Run the dataflow analyzer.
virtual void output (output_context &ct, Node *par)
 Generate C code.
typeNodedatatype () const
 Call base_type() with the argument true.
typeNodedatatype_superior () const
 Call base_type() with the argument false.
Accessors
Methods to get and set fields in the class.

bool complete () const
void complete (bool comp)
bool visited () const
void visited (bool v)
bool scope_output () const
void scope_output (int v)
int size () const
void size (int size)
int align () const
void align (int align)
string & name ()
void name (string name)
decl_listfields ()
const decl_listfields () const
NodeType owner () const
AST Traversal
Methods to uniformly traverse the AST. See the documentation in the Node class.

virtual void visit (Visitor *the_visitor)
 Dispatch a Visitor.
virtual void walk (Walker &the_walker)
 Dispatch a Walker.
virtual Nodechange (Changer &the_changer, bool redispatch=false)
 Dispatch a Changer.
Accessors
Methods to get and set fields in the class.

string type_qualifiers_name ()
 Return a string representation of this typeNode's type qualifiers.
typeNodetype () const
 Return this typeNode's subtype.
void type (typeNode *the_type)
 Set this typeNode's subtype.
typeNodeget_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.
typeNodeadd_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 ()
typeNodefinish_and ()
void set_base_type (typeNode *base)
typeNodeset_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.

See also:
equal_to()


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_int () const
virtual bool is_float () const
virtual bool is_void () const
virtual bool is_ellipsis () const
virtual bool is_integer () const
virtual bool is_arithmetic () const
virtual bool is_scalar () 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_listannotations ()
 Get the annotations list.
FlowValgen () const
 Get the "gen" flow value.
void gen (FlowVal *g)
 Set the "gen" flow value.
FlowValkill () 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 typeNodeintegral_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.

Private Attributes

string _name
 the struct/union/enum tag
TREE decl_list _fields
 the struct/union/enum fields
bool _complete
 struct/union/enum complete
bool _visited
 visited flag
int _scope_output
 Output scope control.
int _size
 Size in bytes.
int _align
 Alignment in memory.
NodeType _owner
 Owner type.

Detailed Description

Struct/Union/Enum definition.

This class holds the tag and fields for struct/union/enum. Many different sueNodes may point to one suespecNode, but only the one that has is_elaborated equal to true actually "owns" the suespecNode. All suespecNode objects are stored in the unitNode. For a more detailed explanation see the related documentation.

The NodeType is sueSpec. However, there is a special field called _owner that will match that of the refering sueNode (either Struct, Union, or Enum).

See also:
sueNode

unitNode

Definition at line 2900 of file ast.h.


Member Enumeration Documentation

enum typeNode::Type_qualifiers [inherited]
 

Type qualifiers.

This enum holds the possible type qualifiers. The special COMPATIBLE value indicates which type qualifiers are relevant when comparing two types for compatibility: const and volatile.

Enumeration values:
NONE  No type qualifier
CONST  Type is const
VOLATILE  Type is volatile
INLINE  Type is inline
COMPATIBLE  Mask the qualifiers that are relevant to type compatibility

Definition at line 1566 of file ast.h.


Constructor & Destructor Documentation

suespecNode::suespecNode const char *  name,
decl_list fields,
NodeType  owner,
unitNode the_unit,
const Coord  coord
 

Create a new SUE definition.

The new s/u/e has the given name, set of fields and owner type. In addition, since all suespecNode objects are collected in the unitNode, the unit is passed as an argument.

Parameters:
name the tag for the s/u/e (copied; not deleted).
fields the list of field declarations, which are removed and the list deleted.
owner the NodeType of the s/u/e (either Struct, Union, or Enum)
the_unit the translation unit
coord the location of the construct in the source file.

Referenced by clone().

virtual suespecNode::~suespecNode  )  [virtual]
 

Destroy a suespecNode.

Warning:
Do not use the destructors to delete AST nodes. Instead, rely on the node garbage collector.


Member Function Documentation

void typeNode::add_type_qualifiers Type_qualifiers  the_tq  )  [inline, inherited]
 

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().

typeNode* typeNode::add_type_qualifiers_and Type_qualifiers  the_tq  )  [inline, inherited]
 

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().

void suespecNode::align int  align  )  [inline]
 

Definition at line 3014 of file ast.h.

References _align.

int suespecNode::align  )  const [inline]
 

Definition at line 3013 of file ast.h.

References _align.

void typeNode::alloc_align int  align  )  [inline, inherited]
 

Sets the alignment necessary for this type.

Definition at line 1731 of file ast.h.

References typeNode::_alloc_align.

int typeNode::alloc_align void   )  const [inline, inherited]
 

Indicates the word alignment necessary for this type.

Definition at line 1728 of file ast.h.

References typeNode::_alloc_align.

void typeNode::alloc_size int  size  )  [inline, inherited]
 

Sets the size necessary for this type.

Definition at line 1725 of file ast.h.

References typeNode::_alloc_size.

int typeNode::alloc_size void   )  const [inline, inherited]
 

Indicates the size of memory necessary for this type.

Definition at line 1722 of file ast.h.

References typeNode::_alloc_size.

annote_list& Node::annotations  )  [inline, inherited]
 

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.

See also:
Annote class

Definition at line 274 of file ast.h.

References Node::_annotations.

virtual typeNode* typeNode::base_type bool  TdefIndir  )  const [inline, virtual, inherited]
 

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.

Parameters:
TdefIndir pass true to follow typedefs to their definitions.

Reimplemented from Node.

Reimplemented in tdefNode.

Definition at line 1896 of file ast.h.

virtual Node* suespecNode::change Changer the_changer,
bool  redispatch = false
[virtual]
 

Dispatch a Changer.

This abstract method works much the walker, but allows the tree to be changed.

Parameters:
the_changer the specific Changer object to use.
redispatch pass true to revisit parts of the tree that have changed.

Implements Node.

virtual Node* suespecNode::clone  )  const [inline, virtual]
 

Clone the input node.

This is not a "deep" clone, so be careful. For a deep clone, use the ref_clone_changer class.

Returns:
a shallow copy of the node (no subtrees are copied).

Implements Node.

Definition at line 3074 of file ast.h.

References suespecNode().

void suespecNode::complete bool  comp  )  [inline]
 

Definition at line 3002 of file ast.h.

References _complete.

bool suespecNode::complete  )  const [inline]
 

Definition at line 3001 of file ast.h.

References _complete.

Referenced by sue_complete_walker::at_suespec().

void Node::coord const Coord  coord  )  [inline, inherited]
 

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.

Parameters:
coord the new location.

Definition at line 243 of file ast.h.

References Node::_coord.

Coord Node::coord  )  const [inline, inherited]
 

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.

Returns:
the Coord structure indicating where the node came from in the source file.

Definition at line 230 of file ast.h.

References Node::_coord.

virtual void typeNode::dataflow FlowVal v,
FlowProblem fp
[inline, virtual, inherited]
 

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.

Parameters:
v the flow value to pass through the node.
fp the flow problem (specifying the transfer functions).

Implements Node.

Definition at line 1906 of file ast.h.

typeNode* Node::datatype  )  const [inherited]
 

Call base_type() with the argument true.

typeNode* Node::datatype_superior  )  const [inherited]
 

Call base_type() with the argument false.

typeNode* typeNode::deep_base_type  )  [inherited]
 

static bool typeNode::equal_to typeNode first,
typeNode second,
bool  strict_toplevel,
bool  strict_recursive
[static, inherited]
 

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.

See also:
qualified_equal_to()
Parameters:
first the first type
second the second type
strict_toplevel pass true to require strict comparison of top-level types
strict_recursive pass true to require strict comparson of sub-types
Returns:
true, if the types pass the equality test

Referenced by typeNode::operator<=(), and typeNode::operator==().

const decl_list& suespecNode::fields  )  const [inline]
 

Definition at line 3020 of file ast.h.

References _fields.

decl_list& suespecNode::fields  )  [inline]
 

Definition at line 3019 of file ast.h.

References _fields.

declNode* suespecNode::find_field const string &  name  ) 
 

Find a field by name.

Search the _fields list for the given name, returning the declaration, if found, or null if not found. (Was SUE_FindField in sue.c).

Parameters:
name the field name to look for
Returns:
the declaration, if found, or null

void typeNode::finish  )  [inherited]
 

Reimplemented in primNode.

typeNode* typeNode::finish_and  )  [inherited]
 

Reimplemented in primNode.

typeNode* typeNode::follow_tdefs  )  [inherited]
 

Follow typedefs.

Follow the chain of typedefs from this type, returning the underlying (non-typedef) type.

Returns:
the type at the end of the typedef chain

void Node::gen FlowVal g  )  [inline, inherited]
 

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.

Parameters:
g the new gen flow value.

Definition at line 297 of file ast.h.

References Node::_gen.

FlowVal* Node::gen  )  const [inline, inherited]
 

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.

Returns:
the "gen" flow value.

Definition at line 284 of file ast.h.

References Node::_gen.

typeNode* typeNode::get_type  )  [inline, inherited]
 

Return this typeNode's subtype, and set it to be empty.

Definition at line 1685 of file ast.h.

References typeNode::_type.

static typeNode* typeNode::integral_promotions typeNode old_type  )  [static, inherited]
 

Integral promotions.

This method is used during parsing to convert smaller types (char, short, bit-fields and enums) into integers according to the rules in ANSI 6.2.1.1. In addition, our version converts float into double.

See also:
exprNode::integral_promotions()
Parameters:
old_type the original small type to be promoted
Returns:
the resulting integral type

virtual bool typeNode::is_aggregate  )  const [inline, virtual, inherited]
 

Reimplemented in arrayNode, and structNode.

Definition at line 1880 of file ast.h.

virtual bool typeNode::is_arithmetic  )  const [inline, virtual, inherited]
 

Reimplemented in primNode, and enumNode.

Definition at line 1878 of file ast.h.

virtual bool typeNode::is_char  )  const [inline, virtual, inherited]
 

Reimplemented in primNode.

Definition at line 1871 of file ast.h.

virtual bool typeNode::is_derived  )  const [inline, virtual, inherited]
 

Reimplemented in ptrNode, arrayNode, and funcNode.

Definition at line 1881 of file ast.h.

virtual bool typeNode::is_ellipsis  )  const [inline, virtual, inherited]
 

Reimplemented in primNode.

Definition at line 1875 of file ast.h.

virtual bool typeNode::is_float  )  const [inline, virtual, inherited]
 

Reimplemented in primNode.

Definition at line 1873 of file ast.h.

virtual bool typeNode::is_int  )  const [inline, virtual, inherited]
 

Reimplemented in primNode, and enumNode.

Definition at line 1872 of file ast.h.

virtual bool typeNode::is_integer  )  const [inline, virtual, inherited]
 

Reimplemented in primNode, and enumNode.

Definition at line 1877 of file ast.h.

virtual bool typeNode::is_pointer  )  const [inline, virtual, inherited]
 

Reimplemented in ptrNode, arrayNode, and funcNode.

Definition at line 1882 of file ast.h.

virtual bool typeNode::is_scalar  )  const [inline, virtual, inherited]
 

Reimplemented in primNode, ptrNode, arrayNode, and enumNode.

Definition at line 1879 of file ast.h.

virtual bool typeNode::is_void  )  const [inline, virtual, inherited]
 

Reimplemented in primNode.

Definition at line 1874 of file ast.h.

void Node::kill FlowVal k  )  [inline, inherited]
 

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.

Parameters:
k the new kill flow value.

Definition at line 320 of file ast.h.

References Node::_kill.

FlowVal* Node::kill  )  const [inline, inherited]
 

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.

Returns:
the "kill" flow value.

Definition at line 307 of file ast.h.

References Node::_kill.

void suespecNode::name string  name  )  [inline]
 

Definition at line 3017 of file ast.h.

References _name.

string& suespecNode::name  )  [inline]
 

Definition at line 3016 of file ast.h.

References _name.

Referenced by sue_complete_walker::at_suespec().

typeNode* typeNode::no_tdef_type  )  [inherited]
 

bool typeNode::operator!= typeNode second  )  [inline, inherited]
 

Strict type inequality.

This is just a negation of the operator==

Parameters:
second the right type in the comparison
Returns:
true if the types are the same

Definition at line 1798 of file ast.h.

bool typeNode::operator<= typeNode second  )  [inline, inherited]
 

Weaker type comparison.

Compare this type to the given type, masking off type qualifiers that don't affect compatibility of types.

See also:
Type_qualifiers
Parameters:
second the right type in the comparison
Returns:
true if the types are the same

Definition at line 1788 of file ast.h.

References typeNode::equal_to().

bool typeNode::operator== typeNode second  )  [inline, inherited]
 

Strict type comparison.

Compare this type to the given type, requiring all type qualifiers to be the same.

Parameters:
second the right type in the comparison
Returns:
true if the types are the same

Definition at line 1776 of file ast.h.

References typeNode::equal_to().

virtual void typeNode::output output_context ct,
Node par
[virtual, inherited]
 

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.

Parameters:
ct the output context which describes the formatting.
par the parent node (or null, if at the top of a subtree).

Implements Node.

virtual void suespecNode::output_type output_context ct,
Node par,
Assoc  context,
Type_qualifiers  q
[virtual]
 

Output a type.

Implements typeNode.

NodeType suespecNode::owner  )  const [inline]
 

Definition at line 3022 of file ast.h.

References _owner.

Referenced by sue_complete_walker::at_suespec().

void Node::parenthesized bool  paren  )  [inline, inherited]
 

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.

Parameters:
paren the new value of the parenthesized boolean.

Definition at line 262 of file ast.h.

References Node::_parenthesized.

bool Node::parenthesized  )  const [inline, inherited]
 

Get the parenthesized boolean.

Returns:
true if the construct corresponding to this Node was parenthesized in the source.

Definition at line 250 of file ast.h.

References Node::_parenthesized.

virtual bool typeNode::qualified_equal_to typeNode other,
bool  strict_toplevel,
bool  strict_recursive
[virtual, inherited]
 

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.

See also:
equal_to()
Parameters:
other the type to compare against
strict_toplevel pass true to require strict comparison of top-level types
strict_recursive pass true to require strict comparson of sub-types
Returns:
true, if the types pass the equality test

Reimplemented in primNode, ptrNode, arrayNode, funcNode, and sueNode.

void typeNode::remove_type_qualifiers Type_qualifiers  the_tq  )  [inline, inherited]
 

Remove a type qualifier from this typeNode.

Definition at line 1718 of file ast.h.

References typeNode::_type_qualifiers.

static void Node::report  )  [static, inherited]
 

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.

bool suespecNode::same_tag_as suespecNode other  ) 
 

Same tag test.

This methods tests to see if this suespecNode has the same tag as the input one. This can be done by simply comparing the names. However, this code appears to be written to handle empty names (anonymous s/u/e), which never happens.

Parameters:
other the suespecNode to compare tags with
Returns:
true if they have the same tag

void suespecNode::scope_output int  v  )  [inline]
 

Definition at line 3008 of file ast.h.

References _scope_output.

bool suespecNode::scope_output  )  const [inline]
 

Definition at line 3007 of file ast.h.

References _scope_output.

void typeNode::set_base_type typeNode base  )  [inherited]
 

typeNode* typeNode::set_base_type_and typeNode base  )  [inherited]
 

void suespecNode::size int  size  )  [inline]
 

Definition at line 3011 of file ast.h.

References _size.

int suespecNode::size  )  const [inline]
 

Definition at line 3010 of file ast.h.

References _size.

NodeType Node::typ  )  const [inline, inherited]
 

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).

Returns:
the node type.

Definition at line 216 of file ast.h.

References Node::_typ.

Referenced by gcWalker::delete_nodes(), and NodeInfo::nodeIndex().

void typeNode::type typeNode the_type  )  [inline, inherited]
 

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.

typeNode* typeNode::type  )  const [inline, virtual, inherited]
 

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().

void typeNode::type_qualifiers Type_qualifiers  the_tq  )  [inline, inherited]
 

Set this typeNode's type qualifiers.

Definition at line 1700 of file ast.h.

References typeNode::_type_qualifiers.

Type_qualifiers typeNode::type_qualifiers  )  const [inline, inherited]
 

Return this typeNode's type qualifiers.

Definition at line 1696 of file ast.h.

References typeNode::_type_qualifiers.

Referenced by typeNode::type_qualifiers_name().

string typeNode::type_qualifiers_name  )  [inline, inherited]
 

Return a string representation of this typeNode's type qualifiers.

Definition at line 1703 of file ast.h.

References typeNode::type_qualifiers().

static string typeNode::type_qualifiers_name Type_qualifiers  tq  )  [static, inherited]
 

Convert type qualifiers to string.

This method is used when generating C code to convert the type qualifiers into string form.

Parameters:
tq the type qualifiers to convert
Returns:
the string form of the type qualifiers

typeNode* typeNode::unwind_tdefs Type_qualifiers the_tq  )  [inherited]
 

Unwind typedefs.

void suespecNode::update decl_list fields,
sueNode sue,
const Coord  right
 

Update the s/u/e with fields.

This method is used to add fields to an s/u/e during parsing.

Parameters:
fields the list of field declarations
sue the owner sueNode
right the location in the source of the right curly brace

static pair<typeNode *, typeNode *> typeNode::usual_arithmetic_conversions typeNode left,
typeNode right
[static, inherited]
 

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.

See also:
integral_promotions()

exprNode::usual_arithmetic_conversions()

Parameters:
left the type of the left operand
right the type of the right operand
Returns:
a pair of converted types for the left and right, respectively

virtual typeNode* typeNode::usual_unary_conversion_type  )  [inline, virtual, inherited]
 

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.

Definition at line 1892 of file ast.h.

void typeNode::verify_sue_complete  )  [inherited]
 

virtual void suespecNode::visit Visitor the_visitor  )  [virtual]
 

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.

Parameters:
the_visitor the specific Visitor object to use.

Implements Node.

void suespecNode::visited bool  v  )  [inline]
 

Definition at line 3005 of file ast.h.

References _visited.

bool suespecNode::visited  )  const [inline]
 

Definition at line 3004 of file ast.h.

References _visited.

virtual void suespecNode::walk Walker the_walker  )  [virtual]
 

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.

Parameters:
the_walker the specific Walker object to use.

Implements Node.


Member Data Documentation

int suespecNode::_align [private]
 

Alignment in memory.

The alignment information for an s/u/e is currently not computed.

Definition at line 2962 of file ast.h.

Referenced by align().

bool suespecNode::_complete [private]
 

struct/union/enum complete

This boolean is used primarily during parsing to indicate when a struct or union has it's fields defined.

See also:
sue_complete_walker

Definition at line 2929 of file ast.h.

Referenced by complete().

TREE decl_list suespecNode::_fields [private]
 

the struct/union/enum fields

This declaration list holds the declarations of the members of the struct/union/enum. For structs and unions the Decl_location will be SU, and for enums the Decl_location will be ENUM.

Definition at line 2920 of file ast.h.

Referenced by fields().

string suespecNode::_name [private]
 

the struct/union/enum tag

This field should really be called "tag" according to the ANSI C lingo. Even though tags are optional in s/u/e definitions (anonymoung s/u/e), this field is never empty. The sueNode routine that sets them up will generate unique names automatically

Definition at line 2912 of file ast.h.

Referenced by name().

NodeType suespecNode::_owner [private]
 

Owner type.

This field indicates which kind of s/u/e owns this definition. It is always one of Struct, Union, or Enum.

Definition at line 2969 of file ast.h.

Referenced by owner().

int suespecNode::_scope_output [private]
 

Output scope control.

This value is used during output to control generation of struct and union contents. It represents the depth of scope nesting at which the definition occurs. This helps the algorithm generate struct and union contents in the right places, even if tags are reused in different scopes.

Todo:
Check if this value is causing bugs in the C code generator.

Definition at line 2950 of file ast.h.

Referenced by scope_output().

int suespecNode::_size [private]
 

Size in bytes.

This size information for an s/u/e is currently not computed.

Definition at line 2956 of file ast.h.

Referenced by size().

bool suespecNode::_visited [private]
 

visited flag

This flag seems to be obsolete (it is always false). However, it may be causing some problems in the output algorithm.

Todo:
Check if this flag is causing bugs in the C code generator.

Definition at line 2938 of file ast.h.

Referenced by visited().

map<Node *, bool> Node::deleted_nodes [static, inherited]
 

Definition at line 165 of file ast.h.

Referenced by gcWalker::delete_nodes().

bool Node::mark [inherited]
 

Definition at line 168 of file ast.h.

Referenced by gcWalker::at_binary(), and gcWalker::delete_nodes().

node_list Node::nodes [static, inherited]
 

Definition at line 162 of file ast.h.

Referenced by gcWalker::delete_nodes(), and gcWalker::gcWalker().


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

Generated on February 1, 2006
Back to the C-Breeze home page