class SgStatement

Represents the fundamental class for all statements.

Inheritance:

SgStatement


Public Methods

void addAttribute(void *a, int size)
no type specifed
void addAttribute(int type, void *a, int size)
void * can be NULL;
void addAttribute(int type)
void * is NULL;
void addAttribute(SgAttribute *att)
void addComment(char *com)
void addDeclSpec(int type)
type should be one of BIT_EXTERN BIT_INLINE, _FRIEND, BIT_STATIC
int attributeType(int i)
void* attributeValue(int i, int type)
only considering one type attribute
void* attributeValue(int i)
SgStatement* childList1(int i)
Returns the ith statement in this statement's first list of child statements.
SgStatement* childList2(int i)
Returns the ith statement in this statement's second list of child statements.
void clearDeclSpec()
resets the decl_specs field to zero
char* comments()
Preceeding comments are appended to the right of the statement.
SgStatement* controlParent()
Returns the statement of this statement's control parent.
SgStatement& copy(void)
SgStatement& copyBlock(void)
SgStatement* copyBlockPtr(void)
SgStatement& copyOne(void)
SgStatement* copyOnePtr(void)
SgStatement* copyPtr(void)
void deleteAllAttribute(int type)
void deleteAllAttribute()
void* deleteAttribute(int i, int type)
void* deleteAttribute(int i)
void deleteStmt()
Removes this statement from the parse tree, and frees the memory associated with it.
SgExpression* expr(int i)
i = 0,1,2 returns the i-th expression
SgStatement* extractStmt()
Removes this statement from the parse tree, and returns a pointer to the removed statement.
SgStatement* extractStmtBody()
If the statement is not a leaf of the parse tree, this function extracts the subtree it defines from the parse tree, and returns a pointer to the first statement in the tree
char* fileName()
Returns the name of the enclosing file.
SgStatement* firstExecutable()
SgStatement* firstStmtForDeclaration()
pass all the statement that is IMPLICIT and use and PARM_DECL
SgAttribute* getAttribute(int i)
SgAttribute* getAttribute(int i, int type)
SgStatement* getScopeForDeclare()
return where a variable can be declared
int hasAnnotations()
1 if there are annotations; 0 otherwise
int hasLabel()
Returns non-zero if there is a label associated with the statement.
int hasSymbol()
Returns non-zero if there is a symbol associated with the statement.
int id()
Returns the id of the statement.
void insertStmtAfter(SgStatement &s, SgStatement &cp)
Inserts statement s after this one. Set's s's control parent to cp.
void insertStmtAfter(SgStatement &s)
Inserts statement s after this one.
void insertStmtBefore(SgStatement &s)
Inserts statement s before this one.
void insertStmtBefore(SgStatement &s, SgStatement &cp)
Inserts statement s before this one. Set's s's control parent to cp.
int isExtern()
int isFriend()
returns non-zero if friend modifier set returns zero otherwise
int isIncludedInStmt(SgStatement &s)
int isInline()
int isStatic()
SgLabel* label()
If the statement has a label, this function returns it.
SgStatement* lastDeclaration()
If the statement is not a leaf of the parse tree, this function returns a pointer to the last declaration in the subtree the statement represent.
SgStatement* lastExecutable()
If the statement is not a leaf of the parse tree, this function returns the last executable statement in the subtree the statement defines
SgStatement* lastNodeOfStmt()
If the statement is not a leaf of the parse tree, this function returns a pointer to the last statement in the subtree defines.
SgStatement* lexNext()
Returns the statement's lexical successor statement.
SgStatement* lexPrev()
Returns the statement's lexical predecessor statement.
int lineNumber()
Returns the line number of the statment in the original source file.
SgStatement* nextInChildList()
Returns the next statement in this statement's child list.
SgStatement* nodeBefore()
int numberOfAttributes()
int numberOfAttributes(int type)
int numberOfChildrenList1()
Returns the number of children in this statement's first list of child statements.
int numberOfChildrenList2()
Returns the number of children in this statement's second list of child statements.
int numberOfComments()
number of preceeding comments.
void replaceSymbByExp(SgSymbol &symb, SgExpression &exp)
void replaceSymbBySymb(SgSymbol &symb, SgSymbol &newsymb)
void replaceSymbBySymbSameName(SgSymbol &symb, SgSymbol &newsymb)
void replaceTypeInStmt(SgType &old, SgType &newtype)
void replaceWithStmt(SgStatement &s)
Replaces this statement with statement s.
void setComments(char *comments)
setComments: set ALL of the node's comments
void setControlParent(SgStatement &s)
Sets this statement's control parent statement.
void setExpression(int i, SgExpression &e)
Set's the statement's ith expression to e.
void setId(int n)
Sets the id of the statement.
void setLabel(SgLabel &l)
Sets the statement's label.
void setLabel(SgLabel * l)
Sets the statement's label.
void setLexNext(SgStatement &s)
Sets this statement's lexical successor statement.
void setlineNumber(int n)
Sets the line number of the statement.
void setSymbol(SgSymbol &s)
Sets the statement's symbol.
void setVariant(int n)
Sets the statement's variant.
SgStatement(int code, SgLabel *lab, SgSymbol *symb, SgExpression *e1, SgExpression *e2, SgExpression *e3)
SgStatement(SgStatement &)
SgStatement(PTR_BFND bif)
Returns an SgStatement corresponding to the bif node bif.
SgStatement(int variant)
Creates a SgStatement with variant variant.
SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename, int counter)
SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename)
SgSymbol* SgStatement::getSymbolInCurrentScope(char * name)
SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename, int c1, int c2)
SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename, int counter)
SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename, int c1, int c2)
SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * name)
SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename)
void simpledeleteStmt()
void sunparse(char *buffer)
unparsing functions
SgSymbol* symbol()
If there is a symbol associated with the statement, this function returns it
char* unparse()
void unparsestdout()
int variant()
Returns the statement's variant, which can be used to determine what kind of statement it actually is.
~SgStatement()

