Skip to content

SgTypedefDeclaration

This class represents the notion of a typedef declaration.

Synopsis

Declared in <src/frontend/SageIII/Cxx_Grammar.h> (not stored in Git)

class [[visibility("default")]] SgTypedefDeclaration
    : public SgDeclarationStatement

Description

Typedefs define new types for use in variable declarations, function parameter lists, etc. Typically the base type is complex and the typedef name allows the more complex types use to be made easier to read.

  • Todo: There are a few data members in this field that don't appear to be used (should be removed if not required):
  • p_declaration: have not seen it be used anywhere (I think it is used when a declartion is explicit in the typedef, check this out, might be part of older mechanism before defining and nondefining declarations were developed to provide a uniform mechanism for all declarations)
  • See also: Example of using a SgTypedefDeclaration object

Data members

SgName SgTypedefDeclaration::p_name

This is the name of the newly defined type.

  • Internal: This name carries no qualification.

SgType SgTypedefDeclaration::p_base_type

This is the type being given a new name by the typedef declaration.

  • Internal: This name can be private so using the base type directly can cause access violations within generated code.

SgTypedefType SgTypedefDeclaration::p_type

This is the resulting type defined by the typedef declaration. This type can be used where any type can be use, declaration of variables, etc.

  • Internal: Because of access privileges on the typedef declaration the resulting type can have access restrictions.

SgDeclarationStatement SgTypedefDeclaration::p_declaration

pointer to the declaration (typically a SgClassDeclaration). A typedef such as "typedef struct {int __pos; int __state;} _G_fpos64_t;" defines a class as part of its declaration. p_declaration pointes to the declaration in these cases.

  • Internal: This is the class declaration in a typedef that defines a class.

`bool

SgTypedefDeclaration::p_typedefBaseTypeContainsDefiningDeclaration` This flag indicates that the typedef defines a structure typedefExample.C This example show the definition of a struct within the typedef.

  • Internal: I would like to give this a better name.

SgScopeStatement SgTypedefDeclaration::p_scope

This is the scope of the typedef declaration.

  • Internal: Comment on why we need to store the scope explicitly (resolves name qualification issues).

Member functions

SgTypedefDeclaration::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.

Base Classes

Name Description
SgDeclarationStatement This class represents the concept of a declaration statement.

Type Aliases

Name
base_node_type

Enums

Name Description
Unnamed enum static variant value
typedef_type_enum

Member Functions

