Intel® Implicit SPMD Program Compiler (Intel® ISPC)
1.13.0
|
Representation of the declaration of a single variable. More...
#include <decl.h>
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 |
Declarator * | child |
int | typeQualifiers |
StorageClass | storageClass |
int | arraySize |
std::string | name |
Expr * | initExpr |
const Type * | type |
std::vector< Declaration * > | functionParams |
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.
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().
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().
Definition at line 326 of file decl.cpp.
References arraySize, AssertPos, child, Declarator(), Declaration::declarators, DeclSpecs::declSpecList, Declaration::declSpecs, DK_ARRAY, DK_BASE, DK_FUNCTION, DK_POINTER, DK_REFERENCE, Error(), Module::errorCount, functionParams, ArrayType::GetElementType(), Type::GetString(), PointerType::GetUniform(), InitFromType(), Type::IsSOAType(), Type::IsVoidType(), kind, lGetStorageClassName(), m, name, Optimize(), pos, Type::ResolveUnboundVariability(), SC_EXTERN_C, SC_NONE, DeclSpecs::storageClass, type, TypeCheck(), TYPEQUAL_CONST, TYPEQUAL_EXPORT, TYPEQUAL_TASK, TYPEQUAL_UNIFORM, TYPEQUAL_UNMASKED, TYPEQUAL_VARYING, DeclSpecs::typeQualifiers, typeQualifiers, Variability::Unbound, Variability::Uniform, Variability::Varying, and Warning().
Referenced by InitFromDeclSpecs(), and InitFromType().
void Declarator::Print | ( | int | indent | ) | const |
Definition at line 273 of file decl.cpp.
References arraySize, child, DK_ARRAY, DK_BASE, DK_FUNCTION, DK_POINTER, DK_REFERENCE, FATAL, functionParams, initExpr, kind, lGetStorageClassName(), lPrintTypeQualifiers(), name, pos, Expr::Print(), SourcePos::Print(), Print(), storageClass, and typeQualifiers.
Referenced by Print(), and Declaration::Print().
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().
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().
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().
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().
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().
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().
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 Declarator::storageClass |
Definition at line 154 of file decl.h.
Referenced by Declarator(), Declaration::DeclareFunctions(), Declaration::GetVariableDeclarations(), InitFromDeclSpecs(), and Print().
const Type* Declarator::type |
Type of the declarator. This is NULL until InitFromDeclSpecs() or InitFromType() is called.
Definition at line 168 of file decl.h.
Referenced by Declarator(), Declaration::DeclareFunctions(), GetStructTypesNamesPositions(), Declaration::GetVariableDeclarations(), InitFromDeclSpecs(), and InitFromType().
int Declarator::typeQualifiers |
Type qualifiers provided with the declarator.
Definition at line 152 of file decl.h.
Referenced by Declarator(), InitFromType(), and Print().