Documentation

Files are broken down into statements, 'SgStatement' is the base class for the representation of statements. SgStatement has mant derived classes,corresponding to the many different kinds of statements in the languages Sage++ can deal with. Each statement has a unique integer idetifier id, and an integer variant tag which can be used to idetify its type. These are available through SgStatement's 'id()' and 'variant()' member functions. SgStatement's 'thebif' member provides access to the low level representation of statements, bif nodes. Each statement has a context: it may have a lexical predecessor and a lexical successor, and it may be nested within a control block of another statement, or in a block structured definition like a C struct. This enclosing statement is called the control parent; it defines the structure of the parse tree.
SgStatement(int variant)
Creates a SgStatement with variant variant.

SgStatement(PTR_BFND bif)
Returns an SgStatement corresponding to the bif node bif.

SgStatement(int code, SgLabel *lab, SgSymbol *symb, SgExpression *e1, SgExpression *e2, SgExpression *e3)

SgStatement(SgStatement &)

int lineNumber()
Returns the line number of the statment in the original source file.

int id()
Returns the id of the statement.

int variant()
Returns the statement's variant, which can be used to determine what kind of statement it actually is.

SgExpression* expr(int i)
i = 0,1,2 returns the i-th expression. There can be up to three expressions associated with any statement. For example, the C 'for' loop is of the form 'for(expr_1;expr_2;expr_3)'.

int hasSymbol()
Returns non-zero if there is a symbol associated with the statement.

SgSymbol* symbol()
If there is a symbol associated with the statement, this function returns it. This symbol is used for the name of a subroutine in a subroutine header statement, and, in Fortran only, for the induction variable of a DO loop.

char* fileName()
Returns the name of the enclosing file.

int hasLabel()
Returns non-zero if there is a label associated with the statement.

SgLabel* label()
If the statement has a label, this function returns it.

void setlineNumber(int n)
Sets the line number of the statement.

void setId(int n)
Sets the id of the statement.

void setVariant(int n)
Sets the statement's variant.

void setExpression(int i, SgExpression &e)
Set's the statement's ith expression to e.

void setLabel(SgLabel &l)
Sets the statement's label.

void setLabel(SgLabel * l)
Sets the statement's label.

void setSymbol(SgSymbol &s)
Sets the statement's symbol.

SgStatement* lexNext()
Returns the statement's lexical successor statement.

SgStatement* lexPrev()
Returns the statement's lexical predecessor statement.

SgStatement* controlParent()
Returns the statement of this statement's control parent.

void setLexNext(SgStatement &s)
Sets this statement's lexical successor statement.

void setControlParent(SgStatement &s)
Sets this statement's control parent statement.

int numberOfChildrenList1()
Returns the number of children in this statement's first list of child statements.

int numberOfChildrenList2()
Returns the number of children in this statement's second list of child statements.

SgStatement* childList1(int i)
Returns the ith statement in this statement's first list of child statements.

SgStatement* childList2(int i)
Returns the ith statement in this statement's second list of child statements.

SgStatement* nextInChildList()
Returns the next statement in this statement's child list.

SgStatement* firstStmtForDeclaration()
pass all the statement that is IMPLICIT and use and PARM_DECL

