A statement that contains a symbol table.
For base class see SgStatement
Variant name: SCOPE_STMT.
class SgScopeStatement : public SgStatement {
public:
void insert_symbol(const SgName& n,SgSymbol*s)
{ p_symbol_table.insert(n,s); }
// see if this is in symbol table already
int lookup_symbol(const SgName& n, SgSymbol *s)
{ return p_symbol_table.find(n,s); }
// first symbol with n
SgSymbol *lookup_symbol(const SgName& n)
{ return p_symbol_table.findany(n); }
SgTypedefSymbol *lookup_typedef_symbol(const SgName& n)
{ return p_symbol_table.findtypedef(n); }
SgEnumSymbol *lookup_enum_symbol(const SgName& n)
{ return p_symbol_table.findenum(n); }
SgEnumFieldSymbol *lookup_enumfield_symbol(const SgName& n)
{ return p_symbol_table.findenumfield(n); }
SgVariableSymbol *lookup_var_symbol(const SgName& n)
{ return p_symbol_table.findvar(n); }
SgClassSymbol *lookup_class_symbol(const SgName& n)
{ return p_symbol_table.findclass(n); }
SgLabelSymbol *lookup_label_symbol(const SgName& n) const
{ return p_symbol_table.findlabel(n); }
SgFunctionSymbol *lookup_function_symbol(const SgName& n, const SgType* t)
{ return p_symbol_table.findfunc(n,t); }
SgFunctionSymbol *lookup_function_symbol(const SgName& n)
{ return p_symbol_table.findfunc(n); }
SgSymbol *first_any_symbol()
{ return p_symbol_table.findfirstany(); }
SgVariableSymbol *first_variable_symbol()
{ return p_symbol_table.findfirstvar(); }
SgClassSymbol *first_class_symbol()
{ return p_symbol_table.findfirstclass(); }
SgFunctionSymbol *first_function_symbol()
{ return p_symbol_table.findfirstfunction(); }
// use after lookup_XXX_symbol(SgName&)
// or after first_XXX_symbol()
SgVariableSymbol *next_variable_symbol()
{ return p_symbol_table.nextvar(); }
SgClassSymbol *next_class_symbol()
{ return p_symbol_table.nextclass(); }
SgFunctionSymbol *next_function_symbol()
{ return p_symbol_table.nextfunc(); }
SgSymbol *next_any_symbol()
{ return p_symbol_table.nextany(); }
void print_symboltable(char *str, ostream& os=cout)
{
os << endl << "...SymTbl(" << str << ")... " << endl;
p_symbol_table.print(os);
}
/* additional symbol table insertion utitily routines */
SgVariableSymbol *insert_symbol(SgInitializedNameList::iterator&);
SgVariableSymbol *insert_symbol(SgVariableDeclaration *);
SgFunctionSymbol *insert_symbol(SgFunctionDeclaration *);
SgMemberFunctionSymbol *insert_symbol(SgMemberFunctionDeclaration *);
SgClassSymbol *insert_symbol(SgClassDeclaration *cdecl);
SgEnumSymbol *insert_symbol(SgEnumDeclaration *cdecl);
SgTypedefSymbol *insert_symbol(SgTypedefDeclaration *);
SgLabelSymbol *insert_symbol(SgLabelStatement *);
SgEnumFieldSymbol *insert_enum_symbol(SgInitializedNameList::iterator&);
protected:
SgScopeStatement() {}
/* Generated accessors */
/* Protected data members */
protected:
SgSymbolTable p_symbol_table;
};
/* This is generated in the header file */
SgScopeStatement(Sg_File_Info *info );
/* This is the generated constructor */
SgScopeStatement::SgScopeStatement(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
A statement that contains a function type table.
For base class see SgStatement
Variant name: FUNC_TBL_STMT.
class SgFunctionTypeTable : public SgStatement {
public:
SgFunctionTypeTable() {}
void insert_function_type(const SgName&, SgType *);
void insert_function_type(const SgFunctionDeclaration *);
SgType* lookup_function_type (const SgName&);
void print_functypetable(ostream& os=cout)
{
os << endl << "...FuncTypeTbl..." << endl;
p_function_type_table.print(os);
}
/* Generated accessors */
/* Protected data members */
protected:
SgSymbolTable p_function_type_table;
};
/* This is generated in the header file */
SgFunctionTypeTable(Sg_File_Info *info );
/* This is the generated constructor */
SgFunctionTypeTable::SgFunctionTypeTable(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
This is always the root of a Sage parse tree. Manages a list of declarations.
For base class see SgScopeStatement
Variant name: GLOBAL_STMT.
class SgGlobal : public SgScopeStatement {
SgGlobal() {}
SgDeclarationStatementPtrList & get_declarations()
{ return p_declarations; }
const SgDeclarationStatementPtrList & get_declarations() const
{ return p_declarations; }
void append_declaration(SgDeclarationStatement * what)
{ insert_declaration(p_declarations.end(),what); }
void prepend_declaration(SgDeclarationStatement * what)
{ insert_declaration(p_declarations.begin(),what); }
void insert_declaration(SgDeclarationStatementPtrList::iterator where,
SgDeclarationStatement * what);
SgStatement *get_first() const;
SgStatement *get_end() const;
void insert_statement(SgStatement *, SgStatement *, int);
/* Generated accessors */
/* Protected data members */
protected:
SgDeclarationStatementPtrList p_declarations;
};
/* This is generated in the header file */
SgGlobal(Sg_File_Info *info );
/* This is the generated constructor */
SgGlobal::SgGlobal(Sg_File_Info* info )
:SgScopeStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
Represents the base class for all declarations.
For base class see SgStatement
Variant name: DECL_STMT.
class SgDeclarationStatement : public SgStatement {
void post_construction_initialization()
{
p_attribute = 0;
p_linkage = (char*)0L;
}
public:
enum decl_specifier_enum {
/* access specifier - variable, member function, enum, class, struct, union */
e_private = 0x00000001,
e_protected = 0x00000002,
e_public = 0x00000004,
/* function specifier - function, member function */
e_inline = 0x00000010,
e_virtual = 0x00000020,
e_atomic = 0x00000040,
/* storage/linkage specifier - variable, function, member function */
e_static = 0x00000100,
e_extern = 0x00000200,
e_extern_c = 0x00000400,
e_extern_brace = 0x00000800,
e_auto = 0x00001000,
e_register = 0x00002000,
/* other - class, struct, union, function */
e_friend = 0x00004000,
/* global class */
e_global = 0x01000000,
e_constructor = 0x00008000,
e_destructor = 0x00010000,
e_conversion = 0x00020000,
/* for a class or function declared and defined later */
e_forward = 0x00040000,
e_operator = 0x00080000,
e_pure = 0x00100000,
e_name_only = 0x00200000,
e_skip_elaborate_type = 0x00400000
};
int checkBit(unsigned int bit) const
{ if(p_attribute & bit) return 1; else return 0; }
void setBit(unsigned int bit)
{ p_attribute |= bit; }
void unsetBit(unsigned int bit)
{ p_attribute &= ~bit; }
int isPrivate() const { return checkBit(e_private); }
void setPrivate() { setBit(e_private); }
void unsetPrivate() { unsetBit(e_private); }
int isProtected() const { return checkBit(e_protected); }
void setProtected() { setBit(e_protected); }
void unsetProtected() { unsetBit(e_protected); }
int isPublic() const { return checkBit(e_public); }
void setPublic() { setBit(e_public); }
void unsetPublic() { unsetBit(e_public); }
int isInline() const { return checkBit(e_inline); }
void setInline() { setBit(e_inline); }
void unsetInline() { unsetBit(e_inline); }
int isVirtual() const { return checkBit(e_virtual); }
void setVirtual() { setBit(e_virtual); }
void unsetVirtual() { unsetBit(e_virtual); }
int isAtomic() const { return checkBit(e_atomic); }
void setAtomic() { setBit(e_atomic); }
void unsetAtomic() { unsetBit(e_atomic); }
int isStatic() const { return checkBit(e_static); }
void setStatic() { setBit(e_static); }
void unsetStatic() { unsetBit(e_static); }
int isExtern() const { return checkBit(e_extern); }
void setExtern() { setBit(e_extern); }
void unsetExtern() { unsetBit(e_extern); }
int isExternBrace() const { return checkBit(e_extern_brace); }
void setExternBrace() { setBit(e_extern_brace); }
void unsetExternBrace() { unsetBit(e_extern_brace); }
int isAuto() const { return checkBit(e_auto); }
void setAuto() { setBit(e_auto); }
void unsetAuto() { unsetBit(e_auto); }
int isRegister() const { return checkBit(e_register); }
void setRegister() { setBit(e_register); }
void unsetRegister() { unsetBit(e_register); }
int isFriend() const { return checkBit(e_friend); }
void setFriend() { setBit(e_friend); }
void unsetFriend() { unsetBit(e_friend); }
int isGlobalClass() const { return checkBit(e_global); }
void setGlobalClass() { setBit(e_global); }
void unsetGlobalClass() { unsetBit(e_global); }
int isConstructor() const { return checkBit(e_constructor); }
void setConstructor() { setBit(e_constructor); }
void unsetConstructor() { unsetBit(e_constructor); }
int isDestructor() const { return checkBit(e_destructor); }
void setDestructor() { setBit(e_destructor); }
void unsetDestructor() { unsetBit(e_destructor); }
int isConversion() const { return checkBit(e_conversion); }
void setConversion() { setBit(e_conversion); }
void unsetConversion() { unsetBit(e_conversion); }
// this is to distingush a forward declaration
// static int a;
// int a=10;
int isForward() const { return checkBit(e_forward); }
void setForward() { setBit(e_forward); }
void unsetForward() { unsetBit(e_forward); }
// this is to distinguish cases like this
// class-P pvar; -- isNameOnly=1
// class-P { int a; } pvar; -- isNameOnly=0
int isNameOnly() const { return checkBit(e_name_only); }
void setNameOnly() { setBit(e_name_only); }
void unsetNameOnly() { unsetBit(e_name_only); }
// this is to distinguish cases like this
// class P var;
// P var;
int SkipElaborateType() const { return checkBit(e_skip_elaborate_type); }
void setSkipElaborateType() { setBit(e_skip_elaborate_type); }
void unsetSkipElaborateType() { unsetBit(e_skip_elaborate_type); }
int isOperator() const { return checkBit(e_operator); }
void setOperator() { setBit(e_operator); }
void unsetOperator() { unsetBit(e_operator); }
int isPure() const { return checkBit(e_pure); }
void setPure() { setBit(e_pure); }
void unsetPure() { unsetBit(e_pure); }
const char* get_linkage() const { return p_linkage; }
void set_linkage(char* link) { p_linkage = link; }
SgDeclarationStatement() { p_attribute=0; }
void printSpecifier(Unparse_Info&, ostream& os=cout);
/* Generated accessors */
/* Protected data members */
protected:
unsigned int p_attribute;
char * p_linkage;
};
/* This is generated in the header file */
SgDeclarationStatement(Sg_File_Info *info );
/* This is the generated constructor */
SgDeclarationStatement::SgDeclarationStatement(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
Contains a group of statements.
For base class see SgScopeStatement
Variant name: BASIC_BLOCK_STMT.
class SgBasicBlock : public SgScopeStatement {
SgStatementPtrList & get_statements() { return p_statements; }
const SgStatementPtrList & get_statements() const { return p_statements; }
void append_statement(SgStatement * what)
{ insert_statement(p_statements.end(),what); }
void prepend_statement(SgStatement *what)
{ insert_statement(p_statements.begin(), what); }
void insert_statement(SgStatementPtrList::iterator where, SgStatement * what)
{
what->set_parent(this);
p_statements.insert(where,what);
}
SgStatement *get_first() const;
SgStatement *get_end() const;
// return the last statement in the SgBasicBlock, note
// this only check the top-level.. it is not going to
// go down to any lower level if this is a another big
// statement with body
SgStatement *get_last() const;
int replace_statement(SgStatement *, SgStatement *);
void insert_statement(SgStatement*, SgStatement*, int);
/* Generated accessors */
/* Protected data members */
protected:
SgStatementPtrList p_statements;
};
/* This is generated in the header file */
SgBasicBlock(Sg_File_Info *info );
/* This is the generated constructor */
SgBasicBlock::SgBasicBlock(Sg_File_Info* info )
:SgScopeStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
This holds a list of statements.
Represents {if.S0.then.S1.else.S2.} statements.
For base class see SgScopeStatement
Variant name: IF_STMT.
class SgIfStmt : public SgScopeStatement {
void post_construction_initialization()
{
if (get_conditional()) get_conditional()->set_parent(this);
if (get_true_body()) get_true_body()->set_parent(this);
if (get_false_body()) get_false_body()->set_parent(this);
}
/* returns the statement number n (0,1,2) of S0, S1 or S2 if present;
the value of (n-1) is telling which one was returned */
SgStatement *get_next(int& n) const;
/* given statement o checks which one is from the
conditional, true or false statements and replaces it with
statement n; returns 1 on success, 0 otherwise */
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgStatement* get_conditional() const;
void set_conditional(SgStatement*);
SgBasicBlock* get_true_body() const;
void set_true_body(SgBasicBlock*);
SgBasicBlock* get_false_body() const;
void set_false_body(SgBasicBlock*);
/* Protected data members */
protected:
SgStatement* p_conditional;
SgBasicBlock* p_true_body;
SgBasicBlock* p_false_body;
};
/* This is generated in the header file */
SgIfStmt(Sg_File_Info *info , SgStatement* conditional = 0, SgBasicBlock* true_body = 0, SgBasicBlock* false_body = 0);
/* This is the generated constructor */
SgIfStmt::SgIfStmt(Sg_File_Info* info , SgStatement* conditional, SgBasicBlock* true_body, SgBasicBlock* false_body)
:SgScopeStatement(info)
{
p_conditional = conditional;
p_true_body = true_body;
p_false_body = false_body;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgScopeStatement
Variant name: FOR_STMT.
class SgForStatement : public SgScopeStatement {
void post_construction_initialization()
{
p_test_expr_root.initialize_root(p_test_expr_i, this);
p_increment_expr_root.initialize_root(p_increment_expr_i, this);
/* set up the symbol table */
if (get_init_stmt()) get_init_stmt()->set_parent(this);
if (get_loop_body()) get_loop_body()->set_parent(this);
}
void set_test_expr(SgExpression * exp) {
set_test_expr_i(exp);
p_test_expr_root.initialize_root(exp, this);
}
SgExpression * get_test_expr() const { return get_test_expr_i(); }
void set_increment_expr(SgExpression * exp) {
set_increment_expr_i(exp);
p_increment_expr_root.initialize_root(exp, this);
}
SgExpression * get_increment_expr() const { return get_increment_expr_i(); }
/* returns init_stmt if exists or loop_body
n-1 will tell which one is being returned;
when calling, n represents the member requested: 0 for init_stmt, etc
returns 0 when n>1*/
SgStatement* get_next(int& n) const;
/* replaces statement o, the init-stmt or loop_body
by statement n (casted to SgBasicBlock in the latter case)
returns 1 on success, 0 otherwise */
int replace_statement(SgStatement *o, SgStatement *n);
private:
SgExpressionRoot p_test_expr_root;
SgExpressionRoot p_increment_expr_root;
/* Generated accessors */
SgStatement* get_init_stmt() const;
void set_init_stmt(SgStatement*);
SgExpression* get_test_expr_i() const;
void set_test_expr_i(SgExpression*);
SgExpression* get_increment_expr_i() const;
void set_increment_expr_i(SgExpression*);
SgBasicBlock* get_loop_body() const;
void set_loop_body(SgBasicBlock*);
/* Protected data members */
protected:
SgStatement* p_init_stmt;
SgExpression* p_test_expr_i;
SgExpression* p_increment_expr_i;
SgBasicBlock* p_loop_body;
};
/* This is generated in the header file */
SgForStatement(Sg_File_Info *info , SgStatement* init_stmt = 0, SgExpression* test_expr_i = 0, SgExpression* increment_expr_i = 0, SgBasicBlock* loop_body = 0);
/* This is the generated constructor */
SgForStatement::SgForStatement(Sg_File_Info* info , SgStatement* init_stmt, SgExpression* test_expr_i, SgExpression* increment_expr_i, SgBasicBlock* loop_body)
:SgScopeStatement(info)
{
p_init_stmt = init_stmt;
p_test_expr_i = test_expr_i;
p_increment_expr_i = increment_expr_i;
p_loop_body = loop_body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Contains the function header part, for either function declaration or function definition.
For base class see SgDeclarationStatement
Variant name: FUNC_DECL_STMT.
class SgFunctionDeclaration : public SgDeclarationStatement {
void post_construction_initialization()
{
if(p_type) p_orig_return_type=p_type->get_orig_return_type();
else p_orig_return_type=0;
p_from_template=0;
}
/* InitalizedName is a tuple : (SgName, DeclStmt, type, Initializer) */
/* an iterator to insert argument--SgInitializedName in the argument list*/
SgInitializedNameList::iterator insert_arg(
SgInitializedNameList::iterator where,
const SgInitializedName & what);
SgInitializedNameList::iterator append_arg(
const SgInitializedName & what);
SgInitializedNameList::iterator prepend_arg(
const SgInitializedName & what);
SgInitializedNameList & get_args() { return p_arguments; }
const SgInitializedNameList & get_args() const { return p_arguments; }
SgType * get_orig_return_type() { return p_orig_return_type; }
void set_orig_return_type(SgType *t);
void hasEllipses() { get_type()->set_has_ellipses(1); }
SgName get_mangled_name();
void set_mangled_name();
void unparse_helper(Unparse_Info& info, ostream& os=cout);
SgStatement* get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
int get_from_template() const { return p_from_template; }
void set_from_template(int i) { p_from_template=i; }
/* Generated accessors */
SgName get_name() const;
void set_name(SgName);
SgFunctionType* get_type() const;
void set_type(SgFunctionType*);
SgFunctionDefinition* get_definition() const;
void set_definition(SgFunctionDefinition*);
/* Protected data members */
protected:
SgName p_name;
SgFunctionType* p_type;
SgFunctionDefinition* p_definition;
SgName p_mangled_name;
SgInitializedNameList p_arguments;
SgType* p_orig_return_type;
int p_from_template;
};
/* This is generated in the header file */
SgFunctionDeclaration(Sg_File_Info *info , SgName name, SgFunctionType* type, SgFunctionDefinition* definition = 0);
/* This is the generated constructor */
SgFunctionDeclaration::SgFunctionDeclaration(Sg_File_Info* info , SgName name, SgFunctionType* type, SgFunctionDefinition* definition)
:SgDeclarationStatement(info)
{
p_name = name;
p_type = type;
p_definition = definition;
/* now call the user defined intialization function */
post_construction_initialization();
}
Only for function definition statements
For base class see SgScopeStatement
Variant name: FUNC_DEFN_STMT.
class SgFunctionDefinition : public SgScopeStatement {
void post_construction_initialization()
{
p_par_cnt=0;
if(get_body()) get_body()->set_parent(this);
if(p_declaration) {
p_declaration->set_definition(this);
if(!p_declaration->isForward())
set_parent(p_declaration); //?? MEI not sure
}
}
public:
int get_par_flag() const { return p_par_cnt; };
void set_par_flag() { p_par_cnt++; };
SgStatement *get_next(int& n) const;
int replace_statement(SgStatement *o, SgStatement *n);
// allow insertion via function definition level
void append_statement(SgStatement * what);
void prepend_statement(SgStatement *what);
SgFunctionDeclaration* get_declaration() const { return p_declaration; }
void set_declaration(SgFunctionDeclaration*);
/* Generated accessors */
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgFunctionDeclaration* p_declaration;
SgBasicBlock* p_body;
int p_par_cnt;
};
/* This is generated in the header file */
SgFunctionDefinition(Sg_File_Info *info , SgFunctionDeclaration* declaration /*OPT*/, SgBasicBlock* body);
/* This is the generated constructor */
SgFunctionDefinition::SgFunctionDefinition(Sg_File_Info* info , SgFunctionDeclaration* declaration, SgBasicBlock* body)
:SgScopeStatement(info)
{
p_declaration = declaration;
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Member function header part, for either function declaration or function definition -- parent() will always be at class declaration
For base class see SgFunctionDeclaration
Variant name: MFUNC_DECL_STMT.
class SgMemberFunctionDeclaration : public SgFunctionDeclaration {
/* SgInitializedName tuple: (SgName, type, Initializer) */
void append_ctor_initializer(const SgInitializedName& iName)
{
p_ctor_initializers.insert(p_ctor_initializers.end(), iName);
}
void prepend_ctor_initializer(const SgInitializedName& iName)
{
p_ctor_initializers.insert(p_ctor_initializers.begin(), iName);
}
SgInitializedNameList & get_ctors() { return p_ctor_initializers; }
const SgInitializedNameList & get_ctors() const { return p_ctor_initializers; }
SgName get_qualified_name();
void set_orig_return_type(SgType *t);
/* Generated accessors */
SgClassDefinition* get_scope() const;
void set_scope(SgClassDefinition*);
/* Protected data members */
protected:
SgClassDefinition* p_scope;
SgInitializedNameList p_ctor_initializers;
};
/* This is generated in the header file */
SgMemberFunctionDeclaration(Sg_File_Info *info , SgName name, SgFunctionType* type, SgFunctionDefinition* definition /*OPT*/, SgClassDefinition* scope);
/* This is the generated constructor */
SgMemberFunctionDeclaration::SgMemberFunctionDeclaration(Sg_File_Info* info , SgName name, SgFunctionType* type, SgFunctionDefinition* definition, SgClassDefinition* scope)
:SgFunctionDeclaration(info, name, type, definition)
{
p_scope = scope;
/* now call the user defined intialization function */
post_construction_initialization();
}
For variable declaration statement.
For base class see SgDeclarationStatement
Variant name: VAR_DECL_STMT.
class SgVariableDeclaration : public SgDeclarationStatement {
/* constructor */
SgVariableDeclaration(Sg_File_Info*, SgName&, SgType*, SgInitializer*);
/* members to set the type of declaration */
void setDeclarationOnly();
void setExtern();
void setStatic();
SgInitializedNameList & get_variables() { return p_variables; }
const SgInitializedNameList & get_variables() const { return p_variables; }
//generic variable list
SgInitializedNameList::iterator append_variable(const
SgInitializedName & what, SgInitializer *init);
SgInitializedNameList::iterator prepend_variable(const
SgInitializedName & what, SgInitializer *init);
SgInitializedNameList::iterator insert_variable(
SgInitializedNameList::iterator where,
const SgInitializedName & what);
SgVariableDefinition *get_definition(SgInitializedName* ditem=0);
SgInitializedName *get_decl_item(SgName&);
SgInitializedName *get_defn_item(SgName&);
// Only when there is one variable declaration
SgUnsignedLongVal *get_fitfield();
void set_bitfield(SgUnsignedLongVal *);
void printVariableName(int);
// always output with type but not the base type
void printVariables(Unparse_Info&, ostream& os=cout);
SgStatement *get_next(int &) const;
/* Generated accessors */
/* Protected data members */
protected:
SgInitializedNameList p_variables;
};
/* This is generated in the header file */
SgVariableDeclaration(Sg_File_Info *info );
/* This is the generated constructor */
SgVariableDeclaration::SgVariableDeclaration(Sg_File_Info* info )
:SgDeclarationStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
For a variable definition statement.
For base class see SgDeclarationStatement
Variant name: VAR_DEFN_STMT.
class SgVariableDefinition : public SgDeclarationStatement {
void post_construction_initialization()
{ p_bitfield=0; }
SgVariableDefinition(Sg_File_Info *, SgInitializedName *, SgInitializer *);
SgInitializedName *get_defn_item();
SgInitializedName *get_decl_item();
SgVariableDeclaration *get_declaration();
private:
SgExpressionRoot p_initializer_expr_root;
/* Generated accessors */
SgUnsignedLongVal* get_bitfield() const;
void set_bitfield(SgUnsignedLongVal*);
/* Protected data members */
protected:
SgInitializedName p_vardefn;
SgUnsignedLongVal* p_bitfield;
};
/* This is generated in the header file */
SgVariableDefinition(Sg_File_Info *info , SgUnsignedLongVal* bitfield = 0);
/* This is the generated constructor */
SgVariableDefinition::SgVariableDefinition(Sg_File_Info* info , SgUnsignedLongVal* bitfield)
:SgDeclarationStatement(info)
{
p_bitfield = bitfield;
/* now call the user defined intialization function */
post_construction_initialization();
}
Head for class definition and also forward class declaration note: for class defined within a variable declaration class P { ... } pvar; parent ptr of class P {...} is the the variable declaration
For base class see SgDeclarationStatement
Variant name: CLASS_DECL_STMT.
class SgClassDeclaration : public SgDeclarationStatement {
void post_construction_initialization()
{
if (get_type())
get_type()->set_declaration(this);
else
set_type(SgClassType::createType(this));
p_from_template=0;
}
enum class_types { e_class, e_struct, e_union };
/* tries to get the enclosing class definition */
SgName get_qualified_name();
SgName get_mangled_qualified_name(int&);
SgStatement *get_first() const;
int replace_statement(SgStatement *o, SgStatement *n);
int get_from_template() const { return p_from_template; }
void set_from_template(int i) { p_from_template=i; }
/* Generated accessors */
SgName get_name() const;
void set_name(SgName);
int get_class_type() const;
void set_class_type(int);
SgClassType* get_type() const;
void set_type(SgClassType*);
SgClassDefinition* get_definition() const;
void set_definition(SgClassDefinition*);
/* Protected data members */
protected:
SgName p_name;
int p_class_type;
SgClassType* p_type;
SgClassDefinition* p_definition;
int p_from_template;
};
/* This is generated in the header file */
SgClassDeclaration(Sg_File_Info *info , SgName name, int class_type, SgClassType* type = 0, SgClassDefinition* definition = 0);
/* This is the generated constructor */
SgClassDeclaration::SgClassDeclaration(Sg_File_Info* info , SgName name, int class_type, SgClassType* type, SgClassDefinition* definition)
:SgDeclarationStatement(info)
{
p_name = name;
p_class_type = class_type;
p_type = type;
p_definition = definition;
/* now call the user defined intialization function */
post_construction_initialization();
}
Handles class definition statements.
For base class see SgScopeStatement
Variant name: CLASS_DEFN_STMT.
class SgClassDefinition : public SgScopeStatement {
void post_construction_initialization()
{
if(p_declaration) {
p_declaration->set_definition(this);
if(!p_declaration->isForward())
set_parent(p_declaration);
}
}
SgDeclarationStatementPtrList & get_members() { return p_members; }
const SgDeclarationStatementPtrList & get_members() const { return p_members; }
void insert_member(SgDeclarationStatementPtrList::iterator where,
SgDeclarationStatement * what)
{
what->set_parent(this);
p_members.insert(where,what);
}
void append_member(SgDeclarationStatement * what)
{ insert_member(p_members.end(),what); }
void prepend_member(SgDeclarationStatement * what)
{ insert_member(p_members.begin(),what); }
SgBaseClassList & get_inheritances() { return p_inheritances; }
const SgBaseClassList & get_inheritances() const { return p_inheritances; }
void append_inheritance(const SgBaseClass & what)
{ insert_inheritance(p_inheritances.end(),what); }
void prepend_inheritance(const SgBaseClass & what)
{ insert_inheritance(p_inheritances.begin(),what); }
void insert_inheritance(SgBaseClassList::iterator where,
const SgBaseClass & what)
{ p_inheritances.insert(where,what); }
SgName get_qualified_name() { return get_declaration()->get_qualified_name(); }
SgName get_mangled_qualified_name(int& i)
{ return get_declaration()->get_mangled_qualified_name(i); }
/* replaces the class declaration or a member declaration that
matches statement o */
int replace_statement(SgStatement *o, SgStatement *n);
void insert_statement(SgStatement*, SgStatement*, int);
SgStatement *get_first() const;
SgStatement *get_end() const;
SgClassDeclaration* get_declaration() const { return p_declaration; }
void set_declaration(SgClassDeclaration*);
/* Generated accessors */
/* Protected data members */
protected:
SgClassDeclaration* p_declaration;
SgDeclarationStatementPtrList p_members;
SgBaseClassList p_inheritances;
};
/* This is generated in the header file */
SgClassDefinition(Sg_File_Info *info , SgClassDeclaration* declaration = 0);
/* This is the generated constructor */
SgClassDefinition::SgClassDefinition(Sg_File_Info* info , SgClassDeclaration* declaration)
:SgScopeStatement(info)
{
p_declaration = declaration;
/* now call the user defined intialization function */
post_construction_initialization();
}
Handles enumeration statements; enum are always definitions;
For base class see SgDeclarationStatement
Variant name: ENUM_DECL_STMT.
class SgEnumDeclaration : public SgDeclarationStatement {
/* enum are always definition, it can not be forward declared
note: for enum defined within a variable declaration
enum E { apple, orange } evar;
the parent ptr of EnumDeclaration is the variable declaration
*/
void post_construction_initialization()
{ set_type(SgEnumType::createType(this)); }
SgInitializedNameList & get_enumerators() { return p_enumerators; }
const SgInitializedNameList & get_enumerators() const { return p_enumerators; }
SgInitializedNameList::iterator append_enumerator(const
SgInitializedName & what);
SgInitializedNameList::iterator prepend_enumerator(const
SgInitializedName & what);
SgInitializedNameList::iterator insert_enumerator(
SgInitializedNameList::iterator where, const SgInitializedName what);
/* Generated accessors */
SgName get_name() const;
void set_name(SgName);
SgEnumType* get_type() const;
void set_type(SgEnumType*);
/* Protected data members */
protected:
SgName p_name;
SgEnumType* p_type;
SgInitializedNameList p_enumerators;
};
/* This is generated in the header file */
SgEnumDeclaration(Sg_File_Info *info , SgName name = 0, SgEnumType* type = 0);
/* This is the generated constructor */
SgEnumDeclaration::SgEnumDeclaration(Sg_File_Info* info , SgName name, SgEnumType* type)
:SgDeclarationStatement(info)
{
p_name = name;
p_type = type;
/* now call the user defined intialization function */
post_construction_initialization();
}
Expression Statement; (for assignments or function calls)
For base class see SgStatement
Variant name: EXPR_STMT.
class SgExprStatement : public SgStatement {
void post_construction_initialization()
{ p_expression_root.initialize_root(get_the_expr(),this); };
void set_the_expr(SgExpression * exp);
SgExpression * get_the_expr() const;
private:
SgExpressionRoot p_expression_root;
/* Generated accessors */
SgExpression* get_the_expr_i() const;
void set_the_expr_i(SgExpression*);
/* Protected data members */
protected:
SgExpression* p_the_expr_i;
};
/* This is generated in the header file */
SgExprStatement(Sg_File_Info *info , SgExpression* the_expr_i = 0);
/* This is the generated constructor */
SgExprStatement::SgExprStatement(Sg_File_Info* info , SgExpression* the_expr_i)
:SgStatement(info)
{
p_the_expr_i = the_expr_i;
/* now call the user defined intialization function */
post_construction_initialization();
}
Label declaration.
For base class see SgStatement
Variant name: LABEL_STMT.
class SgLabelStatement : public SgStatement {
SgName get_name() const { return get_label(); }
/* Generated accessors */
SgName get_label() const;
void set_label(SgName);
/* Protected data members */
protected:
SgName p_label;
};
/* This is generated in the header file */
SgLabelStatement(Sg_File_Info *info , SgName label);
/* This is the generated constructor */
SgLabelStatement::SgLabelStatement(Sg_File_Info* info , SgName label)
:SgStatement(info)
{
p_label = label;
/* now call the user defined intialization function */
post_construction_initialization();
}
While Statement.
For base class see SgScopeStatement
Variant name: WHILE_STMT.
class SgWhileStmt : public SgScopeStatement {
void post_construction_initialization()
{
if(get_condition()) get_condition()->set_parent(this);
if(get_body()) get_body()->set_parent(this);
}
SgStatement* get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgStatement* get_condition() const;
void set_condition(SgStatement*);
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgStatement* p_condition;
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgWhileStmt(Sg_File_Info *info , SgStatement* condition, SgBasicBlock* body = 0);
/* This is the generated constructor */
SgWhileStmt::SgWhileStmt(Sg_File_Info* info , SgStatement* condition, SgBasicBlock* body)
:SgScopeStatement(info)
{
p_condition = condition;
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Handles Do-While Statements.
For base class see SgScopeStatement
Variant name: DO_WHILE_STMT.
class SgDoWhileStmt : public SgScopeStatement {
void post_construction_initialization()
{
if(get_condition()) get_condition()->set_parent(this);
if(get_body()) get_body()->set_parent(this);
}
SgStatement *get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgStatement* get_condition() const;
void set_condition(SgStatement*);
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgStatement* p_condition;
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgDoWhileStmt(Sg_File_Info *info , SgStatement* condition = 0, SgBasicBlock* body = 0);
/* This is the generated constructor */
SgDoWhileStmt::SgDoWhileStmt(Sg_File_Info* info , SgStatement* condition, SgBasicBlock* body)
:SgScopeStatement(info)
{
p_condition = condition;
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Switch Statement; has two parts: a selector and the body.
For base class see SgScopeStatement
Variant name: SWITCH_STMT.
class SgSwitchStatement : public SgScopeStatement {
void post_construction_initialization()
{
p_expression_root.initialize_root(get_item_selector(),this);
if(get_body()) get_body()->set_parent(this);
};
void append_case(SgCaseOptionStmt *&);
void prepend_case(SgCaseOptionStmt *&);
void append_default(SgDefaultOptionStmt *&);
void set_item_selector(SgExpression * exp);
SgExpression * get_item_selector() const;
/* if n!=0 returns 0; otherwise the body of the switch statement */
SgStatement *get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
private:
SgExpressionRoot p_expression_root;
/* Generated accessors */
SgExpression* get_item_selector_i() const;
void set_item_selector_i(SgExpression*);
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgExpression* p_item_selector_i;
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgSwitchStatement(Sg_File_Info *info , SgExpression* item_selector_i, SgBasicBlock* body = 0);
/* This is the generated constructor */
SgSwitchStatement::SgSwitchStatement(Sg_File_Info* info , SgExpression* item_selector_i, SgBasicBlock* body)
:SgScopeStatement(info)
{
p_item_selector_i = item_selector_i;
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Case option statement; has a key and the body formed by the statements that corresponding to that case.
For base class see SgStatement
Variant name: CASE_STMT.
class SgCaseOptionStmt : public SgStatement {
void post_construction_initialization()
{
p_expression_root.initialize_root(get_key(),this);
if(get_body()) get_body()->set_parent(this);
};
void set_key(SgExpression * exp);
SgExpression * get_key() const;
/* if n is 0 returns a pointer to the block of stmts
otherwise returns 0 */
SgStatement* get_next(int&) const;
/* replaces the body block of statements if they match o by n */
int replace_statement(SgStatement *o, SgStatement *n);
private:
SgExpressionRoot p_expression_root;
/* Generated accessors */
SgExpression* get_key_i() const;
void set_key_i(SgExpression*);
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgExpression* p_key_i;
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgCaseOptionStmt(Sg_File_Info *info , SgExpression* key_i, SgBasicBlock* body = 0);
/* This is the generated constructor */
SgCaseOptionStmt::SgCaseOptionStmt(Sg_File_Info* info , SgExpression* key_i, SgBasicBlock* body)
:SgStatement(info)
{
p_key_i = key_i;
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Try Statement;
For base class see SgStatement
Variant name: TRY_STMT.
class SgTryStmt : public SgStatement {
void post_construction_initialization()
{ if(get_body()) get_body()->set_parent(this); }
SgStatement *get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgTryStmt(Sg_File_Info *info , SgBasicBlock* body);
/* This is the generated constructor */
SgTryStmt::SgTryStmt(Sg_File_Info* info , SgBasicBlock* body)
:SgStatement(info)
{
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
Catch Statement; catch(int *a) {...}
For base class see SgScopeStatement
Variant name: CATCH_STMT.
class SgCatchOptionStmt : public SgScopeStatement {
void post_construction_initialization()
{
if(get_condition()) get_condition()->set_parent(this);
if(get_body()) get_body()->set_parent(this);
}
SgStatement* get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgVariableDeclaration* get_condition() const;
void set_condition(SgVariableDeclaration*);
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
SgTryStmt* get_trystmt() const;
void set_trystmt(SgTryStmt*);
/* Protected data members */
protected:
SgVariableDeclaration* p_condition;
SgBasicBlock* p_body;
SgTryStmt* p_trystmt;
};
/* This is generated in the header file */
SgCatchOptionStmt(Sg_File_Info *info , SgVariableDeclaration* condition, SgBasicBlock* body, SgTryStmt* trystmt);
/* This is the generated constructor */
SgCatchOptionStmt::SgCatchOptionStmt(Sg_File_Info* info , SgVariableDeclaration* condition, SgBasicBlock* body, SgTryStmt* trystmt)
:SgScopeStatement(info)
{
p_condition = condition;
p_body = body;
p_trystmt = trystmt;
/* now call the user defined intialization function */
post_construction_initialization();
}
Default option statement.
For base class see SgStatement
Variant name: DEFAULT_STMT.
class SgDefaultOptionStmt : public SgStatement {
void post_construction_initialization()
{ if (get_body()) get_body()->set_parent(this); }
SgStatement* get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgBasicBlock* get_body() const;
void set_body(SgBasicBlock*);
/* Protected data members */
protected:
SgBasicBlock* p_body;
};
/* This is generated in the header file */
SgDefaultOptionStmt(Sg_File_Info *info , SgBasicBlock* body = 0);
/* This is the generated constructor */
SgDefaultOptionStmt::SgDefaultOptionStmt(Sg_File_Info* info , SgBasicBlock* body)
:SgStatement(info)
{
p_body = body;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: BREAK_STMT.
class SgBreakStmt : public SgStatement {
/* Generated accessors */
};
/* This is generated in the header file */
SgBreakStmt(Sg_File_Info *info );
/* This is the generated constructor */
SgBreakStmt::SgBreakStmt(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: CONTINUE_STMT.
class SgContinueStmt : public SgStatement {
/* Generated accessors */
};
/* This is generated in the header file */
SgContinueStmt(Sg_File_Info *info );
/* This is the generated constructor */
SgContinueStmt::SgContinueStmt(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: RETURN_STMT.
class SgReturnStmt : public SgStatement {
void post_construction_initialization()
{ p_expression_root.initialize_root(get_return_expr(),this); };
void set_return_expr(SgExpression * exp);
SgExpression * get_return_expr() const { return get_return_expr_i(); }
private:
SgExpressionRoot p_expression_root;
/* Generated accessors */
SgExpression* get_return_expr_i() const;
void set_return_expr_i(SgExpression*);
/* Protected data members */
protected:
SgExpression* p_return_expr_i;
};
/* This is generated in the header file */
SgReturnStmt(Sg_File_Info *info , SgExpression* return_expr_i = 0);
/* This is the generated constructor */
SgReturnStmt::SgReturnStmt(Sg_File_Info* info , SgExpression* return_expr_i)
:SgStatement(info)
{
p_return_expr_i = return_expr_i;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: GOTO_STMT.
class SgGotoStatement : public SgStatement {
void post_construction_initialization()
{ if(get_label()) get_label()->set_parent(this); }
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgLabelStatement* get_label() const;
void set_label(SgLabelStatement*);
/* Protected data members */
protected:
SgLabelStatement* p_label;
};
/* This is generated in the header file */
SgGotoStatement(Sg_File_Info *info , SgLabelStatement* label);
/* This is the generated constructor */
SgGotoStatement::SgGotoStatement(Sg_File_Info* info , SgLabelStatement* label)
:SgStatement(info)
{
p_label = label;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: ASM_STMT.
class SgAsmStmt : public SgStatement {
/* Generated accessors */
};
/* This is generated in the header file */
SgAsmStmt(Sg_File_Info *info );
/* This is the generated constructor */
SgAsmStmt::SgAsmStmt(Sg_File_Info* info )
:SgStatement(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgStatement
Variant name: SPAWN_STMT.
class SgSpawnStmt : public SgStatement {
/* Generated accessors */
SgFunctionCallExp* get_func() const;
void set_func(SgFunctionCallExp*);
/* Protected data members */
protected:
SgFunctionCallExp* p_func;
};
/* This is generated in the header file */
SgSpawnStmt(Sg_File_Info *info , SgFunctionCallExp* func);
/* This is the generated constructor */
SgSpawnStmt::SgSpawnStmt(Sg_File_Info* info , SgFunctionCallExp* func)
:SgStatement(info)
{
p_func = func;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgBasicBlock
Variant name: PAR_STMT.
class SgParBlockStmt : public SgBasicBlock {
/* Generated accessors */
};
/* This is generated in the header file */
SgParBlockStmt(Sg_File_Info *info );
/* This is the generated constructor */
SgParBlockStmt::SgParBlockStmt(Sg_File_Info* info )
:SgBasicBlock(info)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgForStatement
Variant name: PARFOR_STMT.
class SgParForStmt : public SgForStatement {
/* Generated accessors */
};
/* This is generated in the header file */
SgParForStmt(Sg_File_Info *info , SgStatement* init_stmt = 0, SgExpression* test_expr_i = 0, SgExpression* increment_expr_i = 0, SgBasicBlock* loop_body = 0);
/* This is the generated constructor */
SgParForStmt::SgParForStmt(Sg_File_Info* info , SgStatement* init_stmt, SgExpression* test_expr_i, SgExpression* increment_expr_i, SgBasicBlock* loop_body)
:SgForStatement(info, init_stmt, test_expr_i, increment_expr_i, loop_body)
{
/* now call the user defined intialization function */
post_construction_initialization();
}
A typedef declaration. note: for the type defined within a typedef declaration typedef class P {...} typevar; the parent of the P is the same as the variable declaration
For base class see SgDeclarationStatement
Variant name: TYPEDEF_STMT.
class SgTypedefDeclaration : public SgDeclarationStatement {
void post_construction_initialization()
{
set_type(SgTypedefType::createType(this));
if(p_declaration) p_declaration->set_parent(this);
}
SgStatement *get_next(int&) const;
int replace_statement(SgStatement *o, SgStatement *n);
/* Generated accessors */
SgName get_name() const;
void set_name(SgName);
SgType* get_base_type() const;
void set_base_type(SgType*);
SgTypedefType* get_type() const;
void set_type(SgTypedefType*);
SgDeclarationStatement* get_declaration() const;
void set_declaration(SgDeclarationStatement*);
SgSymbol* get_parent_scope() const;
void set_parent_scope(SgSymbol*);
/* Protected data members */
protected:
SgName p_name;
SgType* p_base_type;
SgTypedefType* p_type;
SgDeclarationStatement* p_declaration;
SgSymbol* p_parent_scope;
};
/* This is generated in the header file */
SgTypedefDeclaration(Sg_File_Info *info , SgName name, SgType* base_type, SgTypedefType* type = 0, SgDeclarationStatement* declaration = 0, SgSymbol* parent_scope = 0);
/* This is the generated constructor */
SgTypedefDeclaration::SgTypedefDeclaration(Sg_File_Info* info , SgName name, SgType* base_type, SgTypedefType* type, SgDeclarationStatement* declaration, SgSymbol* parent_scope)
:SgDeclarationStatement(info)
{
p_name = name;
p_base_type = base_type;
p_type = type;
p_declaration = declaration;
p_parent_scope = parent_scope;
/* now call the user defined intialization function */
post_construction_initialization();
}
For base class see SgDeclarationStatement
Variant name: TEMPLATE_CLASS_DECL_STMT.
class SgTemplateClassDeclaration : public SgDeclarationStatement {
void post_construction_initialization() { }
/* Generated accessors */
SgName get_string() const;
void set_string(SgName);
/* Protected data members */
protected:
SgName p_string;
};
/* This is generated in the header file */
SgTemplateClassDeclaration(Sg_File_Info *info , SgName string);
/* This is the generated constructor */
SgTemplateClassDeclaration::SgTemplateClassDeclaration(Sg_File_Info* info , SgName string)
:SgDeclarationStatement(info)
{
p_string = string;
/* now call the user defined intialization function */
post_construction_initialization();
}