Skip to content

SgType

This class represents the base class for all types.

Synopsis

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

class [[visibility("default")]] SgType
    : public SgNode

Description

There are no uses of this IR node anywhere. All SgType based IR nodes are derived from this SgType class. Discussion of get_base_type() and findBaseType():

  1. fileBaseType() will recursively strip away all typedefs, reference, pointers, arrays, and modifiers

  2. get_base_type() is a member function on some IR nodes derived from SgType and returns the non-recursively striped (immediate) type under the typedefs, reference, pointers, arrays, modifiers, etc.

  • Internal: This is a base class for all SgType objects.
  • Todo: Several classes derived from SgType are not used and can be removed:

  • SgTypeUnknown (Used by SageInterface to specify references to undeclared variables)

  • SgUnknownMemberFunctionType

  • Todo: Labels appear to be used as types in "foo(,)", see example from Chris (LANL, 4/19/2007).
  • See also: Example of using a SgType object

Data members

SgReferenceType SgType::p_ref_to

This holds the pointer to a SgReferenceType if this type is a reference to another type.

SgPointerType SgType::p_ptr_to

This holds the pointer to a SgPointerType if this type is a pointer to another type.

SgReferenceType SgType::p_modifiers

This points to any SgModifierNodes if this type contains type modifiers.

Base Classes

Name Description
SgNode This class represents the base class for all IR nodes within Sage III.

Type Aliases

Name
base_node_type

Enums

Name Description
Unnamed enum static variant value
fortran_attribute_specifiers_enum

Member Functions