Name Description
SgTypedefDeclaration
SgTypedefDeclaration( SgName name, SgType* base_type, SgTypedefType* type, SgDeclarationStatement* declaration); [constructor]
Constructors
~SgTypedefDeclaration
virtual ~SgTypedefDeclaration(); [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]
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]
fixupCopy_references
virtual void fixupCopy_references( SgNode* copy, SgCopyHelp& help) const override; [virtual]
fixupCopy_scopes
virtual void fixupCopy_scopes( SgNode* copy, SgCopyHelp& help) const override; [virtual]
fixupCopy_symbols
virtual void fixupCopy_symbols( SgNode* copy, SgCopyHelp& help) const override; [virtual]
get_baseTypeDefiningDeclaration
SgDeclarationStatement* get_baseTypeDefiningDeclaration() const;
Returns the exact defining tag declaration structurally owned by this typedef, or NULL when the base type is only referenced or this typedef owns a nondefining tag introduction.
get_baseTypeNondefiningDeclaration
SgDeclarationStatement* get_baseTypeNondefiningDeclaration() const;
Returns the exact nondefining tag introduction structurally owned by this typedef, or NULL when the base type is only referenced or this typedef owns an inline tag definition.
get_base_type
SgType* get_base_type() const;
get_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_declaration
SgDeclarationStatement* get_declaration() const;
get_global_qualification_required
bool get_global_qualification_required() const;
get_global_qualification_required_for_base_type
bool get_global_qualification_required_for_base_type() const;
get_isAssociatedWithDeclarationList
bool get_isAssociatedWithDeclarationList() const;
get_isAutonomousDeclaration
bool get_isAutonomousDeclaration() const;
get_mangled_name
virtual SgName get_mangled_name() const override; [virtual]
get_name
SgName get_name() const;
get_name_qualification_length
int get_name_qualification_length() const;
get_name_qualification_length_for_base_type
int get_name_qualification_length_for_base_type() const;
get_numberOfTraversalSuccessors
virtual size_t get_numberOfTraversalSuccessors() const override; [virtual]
return number of children in the traversal successor list
get_qualified_name
virtual SgName get_qualified_name() const; [virtual]
get_requiresGlobalNameQualificationOnType
bool get_requiresGlobalNameQualificationOnType() const;
get_scope
virtual SgScopeStatement* get_scope() const override; [virtual]
get_source_base_type_global_qualification
bool get_source_base_type_global_qualification() const;
get_source_base_type_qualification_present
bool get_source_base_type_qualification_present() const;
get_source_base_type_qualification_tokens
SgStringList const& get_source_base_type_qualification_tokens() const;
get_symbol_from_symbol_table
virtual SgSymbol* get_symbol_from_symbol_table() const override; [virtual]
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
SgTypedefType* get_type() const;
get_type_elaboration_required
bool get_type_elaboration_required() const;
get_type_elaboration_required_for_base_type
bool get_type_elaboration_required_for_base_type() const;
get_typedefBaseTypeContainsDefiningDeclaration
bool get_typedefBaseTypeContainsDefiningDeclaration() const;
get_typedef_type
SgTypedefDeclaration::typedef_type_enum get_typedef_type() const;
hasExplicitScope
virtual bool hasExplicitScope() const override; [virtual]
Support for where the scope is explicitly required
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.
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_base_type
void set_base_type(SgType* base_type);
set_declaration
void set_declaration(SgDeclarationStatement* declaration);
set_global_qualification_required
void set_global_qualification_required(bool global_qualification_required);
set_global_qualification_required_for_base_type
void set_global_qualification_required_for_base_type(bool global_qualification_required_for_base_type);
set_isAssociatedWithDeclarationList
void set_isAssociatedWithDeclarationList(bool isAssociatedWithDeclarationList);
set_isAutonomousDeclaration
void set_isAutonomousDeclaration(bool isAutonomousDeclaration);
set_name
void set_name(SgName name);
set_name_qualification_length
void set_name_qualification_length(int name_qualification_length);
set_name_qualification_length_for_base_type
void set_name_qualification_length_for_base_type(int name_qualification_length_for_base_type);
set_requiresGlobalNameQualificationOnType
void set_requiresGlobalNameQualificationOnType(bool requiresGlobalNameQualificationOnType);
set_scope
virtual void set_scope(SgScopeStatement* scope) override; [virtual]
set_source_base_type_global_qualification
void set_source_base_type_global_qualification(bool source_base_type_global_qualification);
set_source_base_type_qualification_present
void set_source_base_type_qualification_present(bool source_base_type_qualification_present);
set_type
void set_type(SgTypedefType* type);
set_type_elaboration_required
void set_type_elaboration_required(bool type_elaboration_required);
set_type_elaboration_required_for_base_type
void set_type_elaboration_required_for_base_type(bool type_elaboration_required_for_base_type);
set_typedefBaseTypeContainsDefiningDeclaration
void set_typedefBaseTypeContainsDefiningDeclaration(bool typedefBaseTypeContainsDefiningDeclaration);
set_typedef_type
void set_typedef_type(SgTypedefDeclaration::typedef_type_enum typedef_type);
variantT
virtual VariantT variantT() const override; [virtual]
returns new style SageIII enum values

Static Member Functions

Name Description
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 Member Functions

Name Description
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]
compute_baseTypeDefiningDeclaration
SgDeclarationStatement* compute_baseTypeDefiningDeclaration() const;
Internal support for traversal of the exact structurally owned base tag. Despite the legacy name, this returns either the defining or nondefining owned tag. Referenced declarations are never traversal children.
replace_child
virtual bool replace_child( SgStatement*, SgStatement*, bool extractListFromBasicBlock = false) override; [virtual]

Protected Data Members

Name
p_base_type
p_declaration
p_global_qualification_required
p_global_qualification_required_for_base_type
p_isAssociatedWithDeclarationList
p_isAutonomousDeclaration
p_name
p_name_qualification_length
p_name_qualification_length_for_base_type
p_requiresGlobalNameQualificationOnType
p_scope
p_source_base_type_global_qualification
p_source_base_type_qualification_present
p_source_base_type_qualification_tokens
p_type
p_type_elaboration_required
p_type_elaboration_required_for_base_type
p_typedefBaseTypeContainsDefiningDeclaration
p_typedef_type

Friends

Name Description
isSgTypedefDeclaration Casts pointer from base class to derived class (for const pointers)
isSgTypedefDeclaration Casts pointer from base class to derived class

Derived Classes

Name Description
SgTemplateInstantiationTypedefDeclaration
SgTemplateTypedefDeclaration

Created with MrDocs