SgStatement¶
This class represents the notion of a statement.
Synopsis¶
Declared in <src/frontend/SageIII/Cxx_Grammar.h> (not stored in Git)
class [[visibility("default")]] SgStatement
: public SgLocatedNode Description¶
There are no uses of this IR node anywhere. All statements are derived from this SgStatement class.
- Internal: This is a base class for all statements.
- Todo: Fortran support for modifiers can be used as statement (must be added to IR): see section 5.2, 5.3 in Fortran 2003 standard. Note that type modifiers can be used as statements.
- Todo: Fortran support requires statements in section 6.3.
- Todo: Fortran support requires for case statement ranges (gnu extension for C, but standard in Fortran).
- Todo: Fortran support requires statements in section 8.1.4, 8.1.5.
- Todo: Fortran support requires statements in section 15 (modifiers for ISO_C_BINDING).
- See also: Example of using a SgStatement object
Member functions
SgStatement::get_scope() const¶
Returns scope of current statement. Returns the explicit semantic scope for declarations that store one, or the scope defined by the owning AST structure for other statements. Producers establish those identities during construction. Function parameter scopes follow their owning declaration's signature or definition role.
- Return: Returns valid pointer to SgScopeStatement.
`SgStatement::replace_child (SgStatement *, SgStatement *, bool¶
extractListFromBasicBlock=false)` Private supporting function for low level SageIII rewrite interface. This function implements special semantics for the insertion of a collection of statements in a block. If extractListFromBasicBlock is true then the statements in the block are extracts and placed into the same scope as the target position.
- Return: Returns bool.
`SgStatement::insert_child (SgStatement *, SgStatement *, bool¶
inFront=true, bool extractListFromBasicBlock=false)` Private supporting function for low level SageIII rewrite interface. This function implements special semantics for the insertion of a collection of statements in a block. If extractListFromBasicBlock is true then the statements in the block are extracts and placed into the same scope as the target position.
- Return: Returns bool.
SgStatement::get_symbol_from_symbol_table()¶
Virtual function to obtain the SgSymbol from the scope's symbol table. This function permits retrival of the associated SgSymbol, where it exists for that IR node, where is is associated with this exact declaration. If no symbol is found in the symbol table the function returns NULL. If it is not implemented for the associated statement or declaration it is an error (assertion failure). This fucntion is ONLY defined for those IR nodes for which symbols can be constructed.
- Return: Returns SgSymbol pointer.
SgStatement::isChildUsedAsLValue(SgExpression *)¶
Virtual function to determine if the provided expression is used as an l-value within the cotext of this statement.
- Return: True if the expression is used within this statement as an l-value.
Additional notes Low-level Support for mutation of the AST. This is the lowest level of support for the mutation of the AST.
- Internal: Need to document this section more fully.
Base Classes¶
| Name | Description |
|---|---|
SgLocatedNode | This class represents the notion of an expression or statement which |
Type Aliases¶
| Name |
|---|
base_node_type |
Enums¶
| Name | Description |
|---|---|
Unnamed enum | static variant value |
directive_end_kind_enum | |
omp_fortran_spelling_enum |
Member Functions¶
| Name | Description |
|---|---|
SgStatementSgStatement(); [constructor] | Constructors |
~SgStatementvirtual ~SgStatement(); [destructor] [virtual] | Destructor |
acceptvirtual void accept(ROSE_VisitorPattern& visitor) override; [virtual] | support for the classic visitor pattern done in GoF |
appendDestructorOwnedNodesvirtual void appendDestructorOwnedNodes(std::vector<SgNode*>& nodes) const override; [virtual] | |
cfgFindChildIndexvirtual unsigned int cfgFindChildIndex(SgNode* n) override; [virtual] | |
cfgFindNextChildIndexvirtual unsigned int cfgFindNextChildIndex(SgNode* n) override; [virtual] | |
cfgInEdgesvirtual std::vector<VirtualCFG::CFGEdge> cfgInEdges(unsigned int index) override; [virtual] | |
cfgIndexForEndvirtual unsigned int cfgIndexForEnd() const override; [virtual] | |
cfgIsIndexInterestingvirtual bool cfgIsIndexInteresting(unsigned int index) const override; [virtual] | |
cfgOutEdgesvirtual std::vector<VirtualCFG::CFGEdge> cfgOutEdges(unsigned int index) override; [virtual] | |
class_namevirtual std::string class_name() const override; [virtual] | returns a string representing the class name |
copyvirtual SgNode* copy(SgCopyHelp& help) const override; [virtual] | |
fixupCopy_referencesvirtual void fixupCopy_references( SgNode* copy, SgCopyHelp& help) const override; [virtual] | |
fixupCopy_scopesvirtual void fixupCopy_scopes( SgNode* copy, SgCopyHelp& help) const override; [virtual] | |
fixupCopy_symbolsvirtual void fixupCopy_symbols( SgNode* copy, SgCopyHelp& help) const override; [virtual] | |
get_childIndexvirtual size_t get_childIndex(SgNode* child) const override; [virtual] | index-based access to traversal successors by child node |
get_directive_end_kindSgStatement::directive_end_kind_enum get_directive_end_kind() const; | |
get_end_numeric_labelvirtual SgLabelRefExp* get_end_numeric_label() const; [virtual] | |
get_is_short_circuit_generatedbool get_is_short_circuit_generated() const; | |
get_numberOfTraversalSuccessorsvirtual size_t get_numberOfTraversalSuccessors() const override; [virtual] | return number of children in the traversal successor list |
get_numeric_labelSgLabelRefExp* get_numeric_label() const; | |
get_omp_fortran_spellingSgStatement::omp_fortran_spelling_enum get_omp_fortran_spelling() const; | |
get_scopevirtual SgScopeStatement* get_scope() const; [virtual] | |
get_source_sequence_valueint get_source_sequence_value() const; | |
get_symbol_from_symbol_tablevirtual SgSymbol* get_symbol_from_symbol_table() const; [virtual] | Get the associated symbol from the symbol table in the stored scope |
get_traversalSuccessorByIndexvirtual SgNode* get_traversalSuccessorByIndex(size_t idx) const override; [virtual] | index-based access to traversal successors by index number |
get_traversalSuccessorContainervirtual std::vector<SgNode*> get_traversalSuccessorContainer() const override; [virtual] | container of pointers to AST successor nodes used in the traversal overridden in every class by generated implementation |
get_traversalSuccessorIsListElementvirtual std::vector<bool> get_traversalSuccessorIsListElement() const override; [virtual] | |
get_traversalSuccessorNamesContainervirtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override; [virtual] | container of names of variables or container indices used used in the traversal to access AST successor nodes overridden in every class by generated implementation |
hasExplicitScopevirtual bool hasExplicitScope() const; [virtual] | Support for where the scope is explicitly required |
hasExplicitTypebool hasExplicitType(); | Some statement store internal SgType pointers explicitly. This function is true if it has a data member that is a type (only applies to SgTypedefDeclaration). |
has_end_numeric_labelvirtual bool has_end_numeric_label() const; [virtual] | |
insert_statementvoid insert_statement( SgStatement* target, SgStatementPtrList const& newstmtList, bool inFront = true); | insert_statement overloads |
insert_statement_from_basicBlockvoid insert_statement_from_basicBlock( SgStatement* target, SgStatement* newstmt, bool inFront = true); | This function inserts a statement at the position indicated by target. If newstmt is a basicBlock, statements inside newstmt are extracted and then inserted. |
isChildUsedAsLValuevirtual bool isChildUsedAsLValue(SgExpression const* child) const; [virtual] | |
operator deletevoid operator delete( void* pointer, size_t size); | deallocated memory for IR node (returns memory to memory pool for reuse) |
operator newvoid* operator new(size_t size); | returns pointer to newly allocated IR node |
post_construction_initializationvirtual void post_construction_initialization() override; [virtual] | |
processDataMemberReferenceToPointersvirtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler*) override; [virtual] | Pass references to stored node pointers to a handler. |
remove_statementvoid remove_statement(SgStatement* target); | This function removes the target statement from the AST. |
replace_expressionvirtual int replace_expression( SgExpression* original_expression, SgExpression* new_expression); [virtual] | support general replace functions, used in statements that directly contain SgExpression IR nodes. |
replace_statementvoid replace_statement( SgStatement* target, SgStatementPtrList const& newstmtList); | replace_statement overloads |
returnDataMemberPointersvirtual std::vector<std::pair<SgNode*, std::string>> returnDataMemberPointers() const override; [virtual] | Return the node pointers stored in this node's data members. |
roseRTIvirtual RTIReturnType roseRTI() override; [virtual] | return C++ Runtime-Time-Information |
sage_class_namevirtual char const* sage_class_name() const override; [virtual] | returns a C style string (char*) representing the class name |
set_directive_end_kindvoid set_directive_end_kind(SgStatement::directive_end_kind_enum directive_end_kind); | |
set_end_numeric_labelvirtual void set_end_numeric_label(SgLabelRefExp* end_numeric_label); [virtual] | |
set_is_short_circuit_generatedvoid set_is_short_circuit_generated(bool is_short_circuit_generated); | |
set_numeric_labelvoid set_numeric_label(SgLabelRefExp* numeric_label); | |
set_omp_fortran_spellingvoid set_omp_fortran_spelling(SgStatement::omp_fortran_spelling_enum omp_fortran_spelling); | |
set_scopevirtual void set_scope(SgScopeStatement* newScope); [virtual] | Support for setting scopes (only meaningful on IR statements that store the scope explicitly). |
set_source_sequence_valuevoid set_source_sequence_value(int source_sequence_value); | |
variantTvirtual VariantT variantT() const override; [virtual] | returns new style SageIII enum values |
Static Member Functions¶
| Name | Description |
|---|---|
memoryUsagestatic size_t memoryUsage(); | Returns the size in bytes of the total memory allocated for all IR nodes of this type |
numberOfNodesstatic size_t numberOfNodes(); | Returns the total number of IR nodes of this type |
traverseMemoryPoolNodesstatic void traverseMemoryPoolNodes(ROSE_VisitTraversal& visit); | FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node. |
traverseMemoryPoolVisitorPatternstatic void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern& visitor); | FOR INTERNAL USE Support for visitor pattern. |
visitRepresentativeNodestatic void visitRepresentativeNode(ROSE_VisitTraversal& visit); | FOR INTERNAL USE Support for type-based traversal. |
Static Data Members¶
| Name | Description |
|---|---|
free_slots | Free slots, each numbered pool_index * pool_size + slot_index. The last entry is allocated next. |
pool_live_flags | |
pool_size | |
pools |
Protected Member Functions¶
| Name |
|---|
insert_childvirtual bool insert_child( SgStatement*, SgStatement*, bool inFront = true, bool extractListFromBasicBlock = false); [virtual] |
replace_childvirtual bool replace_child( SgStatement* target, SgStatement* newStmt, bool extractListFromBasicBlock = false); [virtual] |
Protected Data Members¶
| Name |
|---|
p_directive_end_kind |
p_is_short_circuit_generated |
p_numeric_label |
p_omp_fortran_spelling |
p_source_sequence_value |
Friends¶
| Name | Description |
|---|---|
isSgStatement | Casts pointer from base class to derived class (for const pointers) |
isSgStatement | Casts pointer from base class to derived class |
Derived Classes¶
| Name | Description |
|---|---|
SgAccBodyStatement | |
SgAccClauseStatement | |
SgAllocateStatement | |
SgArithmeticIfStatement | |
SgAssignStatement | |
SgAssignedGotoStatement | |
SgAttributedStatement | |
SgBreakStmt | This class represents the notion of a break statement |
SgCaseOptionStmt | This class represents the concept of a C and C++ case option (used within a switch statement). |
SgCatchStatementSeq | This class represents the concept of a C++ sequence of catch statements. |
SgComputedGotoStatement | |
SgContinueStmt | This class represents the concept of a C or C++ continue statement. |
SgDeallocateStatement | |
SgDeclarationStatement | This class represents the concept of a declaration statement. |
SgDefaultOptionStmt | This class represents the concept of a C or C++ default case within a switch |
SgElseWhereStatement | |
SgExprStatement | This class represents the concept of a C or C++ statement which contains a |
SgForInitStatement | This class represents the variable declaration or variable initialization withn a |
SgFortranContinueStmt | |
SgFunctionTypeTable | Canonical function types indexed by semantic signatures. |
SgGotoStatement | This class represents the concept of a C or C++ goto statement. |
SgIOStatement | |
SgImageControlStatement | |
SgLabelStatement | This class represents the concept of a C or C++ label statement. |
SgNullStatement | |
SgNullifyStatement | |
SgOmpExecStatement | |
SgProcessControlStatement | |
SgReturnStmt | A return statement with an optional expression. |
SgScopeStatement | This class represents the concept of a scope in C++ (e.g. global scope, fuction scope, etc.). |
SgTryStmt | This class represents the concept of try statement within the try-catch |
SgWhereStatement |
Created with MrDocs