Intel SPMD Program Compiler  1.9.1
Public Member Functions | Public Attributes | List of all members
Declarator Class Reference

Representation of the declaration of a single variable. More...

#include <decl.h>

Collaboration diagram for Declarator:
Collaboration graph
[legend]

Public Member Functions

 Declarator (DeclaratorKind dk, SourcePos p)
 
void InitFromDeclSpecs (DeclSpecs *ds)
 
void InitFromType (const Type *base, DeclSpecs *ds)
 
void Print (int indent) const
 

Public Attributes

const SourcePos pos
 
const DeclaratorKind kind
 
Declaratorchild
 
int typeQualifiers
 
StorageClass storageClass
 
int arraySize
 
std::string name
 
ExprinitExpr
 
const Typetype
 
std::vector< Declaration * > functionParams
 

Detailed Description

Representation of the declaration of a single variable.

In conjunction with an instance of the DeclSpecs, this gives us everything we need for a full variable declaration.

Definition at line 132 of file decl.h.

Constructor & Destructor Documentation

Declarator::Declarator ( DeclaratorKind  dk,
SourcePos  p 
)

Definition at line 246 of file decl.cpp.

References arraySize, child, initExpr, SC_NONE, storageClass, type, and typeQualifiers.

Referenced by InitFromType().

Member Function Documentation

void Declarator::InitFromDeclSpecs ( DeclSpecs ds)

Once a DeclSpecs instance is available, this method completes the initialization of the type member.

Definition at line 258 of file decl.cpp.

References AssertPos, DeclSpecs::declSpecList, Error(), Module::errorCount, DeclSpecs::GetBaseType(), Type::GetString(), InitFromType(), m, pos, DeclSpecs::storageClass, storageClass, and type.

Referenced by Declaration::Declaration(), and GetStructTypesNamesPositions().

void Declarator::InitFromType ( const Type base,
DeclSpecs ds 
)
void Declarator::Print ( int  indent) const

Member Data Documentation

int Declarator::arraySize

For array declarators, this gives the declared size of the array. Unsized arrays have arraySize == 0.

Definition at line 166 of file decl.h.

Referenced by Declarator(), InitFromType(), and Print().

Declarator* Declarator::child

Child pointer if needed; this can only be non-NULL if the declarator's kind isn't DK_BASE.

Definition at line 157 of file decl.h.

Referenced by Declarator(), InitFromType(), and Print().

std::vector<Declaration *> Declarator::functionParams

For function declarations, this holds the Declaration *s for the function's parameters.

Definition at line 180 of file decl.h.

Referenced by InitFromType(), and Print().

Expr* Declarator::initExpr

Initialization expression for the variable. May be NULL.

Definition at line 172 of file decl.h.

Referenced by Declarator(), Declaration::GetVariableDeclarations(), and Print().

const DeclaratorKind Declarator::kind

The kind of this declarator; complex declarations are assembled as a hierarchy of Declarators. (For example, a pointer to an int would have a root declarator with kind DK_POINTER and with the Declarator::child member pointing to a DK_BASE declarator for the int).

Definition at line 153 of file decl.h.

Referenced by InitFromType(), and Print().

std::string Declarator::name

Name associated with the declarator.

Definition at line 169 of file decl.h.

Referenced by Declaration::DeclareFunctions(), GetStructTypesNamesPositions(), Declaration::GetVariableDeclarations(), InitFromType(), and Print().

const SourcePos Declarator::pos

Position of the declarator in the source program.

Definition at line 146 of file decl.h.

Referenced by Declaration::DeclareFunctions(), GetStructTypesNamesPositions(), Declaration::GetVariableDeclarations(), InitFromDeclSpecs(), InitFromType(), and Print().

StorageClass Declarator::storageClass
const Type* Declarator::type
int Declarator::typeQualifiers

Type qualifiers provided with the declarator.

Definition at line 160 of file decl.h.

Referenced by Declarator(), InitFromType(), and Print().


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