SgConstructorInitializer¶
This class represents the call of a class constructor to initialize a variable.
Synopsis¶
Declared in <src/frontend/SageIII/Cxx_Grammar.h> (not stored in Git)
class [[visibility("default")]] SgConstructorInitializer
: public SgInitializer Description¶
For example "Foo foo;" or "Bar bar(1,2,3);" to initialize foo and bar respecitively. In both cases it holds the function declaration of the call constructor. It also holds an SgExprListExp that represents the arguments to the constructor. The list is empty if there are no arguments.
- Internal: This is a base class for all initializers.
- See also: Example of using a SgConstructorInitializer object
Data members
SgConstructorInitializer::p_declaration¶
This points to the associated member function declaration (a constructor). Note that this pointer can be NULL if no such constructor is defined (e.g. compiler generated default constructor).
- Internal: Constructors not explicit in the source code are not presently generated in ROSE if there were to be generated in the future they will be marked as compiler generated and likely we can then enforce that this be a valid pointer. This variable is an exception to the general rule that we have no NULL pointes within the AST.
SgConstructorInitializer::p_args¶
This points to the argument list of the associated constructor call.
- Internal: Note that this pointer is always a valid pointer, even if the constructor and class declaration pointers are NULL. This list can also be empty, but the poitner to the list is always valid.
SgConstructorInitializer::p_expression_type¶
This points to the associated type for this constructor.
- Internal: This pointer should always be valid, "p_associated_class_unknown" is true iff "p_expression_type" is not a SgClassType.
SgConstructorInitializer::p_need_name¶
This bool value controls the output of the class name. This might be somewhat redundant with the explicit vs. implement representation in the source code (recorded in another flag of the SgExpression base class).
SgConstructorInitializer::p_need_qualifier¶
This bool value controls the output of the class names qualifier.
- Internal: The qualifier is currently always output. This variable is not used.
SgConstructorInitializer::p_need_parenthesis_after_name¶
This bool value controls the output of "()" after the class name. The controls the output at "class X x;" or "class X x();".
SgConstructorInitializer::p_associated_class_unknown¶
This bool value indicates when p_declaration should be a valid pointer. If true, then p_declaration is NULL, else if false, then p_declaration should be a valid pointer.
- Todo: Enforce p_declaration is valid pointer when p_associated_class_unknown is false within AST consistency tests.
Member functions
SgConstructorInitializer::get_need_name() const¶
returns bool value if name is required in code generation then return true.
- Return: Returns bool value.
SgConstructorInitializer::set_need_name (bool required)¶
This function allows the p_need_name flag to be set (used internally).
- Param
required: - sets value of internal p_need_name flag. - Return: Returns void.
SgConstructorInitializer::set_expression_type (SgType* type)¶
Access function for p_expression_type.
- Param
required: - sets value of internal p_expression_type. - Return: Returns void.
SgConstructorInitializer::get_expression_type() const¶
Access function for p_expression_type, returns pointer to SgType associated with constructor. This is usually a SgClassType, but it can also be a primative type (typically in association with a new operator).
- Return: Returns pointer to SgType.
Base Classes¶
| Name | Description |
|---|---|
SgInitializer | This class represents the notion of an initializer for a variable declaration or |
Type Aliases¶
| Name |
|---|
base_node_type |
Enums¶
| Name | Description |
|---|---|
Unnamed enum | static variant value |
argument_source_enum |
Member Functions¶
| Name | Description |
|---|---|
SgConstructorInitializerSgConstructorInitializer( SgMemberFunctionDeclaration* declaration, SgExprListExp* args, SgType* expression_type, bool need_name, bool need_qualifier, bool need_parenthesis_after_name, bool associated_class_unknown, SgConstructorInitializer::argument_source_enum argument_source); [constructor] | Constructors |
~SgConstructorInitializervirtual ~SgConstructorInitializer(); [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] | |
cfgInEdgesvirtual std::vector<VirtualCFG::CFGEdge> cfgInEdges(unsigned int index) override; [virtual] | |
cfgIndexForEndvirtual unsigned int cfgIndexForEnd() 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] | |
get_argsSgExprListExp* get_args() const; | |
get_argument_sourceSgConstructorInitializer::argument_source_enum get_argument_source() const; | |
get_associated_class_unknownbool get_associated_class_unknown() const; | |
get_childIndexvirtual size_t get_childIndex(SgNode* child) const override; [virtual] | index-based access to traversal successors by child node |
get_class_declSgClassDeclaration* get_class_decl() const; | Get the SgClassDeclaration associated with this constructor call. |
get_declarationSgMemberFunctionDeclaration* get_declaration() const; | |
get_elision_permittedbool get_elision_permitted() const; | |
get_explicit_global_qualificationbool get_explicit_global_qualification() const; | |
get_explicit_name_qualification_presentbool get_explicit_name_qualification_present() const; | |
get_explicit_name_qualification_tokensSgStringList get_explicit_name_qualification_tokens() const; | |
get_expression_typeSgType* get_expression_type() const; | |
get_global_qualification_requiredvirtual bool get_global_qualification_required() const override; [virtual] | |
get_is_elidablebool get_is_elidable() const; | |
get_is_used_in_conditionalbool get_is_used_in_conditional() const; | |
get_name_qualification_lengthvirtual int get_name_qualification_length() const override; [virtual] | |
get_need_namebool get_need_name() const; | |
get_need_parenthesis_after_namebool get_need_parenthesis_after_name() const; | |
get_need_qualifierbool get_need_qualifier() const; | |
get_nextSgExpression* get_next(int& n) const; | |
get_numberOfTraversalSuccessorsvirtual size_t get_numberOfTraversalSuccessors() const override; [virtual] | return number of children in the traversal successor list |
get_source_type_elaboration_kindSgNonrealDecl::source_elaboration_kind_enum get_source_type_elaboration_kind() const; | |
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 |
get_typevirtual SgType* get_type() const override; [virtual] | |
get_type_elaboration_requiredvirtual bool get_type_elaboration_required() const override; [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. |
replace_expressionvirtual int replace_expression( SgExpression*, SgExpression*) override; [virtual] | |
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_argsvoid set_args(SgExprListExp* args); | |
set_argument_sourcevoid set_argument_source(SgConstructorInitializer::argument_source_enum argument_source); | |
set_associated_class_unknownvoid set_associated_class_unknown(bool associated_class_unknown); | |
set_declarationvoid set_declaration(SgMemberFunctionDeclaration* declaration); | |
set_elision_permittedvoid set_elision_permitted(bool elision_permitted); | |
set_explicit_global_qualificationvoid set_explicit_global_qualification(bool explicit_global_qualification); | |
set_explicit_name_qualification_presentvoid set_explicit_name_qualification_present(bool explicit_name_qualification_present); | |
set_explicit_name_qualification_tokensvoid set_explicit_name_qualification_tokens(SgStringList explicit_name_qualification_tokens); | |
set_expression_typevoid set_expression_type(SgType* expression_type); | |
set_global_qualification_requiredvirtual void set_global_qualification_required(bool global_qualification_required) override; [virtual] | |
set_is_elidablevoid set_is_elidable(bool is_elidable); | |
set_is_used_in_conditionalvoid set_is_used_in_conditional(bool is_used_in_conditional); | |
set_name_qualification_lengthvirtual void set_name_qualification_length(int name_qualification_length) override; [virtual] | |
set_need_namevoid set_need_name(bool need_name); | |
set_need_parenthesis_after_namevoid set_need_parenthesis_after_name(bool need_parenthesis_after_name); | |
set_need_qualifiervoid set_need_qualifier(bool need_qualifier); | |
set_source_type_elaboration_kindvoid set_source_type_elaboration_kind(SgNonrealDecl::source_elaboration_kind_enum source_type_elaboration_kind); | |
set_type_elaboration_requiredvirtual void set_type_elaboration_required(bool type_elaboration_required) override; [virtual] | |
validate_argument_contextvoid validate_argument_context() const; | |
validate_elisionvoid validate_elision() const; | |
variantTvirtual VariantT variantT() const override; [virtual] | returns new style SageIII enum values |
Static Member Functions¶
| Name | Description |
|---|---|
is_valid_argument_sourcestatic bool is_valid_argument_source( SgMemberFunctionDeclaration* declaration, SgExpressionPtrList const& arguments, argument_source_enum source); | |
is_valid_elision_argumentsstatic bool is_valid_elision_arguments( SgMemberFunctionDeclaration* declaration, SgExpressionPtrList const& arguments); | |
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 Data Members¶
Friends¶
| Name | Description |
|---|---|
isSgConstructorInitializer | Casts pointer from base class to derived class (for const pointers) |
isSgConstructorInitializer | Casts pointer from base class to derived class |
Created with MrDocs