class SgSymbol

SgSymbol is the base class for the classes representing symbols

Inheritance:

SgSymbol


Public Methods

void addAttribute(int type, void *a, int size)
void addAttribute(SgAttribute *att)
void addAttribute(void *a, int size)
void addAttribute(int type)
int attributes()
the Fortran 90 attributes
int attributeType(int i)
void* attributeValue(int i)
void* attributeValue(int i, int type)
SgStatement* body()
If the symbol refers to a function, struct, subroutine or class, this returns a pointer to the SgStatement object that is the declaration of the symbol.
SgSymbol& copy()
SgSymbol& copyAcrossFiles(SgStatement &where)
special copy to move things from a file
SgSymbol& copyLevel1()
copy also parameters
SgStatement* declaredInStmt()
This method is supposed to return a pointer to the statement where the given symbol has been declared
SgStatement* declareInStmt(SgStatement *hedr_stmt)
void declareTheSymbol(SgStatement &st)
This method builds a declaration statement for the given symbol and inserts it at the top of the scope given by st
void declareTheSymbolWithParamList(SgStatement &st, SgExpression &parlist)
Similar to declareTheSymbol() but takes a second argument that is a parameter list (for function prototypes).
void* deleteAttribute(int i)
void* deleteAttribute(int i, int type)
SgAttribute* getAttribute(int i, int type)
SgAttribute* getAttribute(int i)
int id()
unique identifier
char* identifier()
the text name for the symbol
int isAssumedShapeSymbol()
if the symbol is of assumed shape spec
int isAssumedSizeSymbol()
if the symbol is of assumed size spec
int isDeferedShapeSymbol()
if the symbol is of defered shape array
SgExpression* makeDeclExpr()
Constructs a declaration expression and returns it.
SgExpression* makeDeclExprWithParamList(SgExpression &parlist)
Similar to makeDeclExpr() but takes a second argument that is a parameter list (for function prototypes).
SgVarDeclStmt* makeVarDeclStmt()
Constructs a declaration statement and returns it (without inserting it into the file)
SgVarDeclStmt* makeVarDeclStmtWithParamList(SgExpression &parlist)
Similar to makeVarDeclStmt() but takes a second argument that is a parameter list (for function prototypes)
int numberOfAttributes()
int numberOfAttributes(int type)
void removeAttribute(int attribute)
SgStatement* scope()
the SgControlStatement where defined
void setAttribute(int attribute)
void setNextInScope(SgStatement *s)
set next_symb field
void setType(SgType &t)
the type of the symbol
SgSymbol(int variant, char *name)
SgSymbol(int variant, char *identifier, SgType &t, SgStatement &scope)
SgSymbol(PTR_SYMB symb)
SgSymbol(int variant)
SgSymbol(SgSymbol &)
SgSymbol(int variant, char *identifier, SgType *t, SgStatement *scope)
SgSymbol(int variant, char *identifier, SgStatement &scope)
SgSymbol(int variant, char *identifier, SgType *type, SgStatement *scope, SgSymbol *structsymb, SgSymbol *nextfield )
SgSymbol(int variant, char *identifier, SgStatement *scope)
SgType* type()
the type of the symbol
int variant()
~SgSymbol()

Documentation

SgSymbol is the base class for the classes representing symbols. As with the other classes there is a 'variant()' which idetifies the subclass and an integer identifier 'id()'that is unique for each symbol. The symbols in each file are organized as a list which is accessible from the file object as 'SgFile::firstSymbol()' and the following symbol to the current symbol is located with 'next()'. Every symbol has a character string 'idetifier()' , a type()',which is described in detail below,and a statement called 'scope()' that is the statement in which declaration is scoped.(It is the control parent of the declaration statement). The statement where the variable is given by 'declaredInStmt()'. In addtion, there are functions that can be used to generate a copy of the synbol. There are three forms of the copy. The basic copy make a simple copy of the symbol table entry. The level one copy also generate new type information. The level two copy also copies the declaration body.
SgSymbol(int variant, char *identifier, SgType &t, SgStatement &scope)

