#include <TypeCheck.h>
Classes | |
struct | NodeCaster |
struct | NodeLifter |
struct | SVImpl |
Public Member Functions | |
TypeCheck (Diagnostic &diag, AstResource &resource, CompilationUnit *cunit) | |
~TypeCheck () | |
ParseClient Requirements. | |
void | beginCapsule () |
void | endCapsule () |
void | beginGenericFormals () |
void | endGenericFormals () |
void | acceptFormalDomain (IdentifierInfo *name, Location loc, Node sig) |
void | beginDomainDecl (IdentifierInfo *name, Location loc) |
void | beginSignatureDecl (IdentifierInfo *name, Location loc) |
void | beginSignatureProfile () |
void | endSignatureProfile () |
void | acceptSupersignature (Node typeNode) |
Called for each super signature defined in a signature profile. | |
void | beginAddExpression () |
void | endAddExpression () |
Completes an add expression. | |
void | acceptCarrier (IdentifierInfo *name, Location loc, Node typeNode) |
Invoked when the parser consumes a carrier declaration. | |
void | beginFunctionDeclaration (IdentifierInfo *name, Location loc) |
void | beginProcedureDeclaration (IdentifierInfo *name, Location loc) |
void | acceptSubroutineParameter (IdentifierInfo *formal, Location loc, Node typeNode, PM::ParameterMode mode) |
void | acceptFunctionReturnType (Node typeNode) |
Node | endSubroutineDeclaration (bool definitionFollows) |
Node | beginSubroutineDefinition (Node declarationNode) |
void | endSubroutineBody (Node contextNode) |
void | endSubroutineDefinition () |
Node | acceptDirectName (IdentifierInfo *name, Location loc, bool forStatement) |
Node | acceptCharacterLiteral (IdentifierInfo *lit, Location loc) |
Node | acceptSelectedComponent (Node prefix, IdentifierInfo *name, Location loc, bool forStatement) |
Node | acceptParameterAssociation (IdentifierInfo *key, Location loc, Node rhs) |
Node | acceptApplication (Node prefix, NodeVector &argNodes) |
Node | acceptAttribute (Node prefix, IdentifierInfo *name, Location loc) |
Node | finishName (Node name) |
void | beginAggregate (Location loc) |
void | acceptPositionalAggregateComponent (Node component) |
Provides a Node describing a positional component of the aggregate. | |
Node | acceptAggregateKey (Node lower, Node upper) |
Called to indicate an aggregate key in the form of a range. | |
Node | acceptAggregateKey (IdentifierInfo *name, Location loc) |
Called to indicate an aggregate key consisting of a single identifier. | |
Node | acceptAggregateKey (Node key) |
void | acceptKeyedAggregateComponent (NodeVector &keys, Node expr, Location loc) |
void | acceptAggregateOthers (Location loc, Node component) |
Node | endAggregate () |
Node | beginForStmt (Location loc, IdentifierInfo *iterName, Location iterLoc, Node control, bool isReversed) |
Node | endForStmt (Node forNode, NodeVector &bodyNodes) |
Node | acceptDSTDefinition (Node name, Node lower, Node upper) |
Node | acceptDSTDefinition (Node nameOrAttribute, bool isUnconstrained) |
Node | acceptDSTDefinition (Node lower, Node upper) |
bool | acceptObjectDeclaration (Location loc, IdentifierInfo *name, Node type, Node initializer) |
bool | acceptRenamedObjectDeclaration (Location loc, IdentifierInfo *name, Node type, Node target) |
void | acceptDeclarationInitializer (Node declNode, Node initializer) |
Node | acceptPercent (Location loc) |
bool | acceptImportDeclaration (Node importedType) |
Submits an import from the given type node. | |
Node | acceptProcedureCall (Node name) |
Node | acceptInj (Location loc, Node expr) |
Node | acceptPrj (Location loc, Node expr) |
Node | acceptIntegerLiteral (llvm::APInt &value, Location loc) |
Node | acceptStringLiteral (const char *string, unsigned len, Location loc) |
Node | acceptNullExpr (Location loc) |
Node | acceptAllocatorExpr (Node operand, Location loc) |
Node | acceptQualifiedExpr (Node qualifier, Node operand) |
Node | acceptDereference (Node prefix, Location loc) |
Node | acceptIfStmt (Location loc, Node condition, NodeVector &consequents) |
Node | acceptElseStmt (Location loc, Node ifNode, NodeVector &alternates) |
Node | acceptElsifStmt (Location loc, Node ifNode, Node condition, NodeVector &consequents) |
Node | acceptEmptyReturnStmt (Location loc) |
Node | acceptReturnStmt (Location loc, Node retNode) |
Node | acceptAssignmentStmt (Node target, Node value) |
Node | beginBlockStmt (Location loc, IdentifierInfo *label=0) |
Called when a block statement is about to be parsed. | |
void | endBlockStmt (Node block) |
Node | beginHandlerStmt (Location loc, NodeVector &choices) |
void | endHandlerStmt (Node context, Node handler) |
Node | acceptNullStmt (Location loc) |
Called to notify the client of a null statement at the given position. | |
bool | acceptStmt (Node context, Node stmt) |
Node | acceptWhileStmt (Location loc, Node condition, NodeVector &stmtNodes) |
Called to inform the client of a while statement. | |
Node | acceptLoopStmt (Location loc, NodeVector &stmtNodes) |
Called to inform the client of a loop statement. | |
Node | acceptRaiseStmt (Location loc, Node exception, Node message) |
Node | acceptPragmaStmt (IdentifierInfo *name, Location loc, NodeVector &args) |
Called when a pragma is encountered within a sequence of statements. | |
void | acceptPragmaImport (Location pragmaLoc, IdentifierInfo *convention, Location conventionLoc, IdentifierInfo *entity, Location entityLoc, Node externalNameNode) |
void | beginEnumeration (IdentifierInfo *name, Location loc) |
void | acceptEnumerationIdentifier (IdentifierInfo *name, Location loc) |
void | acceptEnumerationCharacter (IdentifierInfo *name, Location loc) |
void | endEnumeration () |
void | acceptIntegerTypeDecl (IdentifierInfo *name, Location loc, Node low, Node high) |
void | acceptRangedSubtypeDecl (IdentifierInfo *name, Location loc, Node subtype, Node low, Node high) |
void | acceptSubtypeDecl (IdentifierInfo *name, Location loc, Node subtype) |
void | acceptIncompleteTypeDecl (IdentifierInfo *name, Location loc) |
void | acceptAccessTypeDecl (IdentifierInfo *name, Location loc, Node subtype) |
Called to notify the client of an access type declaration. | |
void | acceptArrayDecl (IdentifierInfo *name, Location loc, NodeVector indices, Node component) |
Communicates an array type declaration. | |
void | beginRecord (IdentifierInfo *name, Location loc) |
void | acceptRecordComponent (IdentifierInfo *name, Location loc, Node type) |
void | endRecord () |
Completes the definition of a record type. | |
void | deleteNode (Node &node) |
Generic Accessors and Predicates. | |
bool | checkSuccessful () const |
Returns true if the type checker has not encountered an error and false otherwise. | |
CompilationUnit * | getCompilationUnit () const |
Diagnostic & | getDiagnostic () |
Returns the Diagnostic object thru which diagnostics are posted. | |
AstResource & | getAstResource () |
Returns the AstResource used by the type checker to construct AST nodes. | |
General Semantic Analysis. | |
| |
Type * | getCoveringDereference (Type *source, Type *target) |
Type * | getCoveringDereference (Type *source, Type::Classification ID) |
Expr * | implicitlyDereference (Expr *expr, Type *target) |
Expr * | implicitlyDereference (Expr *expr, Type::Classification ID) |
Expr * | checkExprInContext (Expr *expr, Type *context) |
Typechecks the given expression in the given type context. | |
bool | checkExprInContext (Expr *expr, Type::Classification ID) |
Expr * | checkExprAndDereferenceInContext (Expr *expr, Type *context) |
bool | ensureStaticIntegerExpr (Expr *expr, llvm::APInt &result) |
bool | ensureStaticIntegerExpr (Expr *expr) |
Expr * | ensureExpr (Node node) |
Expr * | ensureExpr (Ast *node) |
Ast * | checkDirectName (IdentifierInfo *name, Location loc, bool forStatement) |
static bool | conversionRequired (Type *source, Type *target) |
static Expr * | convertIfNeeded (Expr *expr, Type *target) |
Wraps the given expression in a ConversionExpr if needed. | |
static bool | covers (Type *A, Type *B) |
Basic type equality predicate. |
Definition at line 35 of file TypeCheck.h.
TypeCheck::TypeCheck | ( | Diagnostic & | diag, | |
AstResource & | resource, | |||
CompilationUnit * | cunit | |||
) |
Definition at line 37 of file TypeCheck.cpp.
TypeCheck::~TypeCheck | ( | ) |
Definition at line 47 of file TypeCheck.cpp.
void TypeCheck::acceptAccessTypeDecl | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | subtype | |||
) | [virtual] |
Called to notify the client of an access type declaration.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1040 of file TypeCheck.cpp.
Called to indicate an aggregate key consisting of an expression or subtype indication.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1018 of file CheckAgg.cpp.
Node TypeCheck::acceptAggregateKey | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Called to indicate an aggregate key consisting of a single identifier.
This callback is provided to support selectors of a record aggregate. Since Comma aggregates cannot be resolved without a type context it is not reasonable to expect a ParseClient implementation to divine the meaning of aggregate keys. This callback allows a client to defer the processing of aggregate keys which may resolve to a record selector or to a direct name until enough context is established.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1011 of file CheckAgg.cpp.
Called to indicate an aggregate key in the form of a range.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 996 of file CheckAgg.cpp.
Indicates an "others" component. If this callback is invoked, it is always the last component processed by the parser.
loc | Location of the "others" reserved word. | |
component | An expression denoting the default value for this aggregate, or a null node if others => <> was parsed. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1079 of file CheckAgg.cpp.
Incoked whten the parser encounters an allocator expression.
operand | The argument to the allocator. This is either a name or result of acceptQualifiedExpr. | |
loc | Location of the "new" reserved word. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 461 of file CheckExpr.cpp.
Node TypeCheck::acceptApplication | ( | Node | prefix, | |
NodeVector & | argNodes | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 349 of file CheckName.cpp.
void TypeCheck::acceptArrayDecl | ( | IdentifierInfo * | name, | |
Location | loc, | |||
NodeVector | indices, | |||
Node | component | |||
) | [virtual] |
Communicates an array type declaration.
name | The name of this array type declaration. | |
loc | the location of name . | |
indices | A set of nodes defining the index specification for this array, each being the result of a call to acceptDSTDefinition. | |
component | The component type of the array declaration. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 933 of file TypeCheck.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 85 of file CheckStmt.cpp.
Node TypeCheck::acceptAttribute | ( | Node | prefix, | |
IdentifierInfo * | name, | |||
Location | loc | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 621 of file CheckName.cpp.
void TypeCheck::acceptCarrier | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | typeNode | |||
) | [virtual] |
Invoked when the parser consumes a carrier declaration.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 273 of file CheckCapsule.cpp.
Node TypeCheck::acceptCharacterLiteral | ( | IdentifierInfo * | lit, | |
Location | loc | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 178 of file CheckName.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Notifies the client of an explicit dereference expression.
prefix | The name to be dereferenced. | |
loc | Location of the reserved word all . |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 498 of file CheckExpr.cpp.
Node TypeCheck::acceptDirectName | ( | IdentifierInfo * | name, | |
Location | loc, | |||
bool | forStatement | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 72 of file CheckName.cpp.
Indicates a discrete subtype definition that was sepcified using only a range.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1124 of file TypeCheck.cpp.
Indicates a discrete subtype definition which was specified using a name which may include a range attribute. If isUnconstrained
is true, then the given node was followed by the "range <>" syntax, and the parser is in the midst of processing an array type definition.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1095 of file TypeCheck.cpp.
Indicates a discrete subtype definition which was accompanied by a range constraint.
name | The subtype mark of this definition. | |
lower | The lower bound of the range constraint. | |
upper | The upper bound of the range constraint. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1060 of file TypeCheck.cpp.
Node TypeCheck::acceptElseStmt | ( | Location | loc, | |
Node | ifNode, | |||
NodeVector & | alternates | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 141 of file CheckStmt.cpp.
Node TypeCheck::acceptElsifStmt | ( | Location | loc, | |
Node | ifNode, | |||
Node | condition, | |||
NodeVector & | consequents | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 159 of file CheckStmt.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 73 of file CheckStmt.cpp.
void TypeCheck::acceptEnumerationCharacter | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Called to introduce an enumeration component which was defined using character syntax.
name | The name of the character literal defining this component. This is always the full name of the literal. For example, the character literal for X is named using the string "'X'" (note that the quotes are included). | |
loc | The location of the defining character literal. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 727 of file TypeCheck.cpp.
void TypeCheck::acceptEnumerationIdentifier | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Called to introduce an enumeration component which was defined using identifier syntax.
name | The defining identifier for this component. | |
loc | The location of the defining identifier. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 722 of file TypeCheck.cpp.
void TypeCheck::acceptFormalDomain | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | sig | |||
) | [virtual] |
Called to notify the client of a generic formal domain parameter.
name | The defining identifier of the domain. | |
loc | Location of the defining identifier. | |
sig | If the formal domain was specified as satisfying a particular signature, sig is a valid node as returned by a call to parseName(). Otherwise sig is a null node. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 69 of file CheckCapsule.cpp.
void TypeCheck::acceptFunctionReturnType | ( | Node | typeNode | ) | [virtual] |
When parsing a function declaration, this callback is invoked to notify the client of the declarations return type.
If the function declaration was missing a return type, or the node returned by the client representing the type is invalid, this callback is passed a null node as argument. Note that the parser posts a diagnostic for the case of a missing return.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 87 of file CheckSubroutine.cpp.
Node TypeCheck::acceptIfStmt | ( | Location | loc, | |
Node | condition, | |||
NodeVector & | consequents | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 121 of file CheckStmt.cpp.
bool TypeCheck::acceptImportDeclaration | ( | Node | importedType | ) | [virtual] |
Submits an import from the given type node.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 687 of file TypeCheck.cpp.
void TypeCheck::acceptIncompleteTypeDecl | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Called to notify the client of an incomplete type declaration.
This callback is invoked when processing type declarations of the form type Foo;<>.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 924 of file TypeCheck.cpp.
Called for "inj" expressions. loc is the location of the inj token and expr is its argument.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 382 of file CheckExpr.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 434 of file CheckExpr.cpp.
void TypeCheck::acceptIntegerTypeDecl | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | low, | |||
Node | high | |||
) | [virtual] |
Called to process integer type declarations.
For example, given a definition of the form type T is range X..Y;
, this callback is invoked with name
set to the identifier T
, loc
set to the location of name
, low
set to the expression X
, and high
set to the expression Y
.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 789 of file TypeCheck.cpp.
void TypeCheck::acceptKeyedAggregateComponent | ( | NodeVector & | keys, | |
Node | expr, | |||
Location | loc | |||
) | [virtual] |
Provides a vector of keys and associated expression for a keyed aggregate component.
keys | A vector of valid nodes as returned by acceptAggregateKey. | |
expr | Expression denoting the value associated with the given keys, or a null node if a diamond was parsed. | |
loc | Location of the given expression (for use when expr is null). |
keys
may be empty if none of the keys parsed correctly or the client returned an invalid node for them all. FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1045 of file CheckAgg.cpp.
Node TypeCheck::acceptLoopStmt | ( | Location | loc, | |
NodeVector & | stmtNodes | |||
) | [virtual] |
Called to inform the client of a loop statement.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 253 of file CheckStmt.cpp.
Invoked when the parser encounters the "null" reserved word in an expression context.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 453 of file CheckExpr.cpp.
Called to notify the client of a null statement at the given position.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 401 of file CheckStmt.cpp.
bool TypeCheck::acceptObjectDeclaration | ( | Location | loc, | |
IdentifierInfo * | name, | |||
Node | type, | |||
Node | initializer | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 619 of file TypeCheck.cpp.
Node TypeCheck::acceptParameterAssociation | ( | IdentifierInfo * | key, | |
Location | loc, | |||
Node | rhs | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 325 of file CheckName.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 161 of file TypeCheck.cpp.
void TypeCheck::acceptPositionalAggregateComponent | ( | Node | component | ) | [virtual] |
Provides a Node describing a positional component of the aggregate.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 989 of file CheckAgg.cpp.
void TypeCheck::acceptPragmaImport | ( | Location | pragmaLoc, | |
IdentifierInfo * | convention, | |||
Location | conventionLoc, | |||
IdentifierInfo * | enity, | |||
Location | entityLoc, | |||
Node | externalNameNode | |||
) | [virtual] |
Called when a pragma Import is encountered. These pragmas can occur when processing a list of declarative items.
pragmaLoc | The location of the Import identifier. | |
convention | An identifier naming the convention to be used. Note that the parser does not know what identifiers name valid conventions. | |
conventionLoc | The location of the convention identifier. | |
entity | The identifier naming the entity to import. | |
entityLoc | The location of the entity identifier. | |
externalNameNode | An arbitrary expression node. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1324 of file TypeCheck.cpp.
Node TypeCheck::acceptPragmaStmt | ( | IdentifierInfo * | name, | |
Location | loc, | |||
NodeVector & | pragmaArgs | |||
) | [virtual] |
Called when a pragma is encountered within a sequence of statements.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 311 of file CheckStmt.cpp.
Called for "prj" expressions. loc is the location of the prj token and expr is its argument.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 408 of file CheckExpr.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 30 of file CheckStmt.cpp.
Invoked when the parser encounters a qualified expression.
qualifier | A node corresponding to the qualified name. | |
operand | The expression to qualify. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 477 of file CheckExpr.cpp.
Called to inform the client of a raise statement.
loc | Location of the `raise' reserved word. | |
exception | Node representing the exception to be thrown (as obtained thru the name callbacks). | |
message | Contains the expression node to be associated with the `raise', or a null-node if there was no expression. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 332 of file CheckStmt.cpp.
void TypeCheck::acceptRangedSubtypeDecl | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | subtype, | |||
Node | low, | |||
Node | high | |||
) | [virtual] |
Called to process a range constrained discrete subtype declaration.
For example, given a declaration of the form subtype S is T range X..Y;
, this callback is invoked with name
set to the identifier S
, loc
set to the location of name
, and subtype
set to the subtype indication T
, and the last two arguments (low
and high
) represent the lower and upper bounds of the range constraint.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 814 of file TypeCheck.cpp.
void TypeCheck::acceptRecordComponent | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | type | |||
) | [virtual] |
Called to notify the client of a record component.
name | The defining identifier for this record component. | |
loc | The location of the components defining identifier. | |
type | A node representing the type of this identifier. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1006 of file TypeCheck.cpp.
bool TypeCheck::acceptRenamedObjectDeclaration | ( | Location | loc, | |
IdentifierInfo * | name, | |||
Node | type, | |||
Node | target | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 658 of file TypeCheck.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 49 of file CheckStmt.cpp.
Node TypeCheck::acceptSelectedComponent | ( | Node | prefix, | |
IdentifierInfo * | name, | |||
Location | loc, | |||
bool | forStatement | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 302 of file CheckName.cpp.
Called to notify the client that a statement has been completely parsed.
context | The result of a call to beginBlockStmt or beginSubroutineDefinition, indicating in which context stmt appeared in. | |
stmt | The actual Node representing the statement (as returned from accpetIfStmt, acceptAssignmentStmt, etc). |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 202 of file CheckStmt.cpp.
Invoked when the parser encounters a string literal.
string | A pointer to the first quotation character of the string literal. The string is not necessarily null terminated, and is owned by the parser. Clients should copy the contents of the string if needed. | |
len | The number of characters in the string. | |
loc | The location of the first quotation character. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1111 of file CheckAgg.cpp.
void TypeCheck::acceptSubroutineParameter | ( | IdentifierInfo * | formal, | |
Location | loc, | |||
Node | typeNode, | |||
PM::ParameterMode | mode | |||
) | [virtual] |
For each subroutine parameter, acceptSubroutineParameter is called providing:
formal | The name of the formal parameter. | |
loc | The location of the formal parameter name. | |
typeNode | A node describing the type of the parameter (the result of a call to acceptTypeName or acceptTypeApplication, for example). | |
mode | The parameter mode, wher PM::MODE_DEFAULT is supplied if an explicit mode was not parsed. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 41 of file CheckSubroutine.cpp.
void TypeCheck::acceptSubtypeDecl | ( | IdentifierInfo * | name, | |
Location | loc, | |||
Node | subtype | |||
) | [virtual] |
Called to process an unconstrained subtype declaration.
For example, given a declaration of the form subtype S is T;
, this callback is invoked with name
set to the identifier S
, loc
set to the location of name
, and subtype
set to the subtype indication T
.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 876 of file TypeCheck.cpp.
void TypeCheck::acceptSupersignature | ( | Node | typeNode | ) | [virtual] |
Called for each super signature defined in a signature profile.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 150 of file CheckCapsule.cpp.
Node TypeCheck::acceptWhileStmt | ( | Location | loc, | |
Node | condition, | |||
NodeVector & | stmtNodes | |||
) | [virtual] |
Called to inform the client of a while statement.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 233 of file CheckStmt.cpp.
void TypeCheck::beginAddExpression | ( | ) | [virtual] |
Called at the begining of an add expression. The client accepts components of an add expression after this call until endAddExpression is called.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 255 of file CheckCapsule.cpp.
void TypeCheck::beginAggregate | ( | Location | loc | ) | [virtual] |
The start of an aggregate expression is communicated to the client with a call to beginAggregate(). For each component of the aggregate acceptAggregateComponent() is called. The end of the aggregate expression is voiced with a call to endAggregate(). Signals that an aggregate expression is about to be processed.
loc | Location of opening paren starting the aggregate. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 984 of file CheckAgg.cpp.
Node TypeCheck::beginBlockStmt | ( | Location | loc, | |
IdentifierInfo * | label = 0 | |||
) | [virtual] |
Called when a block statement is about to be parsed.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 182 of file CheckStmt.cpp.
void TypeCheck::beginCapsule | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 29 of file CheckCapsule.cpp.
void TypeCheck::beginDomainDecl | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 101 of file CheckCapsule.cpp.
void TypeCheck::beginEnumeration | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Establishes a context beginning an enumeration type declaration.
name | The name of this enumeration type declaration. | |
loc | The location of the enumerations name. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 717 of file TypeCheck.cpp.
Node TypeCheck::beginForStmt | ( | Location | loc, | |
IdentifierInfo * | iterName, | |||
Location | iterLoc, | |||
Node | control, | |||
bool | isReversed | |||
) | [virtual] |
Begins a for
statement.
loc | Location of the for reserved word. | |
iterName | Defining identifier for the loop parameter. | |
iterLoc | Location of iterName . | |
control | A node representing the subtype definition, range, or range attribute controlling this loop. This node is obtained by a call to acceptDSTDefinition. | |
isReversed | Set to true when the reverse reserved word was present in the loop specification. |
for
loop being processed. The returned value is supplied to the corresponding endForStmt() call. FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 266 of file CheckStmt.cpp.
void TypeCheck::beginFunctionDeclaration | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
When parsing a function declaration, this callback is invoked to notify the client of the declarations return type.
If the function declaration was missing a return type, or the node returned by the client representing the type is invalid, this callback is passed a null node as argument. Note that the parser posts a diagnostic for the case of a missing return.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 31 of file CheckSubroutine.cpp.
void TypeCheck::beginGenericFormals | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 62 of file CheckCapsule.cpp.
Node TypeCheck::beginHandlerStmt | ( | Location | loc, | |
NodeVector & | choices | |||
) | [virtual] |
Begins an exception handler.
loc | Location of the when reserved word. | |
choices | Set of valid nodes as procudueced by the name callbacks representing the set of exceptions this handler covers. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 357 of file CheckStmt.cpp.
void TypeCheck::beginProcedureDeclaration | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
When parsing a function declaration, this callback is invoked to notify the client of the declarations return type.
If the function declaration was missing a return type, or the node returned by the client representing the type is invalid, this callback is passed a null node as argument. Note that the parser posts a diagnostic for the case of a missing return.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 36 of file CheckSubroutine.cpp.
void TypeCheck::beginRecord | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
Begins the definition of a record type.
name | The defining identifier for this record. | |
loc | The location of the defining identifier. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 997 of file TypeCheck.cpp.
void TypeCheck::beginSignatureDecl | ( | IdentifierInfo * | name, | |
Location | loc | |||
) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 115 of file CheckCapsule.cpp.
void TypeCheck::beginSignatureProfile | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 169 of file CheckCapsule.cpp.
Once a declaration has been parsed, a context for a definition is introduced with a call to beginSubroutineDefinition (assuming the declaration has a definition), passing in the node returned from endSubroutineDeclaration. The returned Node will be used as the first parameter to acceptStmt and endHandlerStmt for each statement and exception handler constituting the definition.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 202 of file CheckSubroutine.cpp.
Ast * TypeCheck::checkDirectName | ( | IdentifierInfo * | name, | |
Location | loc, | |||
bool | forStatement | |||
) |
Checks that the given identifier is a valid direct name. Returns an Ast node representing the name if the checks succeed and null otherwise.
name | The identifier to check. | |
loc | The location of name . | |
forStatement | If true, check that name denotes a procedure. |
Definition at line 81 of file CheckName.cpp.
Typechecks the given resolved expression in the given type context introducing any implicit dereferences required to conform to the context type.
Returns the (possibly updated) expression on success or null on error.
Definition at line 171 of file CheckExpr.cpp.
bool TypeCheck::checkExprInContext | ( | Expr * | expr, | |
Type::Classification | ID | |||
) |
Typechecks the given expression using the given type classification as context. This method returns true if the expression was successfully checked. Otherwise, false is returned an diagnostics are emitted.
Definition at line 143 of file CheckExpr.cpp.
Typechecks the given expression in the given type context.
This is a main entry point into the top-down phase of the type checker. This method returns a potentially different expression from its argument on success and null on failure.
Definition at line 105 of file CheckExpr.cpp.
bool comma::TypeCheck::checkSuccessful | ( | ) | const [inline, virtual] |
Returns true if the type checker has not encountered an error and false otherwise.
Implements comma::Checker.
Definition at line 221 of file TypeCheck.h.
Returns true if the type source
requires a conversion to be compatible with the type target
.
Definition at line 1232 of file TypeCheck.cpp.
Wraps the given expression in a ConversionExpr if needed.
Definition at line 1271 of file TypeCheck.cpp.
Basic type equality predicate.
Definition at line 1211 of file TypeCheck.cpp.
void TypeCheck::deleteNode | ( | Node & | node | ) | [virtual] |
Nodes do not know the representation of the data they carry. This method is called by Nodes once their reference counts drop to zero. The implementation need not delete the node as a result of this call -- it might choose to cache it, for instance.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 86 of file TypeCheck.cpp.
void TypeCheck::endAddExpression | ( | ) | [virtual] |
Completes an add expression.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 265 of file CheckCapsule.cpp.
Node TypeCheck::endAggregate | ( | ) | [virtual] |
Signals that an aggregate expression has completed.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1093 of file CheckAgg.cpp.
void TypeCheck::endBlockStmt | ( | Node | block | ) | [virtual] |
Once the last statement of a block has been parsed, this method is called to inform the client that we are leaving the block context established by the last call to beginBlockStmt.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 196 of file CheckStmt.cpp.
void TypeCheck::endCapsule | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 40 of file CheckCapsule.cpp.
void TypeCheck::endEnumeration | ( | ) | [virtual] |
Called when all of the enumeration literals have been processed, thus completing the definition of the enumeration.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 760 of file TypeCheck.cpp.
Node TypeCheck::endForStmt | ( | Node | forNode, | |
NodeVector & | bodyNodes | |||
) | [virtual] |
Terminates a for
statement.
forNode | The Node returned by the previous call to beginForStmt(). | |
bodyNodes | A vector of nodes corresponding to each statement in the loop body. |
for
stmt. FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 285 of file CheckStmt.cpp.
void TypeCheck::endGenericFormals | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 67 of file CheckCapsule.cpp.
Completes an exception handler.
context | A Node which this handler should be associated with. This is the result of a call to beginSubroutineDefinition or beginBlockStmt. | |
handler | The Node returned by a call to beginHandlerStmt. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 385 of file CheckStmt.cpp.
void TypeCheck::endRecord | ( | ) | [virtual] |
Completes the definition of a record type.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 1030 of file TypeCheck.cpp.
void TypeCheck::endSignatureProfile | ( | ) | [virtual] |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 176 of file CheckCapsule.cpp.
void TypeCheck::endSubroutineBody | ( | Node | context | ) | [virtual] |
Once the sequence of statements constituting the body of the subroutine has been parsed (not counting any exception handlers), this method is invoked to inform the client of the completion of the body.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 229 of file CheckSubroutine.cpp.
Node TypeCheck::endSubroutineDeclaration | ( | bool | definitionFollows | ) | [virtual] |
Called to terminate the context of a subroutine declaration.
definitionFollows | Set to true if the parser sees a is token following the declaration and thus expects a definition to follow. |
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 106 of file CheckSubroutine.cpp.
void TypeCheck::endSubroutineDefinition | ( | ) | [virtual] |
Once endSubroutineBody has been called and any exception handlers have been processed this callback is invoked to signal the completion of the definition.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 270 of file CheckSubroutine.cpp.
Checks if node
resolves to an expression and returns that expression on success. Else null is returned and diagnostics are posted.
Definition at line 29 of file CheckExpr.cpp.
Checks if node
resolves to an expression and returns that expression on success. Else null is returned and diagnostics are posted.
Definition at line 24 of file CheckExpr.cpp.
bool TypeCheck::ensureStaticIntegerExpr | ( | Expr * | expr | ) |
Returns true if expr
is a static integer expression. Otherwise false is returned and diagnostics are posted.
Definition at line 511 of file TypeCheck.cpp.
bool TypeCheck::ensureStaticIntegerExpr | ( | Expr * | expr, | |
llvm::APInt & | result | |||
) |
Returns true if expr
is a static integer expression. If so, initializes result
to a signed value which can accommodate the given static expression.
Definition at line 501 of file TypeCheck.cpp.
FIXME: The only kind of unconstrained subtype declarations we currently support are discrete subtypes.
Implements comma::ParseClient.
Definition at line 637 of file CheckName.cpp.
AstResource& comma::TypeCheck::getAstResource | ( | ) | [inline] |
Returns the AstResource used by the type checker to construct AST nodes.
Definition at line 231 of file TypeCheck.h.
CompilationUnit* comma::TypeCheck::getCompilationUnit | ( | ) | const [inline, virtual] |
Returns the compilation which this type checker populates with well formed top-level nodes.
Implements comma::Checker.
Definition at line 225 of file TypeCheck.h.
Type * TypeCheck::getCoveringDereference | ( | Type * | source, | |
Type::Classification | ID | |||
) |
Returns a dereferenced type of source
which satisfies the given target classification or null if no such type exists.
Definition at line 1288 of file TypeCheck.cpp.
Returns a dereferenced type of source
which covers the type target
or null if no such type exists.
Definition at line 1278 of file TypeCheck.cpp.
Diagnostic& comma::TypeCheck::getDiagnostic | ( | ) | [inline] |
Returns the Diagnostic object thru which diagnostics are posted.
Definition at line 228 of file TypeCheck.h.
Expr * TypeCheck::implicitlyDereference | ( | Expr * | expr, | |
Type::Classification | ID | |||
) |
Implicitly wraps the given expression in DereferenceExpr nodes utill its type satisfies the given type classification.
The given expression must have an access type which can be dereferenced to yield a type beloging to the given classification.
Definition at line 1311 of file TypeCheck.cpp.
Implicitly wraps the given expression in DereferenceExpr nodes utill its type covers target
.
The given expression must have an access type which can be dereferenced to the given target type.
Definition at line 1298 of file TypeCheck.cpp.