Skip to content

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
SgConstructorInitializer
SgConstructorInitializer( 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
~SgConstructorInitializer
virtual ~SgConstructorInitializer(); [destructor] [virtual]
Destructor
accept
virtual void accept(ROSE_VisitorPattern& visitor) override; [virtual]
support for the classic visitor pattern done in GoF
appendDestructorOwnedNodes
virtual void appendDestructorOwnedNodes(std::vector<SgNode*>& nodes) const override; [virtual]
cfgInEdges
virtual std::vector<VirtualCFG::CFGEdge> cfgInEdges(unsigned int index) override; [virtual]
cfgIndexForEnd
virtual unsigned int cfgIndexForEnd() const override; [virtual]
cfgOutEdges
virtual std::vector<VirtualCFG::CFGEdge> cfgOutEdges(unsigned int index) override; [virtual]
class_name
virtual std::string class_name() const override; [virtual]
returns a string representing the class name
copy
virtual SgNode* copy(SgCopyHelp& help) const override; [virtual]
get_args
SgExprListExp* get_args() const;
get_argument_source
SgConstructorInitializer::argument_source_enum get_argument_source() const;
get_associated_class_unknown
bool get_associated_class_unknown() const;
get_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_class_decl
SgClassDeclaration* get_class_decl() const;
Get the SgClassDeclaration associated with this constructor call.
get_declaration
SgMemberFunctionDeclaration* get_declaration() const;
get_elision_permitted
bool get_elision_permitted() const;
get_explicit_global_qualification
bool get_explicit_global_qualification() const;
get_explicit_name_qualification_present
bool get_explicit_name_qualification_present() const;
get_explicit_name_qualification_tokens
SgStringList get_explicit_name_qualification_tokens() const;
get_expression_type
SgType* get_expression_type() const;
get_global_qualification_required
virtual bool get_global_qualification_required() const override; [virtual]
get_is_elidable
bool get_is_elidable() const;
get_is_used_in_conditional
bool get_is_used_in_conditional() const;
get_name_qualification_length
virtual int get_name_qualification_length() const override; [virtual]
get_need_name
bool get_need_name() const;
get_need_parenthesis_after_name
bool get_need_parenthesis_after_name() const;
get_need_qualifier
bool get_need_qualifier() const;
get_next
SgExpression* get_next(int& n) const;
get_numberOfTraversalSuccessors
virtual size_t get_numberOfTraversalSuccessors() const override; [virtual]
return number of children in the traversal successor list
get_source_type_elaboration_kind
SgNonrealDecl::source_elaboration_kind_enum get_source_type_elaboration_kind() const;
get_traversalSuccessorByIndex
virtual SgNode* get_traversalSuccessorByIndex(size_t idx) const override; [virtual]
index-based access to traversal successors by index number
get_traversalSuccessorContainer
virtual 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_traversalSuccessorIsListElement
virtual std::vector<bool> get_traversalSuccessorIsListElement() const override; [virtual]
get_traversalSuccessorNamesContainer
virtual 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_type
virtual SgType* get_type() const override; [virtual]
get_type_elaboration_required
virtual bool get_type_elaboration_required() const override; [virtual]
operator delete
void operator delete( void* pointer, size_t size);
deallocated memory for IR node (returns memory to memory pool for reuse)
operator new
void* operator new(size_t size);
returns pointer to newly allocated IR node
post_construction_initialization
virtual void post_construction_initialization() override; [virtual]
processDataMemberReferenceToPointers
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler*) override; [virtual]
Pass references to stored node pointers to a handler.
replace_expression
virtual int replace_expression( SgExpression*, SgExpression*) override; [virtual]
returnDataMemberPointers
virtual std::vector<std::pair<SgNode*, std::string>> returnDataMemberPointers() const override; [virtual]
Return the node pointers stored in this node's data members.
roseRTI
virtual RTIReturnType roseRTI() override; [virtual]
return C++ Runtime-Time-Information
sage_class_name
virtual char const* sage_class_name() const override; [virtual]
returns a C style string (char*) representing the class name
set_args
void set_args(SgExprListExp* args);
set_argument_source
void set_argument_source(SgConstructorInitializer::argument_source_enum argument_source);
set_associated_class_unknown
void set_associated_class_unknown(bool associated_class_unknown);
set_declaration
void set_declaration(SgMemberFunctionDeclaration* declaration);
set_elision_permitted
void set_elision_permitted(bool elision_permitted);
set_explicit_global_qualification
void set_explicit_global_qualification(bool explicit_global_qualification);
set_explicit_name_qualification_present
void set_explicit_name_qualification_present(bool explicit_name_qualification_present);
set_explicit_name_qualification_tokens
void set_explicit_name_qualification_tokens(SgStringList explicit_name_qualification_tokens);
set_expression_type
void set_expression_type(SgType* expression_type);
set_global_qualification_required
virtual void set_global_qualification_required(bool global_qualification_required) override; [virtual]
set_is_elidable
void set_is_elidable(bool is_elidable);
set_is_used_in_conditional
void set_is_used_in_conditional(bool is_used_in_conditional);
set_name_qualification_length
virtual void set_name_qualification_length(int name_qualification_length) override; [virtual]
set_need_name
void set_need_name(bool need_name);
set_need_parenthesis_after_name
void set_need_parenthesis_after_name(bool need_parenthesis_after_name);
set_need_qualifier
void set_need_qualifier(bool need_qualifier);
set_source_type_elaboration_kind
void set_source_type_elaboration_kind(SgNonrealDecl::source_elaboration_kind_enum source_type_elaboration_kind);
set_type_elaboration_required
virtual void set_type_elaboration_required(bool type_elaboration_required) override; [virtual]
validate_argument_context
void validate_argument_context() const;
validate_elision
void validate_elision() const;
variantT
virtual VariantT variantT() const override; [virtual]
returns new style SageIII enum values

Static Member Functions

Name Description
is_valid_argument_source
static bool is_valid_argument_source( SgMemberFunctionDeclaration* declaration, SgExpressionPtrList const& arguments, argument_source_enum source);
is_valid_elision_arguments
static bool is_valid_elision_arguments( SgMemberFunctionDeclaration* declaration, SgExpressionPtrList const& arguments);
memoryUsage
static size_t memoryUsage();
Returns the size in bytes of the total memory allocated for all IR nodes of this type
numberOfNodes
static size_t numberOfNodes();
Returns the total number of IR nodes of this type
traverseMemoryPoolNodes
static void traverseMemoryPoolNodes(ROSE_VisitTraversal& visit);
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
traverseMemoryPoolVisitorPattern
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern& visitor);
FOR INTERNAL USE Support for visitor pattern.
visitRepresentativeNode
static 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

Name
p_args
p_argument_source
p_associated_class_unknown
p_declaration
p_elision_permitted
p_explicit_global_qualification
p_explicit_name_qualification_present
p_explicit_name_qualification_tokens
p_expression_type
p_global_qualification_required
p_is_elidable
p_is_used_in_conditional
p_name_qualification_length
p_need_name
p_need_parenthesis_after_name
p_need_qualifier
p_source_type_elaboration_kind
p_type_elaboration_required

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