comma::RangeChecker Class Reference

#include <RangeChecker.h>

Collaboration diagram for comma::RangeChecker:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RangeChecker (TypeCheck &TC)
bool checkDeclarationRange (Expr *lower, Expr *upper)
 Checks a range as used in an integer type declaration.
DiscreteTypecheckDSTRange (Expr *lower, Expr *upper)
 Checks a range as used as a loop control.
DiscreteTypecheckSubtypeRange (DiscreteType *base, Expr *lower, Expr *upper)
 Checks a range for compatibility wrt a discrete type.
bool resolveRange (Range *range, DiscreteType *type)
 Resolves the type of range to the given type.

Detailed Description

Definition at line 33 of file RangeChecker.h.


Constructor & Destructor Documentation

comma::RangeChecker::RangeChecker ( TypeCheck TC  )  [inline]

Definition at line 36 of file RangeChecker.h.


Member Function Documentation

bool RangeChecker::checkDeclarationRange ( Expr lower,
Expr upper 
)

Checks a range as used in an integer type declaration.

The following method takes expressions denoting the lower and upper bounds of the range. Semantic analysis performs the following checks:

  • Resolves the lower and upper bounds to be in class integer with preference for root_integer if there is an ambiguity.
  • Ensures both the lower and upper bounds are static expressions.

Note that these types of ranges do not require that the upper and lower bounds be of the same type.

Returns true if the checks succeeded and false otherwise.

Definition at line 27 of file RangeChecker.cpp.

DiscreteType * RangeChecker::checkDSTRange ( Expr lower,
Expr upper 
)

Checks a range as used as a loop control.

The following method takes the expressions denoting the lower and upper bounds of a discrete subtype declaration (to be used as the control for a loop statement or as an index specification for an array type). Semantic analysis performs the following checks:

  • Resolves the lower and upper bounds to be of discrete types with a preference for root_integer if there is an ambiguity.
  • Ensures both the upper and lower bounds resolve to the same type.
  • If the type of the range resolves to root_integer, convert the expressions to be of type Integer (ARM 3.6.18).

Returns a discrete subtype constrained to the given bounds if the checks succeed and null otherwise.

Definition at line 44 of file RangeChecker.cpp.

DiscreteType * RangeChecker::checkSubtypeRange ( DiscreteType base,
Expr lower,
Expr upper 
)

Checks a range for compatibility wrt a discrete type.

Given a discrete subtype base, checks that the given bounds form a valid constraint over base.

Returns a discrete subtype constrined to the given bounds if the check succeeds and null otherwise.

Definition at line 105 of file RangeChecker.cpp.

bool RangeChecker::resolveRange ( Range range,
DiscreteType type 
)

Resolves the type of range to the given type.

Definition at line 115 of file RangeChecker.cpp.


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

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1