SgSymbol(int variant, char *identifier, SgType *t, SgStatement *scope)

SgSymbol(int variant, char *identifier, SgStatement &scope)

SgSymbol(int variant, char *identifier, SgStatement *scope)

SgSymbol(int variant, char *identifier, SgType *type, SgStatement *scope, SgSymbol *structsymb, SgSymbol *nextfield )

SgSymbol(int variant, char *name)

SgSymbol(int variant)

SgSymbol(PTR_SYMB symb)

SgSymbol(SgSymbol &)

~SgSymbol()

int variant()

int id()
unique identifier

char* identifier()
the text name for the symbol

SgType* type()
the type of the symbol

void setType(SgType &t)
the type of the symbol

SgStatement* scope()
the SgControlStatement where defined

void setNextInScope(SgStatement *s)
set next_symb field

SgStatement* declaredInStmt()
This method is supposed to return a pointer to the statement where the given symbol has been declared. However, in its current implementation, the method is very slow (it does a linear search through the list of statements every time it is called) and unreliable. Often, it is better to write an extra pass through statements and attach the information about the declaration statements to SgSymbols using an SgAttribute so that, at later times, this information can be simply looked up rather than recomputed every time it is needed.

SgSymbol& copy()

SgSymbol& copyLevel1()
copy also parameters

SgSymbol& copyAcrossFiles(SgStatement &where)
special copy to move things from a file

int attributes()
the Fortran 90 attributes

void setAttribute(int attribute)

void removeAttribute(int attribute)

void declareTheSymbol(SgStatement &st)
This method builds a declaration statement for the given symbol and inserts it at the top of the scope given by st

void declareTheSymbolWithParamList(SgStatement &st, SgExpression &parlist)
Similar to declareTheSymbol() but takes a second argument that is a parameter list (for function prototypes).

SgExpression* makeDeclExpr()
Constructs a declaration expression and returns it.

SgExpression* makeDeclExprWithParamList(SgExpression &parlist)
Similar to makeDeclExpr() but takes a second argument that is a parameter list (for function prototypes).

SgVarDeclStmt* makeVarDeclStmt()
Constructs a declaration statement and returns it (without inserting it into the file)

SgVarDeclStmt* makeVarDeclStmtWithParamList(SgExpression &parlist)
Similar to makeVarDeclStmt() but takes a second argument that is a parameter list (for function prototypes)

SgStatement* body()
If the symbol refers to a function, struct, subroutine or class, this returns a pointer to the SgStatement object that is the declaration of the symbol.

int isAssumedShapeSymbol()
if the symbol is of assumed shape spec

int isAssumedSizeSymbol()
if the symbol is of assumed size spec

int isDeferedShapeSymbol()
if the symbol is of defered shape array

SgStatement* declareInStmt(SgStatement *hedr_stmt)

int numberOfAttributes()

int numberOfAttributes(int type)

void* attributeValue(int i)

int attributeType(int i)

void* attributeValue(int i, int type)

void* deleteAttribute(int i)

void* deleteAttribute(int i, int type)

void addAttribute(int type, void *a, int size)

void addAttribute(int type)

void addAttribute(void *a, int size)

void addAttribute(SgAttribute *att)

SgAttribute* getAttribute(int i)

SgAttribute* getAttribute(int i, int type)


Direct child classes:
SgVariableSymb
SgTypeSymb
SgModuleSymb
SgLabelVarSymb
SgLabelSymb
SgInterfaceSymb
SgFunctionSymb
SgFieldSymb
SgExternalSymb
SgConstructSymb
SgConstantSymb
SgClassSymb

alphabetic index hierarchy of classes


Email contact: zgs@npac.syr.edu

generated by doc++