SgStatement* lastDeclaration()
If the statement is not a leaf of the parse tree, this function returns a pointer to the last declaration in the subtree the statement represent.

SgStatement* firstExecutable()

SgStatement* lastExecutable()
If the statement is not a leaf of the parse tree, this function returns the last executable statement in the subtree the statement defines. This method is not useful in C++.

SgStatement* lastNodeOfStmt()
If the statement is not a leaf of the parse tree, this function returns a pointer to the last statement in the subtree defines.

SgStatement* nodeBefore()

void insertStmtBefore(SgStatement &s)
Inserts statement s before this one.

void insertStmtBefore(SgStatement &s, SgStatement &cp)
Inserts statement s before this one. Set's s's control parent to cp.

void insertStmtAfter(SgStatement &s)
Inserts statement s after this one.

void insertStmtAfter(SgStatement &s, SgStatement &cp)
Inserts statement s after this one. Set's s's control parent to cp.

SgStatement* extractStmt()
Removes this statement from the parse tree, and returns a pointer to the removed statement.

SgStatement* extractStmtBody()
If the statement is not a leaf of the parse tree, this function extracts the subtree it defines from the parse tree, and returns a pointer to the first statement in the tree

void replaceWithStmt(SgStatement &s)
Replaces this statement with statement s.

void simpledeleteStmt()

void deleteStmt()
Removes this statement from the parse tree, and frees the memory associated with it.

SgStatement& copy(void)

SgStatement* copyPtr(void)

SgStatement& copyOne(void)

SgStatement* copyOnePtr(void)

SgStatement& copyBlock(void)

SgStatement* copyBlockPtr(void)

int isIncludedInStmt(SgStatement &s)

void replaceSymbByExp(SgSymbol &symb, SgExpression &exp)

void replaceSymbBySymb(SgSymbol &symb, SgSymbol &newsymb)

void replaceSymbBySymbSameName(SgSymbol &symb, SgSymbol &newsymb)

void replaceTypeInStmt(SgType &old, SgType &newtype)

char* unparse()

void unparsestdout()

void sunparse(char *buffer)
unparsing functions

char* comments()
Preceeding comments are appended to the right of the statement.

void addComment(char *com)

void setComments(char *comments)
setComments: set ALL of the node's comments

int numberOfComments()
number of preceeding comments.

int hasAnnotations()
1 if there are annotations; 0 otherwise

~SgStatement()

SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * name)

SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename)

SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename, int counter)

SgSymbol* SgStatement::GetSymbolInScope(SgStatement * scope, char * mixstring, char * genname, char * basename, int c1, int c2)

SgSymbol* SgStatement::getSymbolInCurrentScope(char * name)

SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename)

SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename, int counter)

SgSymbol* SgStatement::getSymbolInCurrentScope(char * mixstring, char * genname, char * basename, int c1, int c2)

SgStatement* getScopeForDeclare()
return where a variable can be declared

int numberOfAttributes()

int numberOfAttributes(int type)

void* attributeValue(int i)

int attributeType(int i)

void* attributeValue(int i, int type)
only considering one type attribute

void addAttribute(int type, void *a, int size)
void * can be NULL;

void addAttribute(int type)
void * is NULL;

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

void addAttribute(SgAttribute *att)

void* deleteAttribute(int i)

void* deleteAttribute(int i, int type)

void deleteAllAttribute()

void deleteAllAttribute(int type)

SgAttribute* getAttribute(int i)

SgAttribute* getAttribute(int i, int type)

void addDeclSpec(int type)
type should be one of BIT_EXTERN BIT_INLINE, _FRIEND, BIT_STATIC

void clearDeclSpec()
resets the decl_specs field to zero

int isFriend()
returns non-zero if friend modifier set returns zero otherwise

int isInline()

int isExtern()

int isStatic()


Direct child classes:
SgWhileStmt
SgTemplateStmt
SgSwitchStmt
SgSendStmt
SgReceiveStmt
SgProgHedrStmt
SgProcessesStmt
SgProcessDoStmt
SgProbeStmt
SgOutportStmt
SgMoveportStmt
SgModuleStmt
SgMergerStmt
SgLogIfStmt
SgInterfaceStmt
SgInportStmt
SgInheritStmt
SgIfStmt
SgForallStmt
SgForStmt
SgExecutableStatement
SgEndchannelStmt
SgEndProcessesStmt
SgDeclarationStatement
SgClassStmt
SgChannelStmt
SgCaseOptionStmt
SgBlockDataStmt
SgBasicBlockStmt
SgArithIfStmt

alphabetic index hierarchy of classes


Email contact: zgs@npac.syr.edu

generated by doc++