Name Description
SgType
SgType(); [constructor]
Constructors
~SgType
virtual ~SgType(); [destructor] [virtual]
Destructor
accept
virtual void accept(ROSE_VisitorPattern& visitor) override; [virtual]
support for the classic visitor pattern done in GoF
addNewAttribute
virtual void addNewAttribute( std::string s, AstAttribute* a) override; [virtual]
Add a new attribute represented by the named string.
appendDestructorOwnedNodes
virtual void appendDestructorOwnedNodes(std::vector<SgNode*>& nodes) const override; [virtual]
attributeExists
virtual bool attributeExists(std::string s) const override; [virtual]
Tests if attribute of name 's' is present.
class_name
virtual std::string class_name() const override; [virtual]
returns a string representing the class name
containsInternalTypes
bool containsInternalTypes();
Some types can hide other type IR nodes internally. This function is true if it can hide another type (pointer, array, etc.).
copy
virtual SgNode* copy(SgCopyHelp& help) const override; [virtual]
dereference
SgType* dereference();
findBaseType
SgType* findBaseType() const;
Return the base type of the associated type. The base type is important when dealing with pointers, arrays, etc.
getAssociatedDeclaration
SgDeclarationStatement* getAssociatedDeclaration() const;
getAttribute
virtual AstAttribute* getAttribute(std::string s) const override; [virtual]
Returns attribute of name 's'.
getInternalTypes
std::vector<SgType*> getInternalTypes() const;
Generate a container of types hidden in the input type.
get_ast_json_type_identity
uint64_t get_ast_json_type_identity() const;
get_attributeMechanism
virtual AstAttributeMechanism* get_attributeMechanism() const override; [virtual]
get_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_fortran_fixed_kind_value
int64_t get_fortran_fixed_kind_value() const;
get_fortran_fixed_kind_value_is_available
bool get_fortran_fixed_kind_value_is_available() const;
get_fortran_source_syntax
bool get_fortran_source_syntax() const;
get_hasTypeKindStar
bool get_hasTypeKindStar() const;
get_isCoArray
bool get_isCoArray() const;
get_mangled
virtual SgName get_mangled() const; [virtual]
Returns a mangled string representation of this type. Equivalent types have the same mangled string.
get_modifiers
SgModifierNodes* get_modifiers() const;
get_numberOfTraversalSuccessors
virtual size_t get_numberOfTraversalSuccessors() const override; [virtual]
return number of children in the traversal successor list
get_ptr_to
SgPointerType* get_ptr_to() const;
get_ref_to
SgReferenceType* get_ref_to() const;
get_rvalue_ref_to
SgRvalueReferenceType* get_rvalue_ref_to() 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_kind
virtual SgExpression* get_type_kind() const; [virtual]
hasExplicitType
bool hasExplicitType();
Some types store internal SgType pointers explicitly while others compute them from other data. This function is true if it has a data member that is a type (pointer, array, etc.).
has_source_prototype
bool has_source_prototype() const;
isEquivalentType
bool isEquivalentType(SgType const* other_type) const;
Type equivalence is the concept of equality between types independent of access permissions (e.g. private or protected types in a class).
isFloatType
bool isFloatType() const;
isIntegerType
bool isIntegerType() const;
isPrimativeType
bool isPrimativeType() const;
isUnsignedType
bool isUnsignedType() const;
Compute numerical properties of type.
numberOfAttributes
virtual int numberOfAttributes() const override; [virtual]
Returns the number of attributes on this IR node.
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.
removeAttribute
virtual void removeAttribute(std::string s) override; [virtual]
Remove attribute of name 's' if present.
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
setAttribute
virtual void setAttribute( std::string s, AstAttribute* a) override; [virtual]
This is a wrapper function with the following semantics: if no attribute of name 's' exists then addNewAttribute(s,a); is called, otherwise updateAttribute(s,a); is called.
set_ast_json_type_identity
void set_ast_json_type_identity(uint64_t identity);
set_attributeMechanism
virtual void set_attributeMechanism(AstAttributeMechanism* attributeMechanism) override; [virtual]
set_fortran_fixed_kind_value
void set_fortran_fixed_kind_value(int64_t fortran_fixed_kind_value);
set_fortran_fixed_kind_value_is_available
void set_fortran_fixed_kind_value_is_available(bool fortran_fixed_kind_value_is_available);
set_fortran_source_syntax
void set_fortran_source_syntax(bool fortran_source_syntax);
set_hasTypeKindStar
void set_hasTypeKindStar(bool hasTypeKindStar);
set_isCoArray
void set_isCoArray(bool isCoArray);
set_modifiers
void set_modifiers(SgModifierNodes* modifiers);
set_ptr_to
void set_ptr_to(SgPointerType* ptr_to);
set_ref_to
void set_ref_to(SgReferenceType* ref_to);
set_rvalue_ref_to
void set_rvalue_ref_to(SgRvalueReferenceType* rvalue_ref_to);
set_type_kind
virtual void set_type_kind(SgExpression* type_kind); [virtual]
stripType
SgType* stripType(unsigned char bit_array = STRIP_MODIFIER_TYPE | STRIP_REFERENCE_TYPE | STRIP_RVALUE_REFERENCE_TYPE | STRIP_POINTER_TYPE | STRIP_ARRAY_TYPE | STRIP_TYPEDEF_TYPE | STRIP_POINTER_MEMBER_TYPE | STRIP_DECLTYPE_TYPE) const;
Returns hidden type beneath layers of typedefs, pointers, references, modifiers, array representation, etc.
stripTypedefsAndModifiers
SgType* stripTypedefsAndModifiers() const;
This only strips away typedefs and modifiers (specialized usage).
updateAttribute
virtual void updateAttribute( std::string s, AstAttribute* a) override; [virtual]
Replace existing attribute of name 's' with new AstAttribute.
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
STRIP_ARRAY_TYPE
STRIP_DECLTYPE_TYPE
STRIP_MODIFIER_TYPE
STRIP_POINTER_MEMBER_TYPE
STRIP_POINTER_TYPE
STRIP_REFERENCE_TYPE
STRIP_RVALUE_REFERENCE_TYPE
STRIP_TYPEDEF_TYPE
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_ast_json_type_identity
p_attributeMechanism
p_fortran_fixed_kind_value
p_fortran_fixed_kind_value_is_available
p_fortran_source_syntax
p_hasTypeKindStar
p_isCoArray
p_modifiers
p_ptr_to
p_ref_to
p_rvalue_ref_to
p_type_kind
p_unary_transform_types

Friends

Name Description
isSgType Casts pointer from base class to derived class (for const pointers)
isSgType Casts pointer from base class to derived class
SgUnaryTransformType
SgTypeOfType
SgTypedefType
SgDeclType
SgRvalueReferenceType
SgReferenceType
SgPointerType

Derived Classes

Name Description
SgArrayType
SgAutoType
SgDeclType
SgFloatingPointType
SgFunctionType This class represents a type for all functions.
SgIntegralType
SgModifierType
SgNamedType
SgPointerType
SgReferenceType
SgRvalueReferenceType
SgTemplateType
SgTypeComplex This class represents a C99 complex type.
SgTypeCrayPointer
SgTypeDefault A placeholder type.
SgTypeDependent
SgTypeEllipse
SgTypeFortranAssumed
SgTypeFortranBOZ
SgTypeFortranUnlimitedPolymorphic
SgTypeGlobalVoid
SgTypeImaginary This class represents a C99 complex type.
SgTypeLabel
SgTypeNullptr
SgTypeOfType
SgTypeString This class represents a string type used for SgStringVal IR node.
SgTypeTargetBuiltin
SgTypeUnknown
SgTypeVoid
SgUnaryTransformType

Created with MrDocs