Intel® Implicit SPMD Program Compiler (Intel® ISPC)  1.13.0
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 124 of file decl.h.

Constructor & Destructor Documentation

◆ Declarator()

Declarator::Declarator ( DeclaratorKind  dk,
SourcePos  p 
)

Definition at line 244 of file decl.cpp.

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

Referenced by InitFromType().

Member Function Documentation

◆ InitFromDeclSpecs()

void Declarator::InitFromDeclSpecs ( DeclSpecs ds)

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

Definition at line 253 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().

◆ InitFromType()

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

◆ Print()

void Declarator::Print ( int  indent) const

Member Data Documentation

◆ arraySize

int Declarator::arraySize

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

Definition at line 158 of file decl.h.

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

◆ child

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 149 of file decl.h.

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

◆ functionParams

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

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

Definition at line 172 of file decl.h.

Referenced by InitFromType(), and Print().

◆ initExpr

Expr* Declarator::initExpr

Initialization expression for the variable. May be NULL.

Definition at line 164 of file decl.h.

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

◆ kind

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 145 of file decl.h.

Referenced by InitFromType(), and Print().

◆ name

std::string Declarator::name

Name associated with the declarator.

Definition at line 161 of file decl.h.

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

◆ pos

const SourcePos Declarator::pos

Position of the declarator in the source program.

Definition at line 138 of file decl.h.

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

◆ storageClass

StorageClass Declarator::storageClass

◆ type

const Type* Declarator::type

◆ typeQualifiers

int Declarator::typeQualifiers

Type qualifiers provided with the declarator.

Definition at line 152 of file decl.h.

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


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