Skip to content

SgTemplateInstantiationDecl

This class represents the concept of an instantiated class template.

Synopsis

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

class [[visibility("default")]] SgTemplateInstantiationDecl
    : public SgClassDeclaration

Description

  • Internal: Objects of this class are marked as compiler-generated if they are instantiated by the compiler, but not if they are generated from a specialization (where the user has in effect generated it). A few details:
  • Currently multple declaration have a valid pointer to the SgTemplateInstantiationDefn object even though there is only one defining declaration. This is different from functions declarations where only one declaration has a valid pointer to the SgFunctionDefinition. This needs to be made consistant at some point.
  • Todo: Make the "*PtrList" typed objects non-pointer data members (lists) instead of pointer to lists.
  • See also: Example of using a SgTemplateInstantiationDecl object

Data members

SgTemplateInstantiationDecl::p_templateName

This is the name of the templated class (excludes template arguments) The frontend publishes the template's identifier and its typed argument list during construction. Unparsing renders the arguments from their AST nodes.

SgTemplateInstantiationDecl::p_templateHeader

This data field is not used (or is used internally). I forget what this name includes.

SgTemplateInstantiationDecl::p_templateDeclaration

This is the template declarations (SgTemplateDeclaration) from which this template instantiation is constructed. This can be NULL, as I recall, for nested classes.

SgTemplateInstantiationDecl::p_templateArguments

This is a pointer to a list of pointers to SgTemplateArgument objects (used with the SgTemplateDeclaration to construct this instantiation). Not all arguments are output in the generated code (see SgTemplateArgument for details).

  • Note: Template arguments are found in the instantiations, and template parameters are found in the SgTemplateDeclaration (arguments are not the same a parameters, same as for descriptions for functions).

Member functions

`SgTemplateInstantiationDecl::SgTemplateInstantiationDecl (

Sg_File_Info* startOfConstruct = NULL,` SgName name = SgdefaultName, int class_type = 0, SgClassType *type=NULL, SgClassDefinition *definition=NULL) This is the only constructor. This constructor builds the SgTemplateInstantiationDecl base class. but has some specific side-effects (some of which have been removed in the latest work). It is however still that case that if the definition is provided then it's declaration will be changed to the declaration being constructed (a warning message it output if this happens and this side-effect will be removed soon).

  • Param startOfConstruct: represents the position in the source code
  • See also: Example:create an SgTemplateInstantiationDecl object

SgTemplateInstantiationDecl::get_templateName() const

Returns name of class template, the name excludes template arguments. For the template name with arguments, e.g. "class_template<int>" the user should call get_name() (defined in the SgClassDeclaration base class).

  • Note: The SgClassSymbol used to hold a reference to this declaration in the symbol table is placed into the symbol table using the get_name(); includes template arguments.
  • Internal: There are cases where the arguments should not be unparse and then this version of the name is required. Also in generating mangled names, this is a more useful name to have separately from the name which inclused arguments. However in these case it still seems that we could get it from the template declaration (if it is available, member fucntions of a templated class may not have an explicit or separate template declaration).
  • Return: returns SgName by value.

SgTemplateInstantiationDecl::set_templateName(SgName name)

sets name of instantiated class template, name excludes template arguments.

  • Return: returns void.

SgTemplateInstantiationDecl::get_templateDeclaration() const

Returns pointer to SgTemplateDeclaration from which instantiation is generated.

  • Return: returns pointer to SgTemplateDeclaration.

`SgTemplateInstantiationDecl::set_templateDeclaration(SgTemplateDeclaration* templateDeclaration)` Access function for p_templateDeclaration.

  • Return: returns void.

SgTemplateInstantiationDecl::get_templateArguments() const

Returns the declaration's list of template arguments by reference.

Base Classes

Name Description
SgClassDeclaration This class represents the concept of a class declaration statement. It includes the

Type Aliases

Name
base_node_type
template_kind_t

Enums

Name Description
Unnamed enum static variant value

Member Functions

Name Description
SgTemplateInstantiationDecl
SgTemplateInstantiationDecl( SgName name, SgClassDeclaration::class_types class_type, SgClassType* type, SgClassDefinition* definition, SgTemplateClassDeclaration* templateDeclaration, SgTemplateArgumentPtrList templateArguments, SgTemplateArgumentPtrList semanticTemplateArguments, bool sourceSpellsInjectedClassName, SgTemplateArgumentPtrList deducedTemplateArguments); [constructor]
Constructors
~SgTemplateInstantiationDecl
virtual ~SgTemplateInstantiationDecl(); [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_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_constraintSatisfactionContainsErrors
bool get_constraintSatisfactionContainsErrors() const;
get_constraintSatisfactionEvaluated
bool get_constraintSatisfactionEvaluated() const;
get_constraintSatisfactionSatisfied
bool get_constraintSatisfactionSatisfied() const;
get_constraintSatisfactionSubstitutionFailure
bool get_constraintSatisfactionSubstitutionFailure() const;
get_constraintSatisfactionSummary
std::string get_constraintSatisfactionSummary() const;
get_deducedTemplateArguments
SgTemplateArgumentPtrList const& get_deducedTemplateArguments() const;
get_mangled_name
virtual SgName get_mangled_name() const override; [virtual]
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 override; [virtual]
get_semanticTemplateArguments
SgTemplateArgumentPtrList const& get_semanticTemplateArguments() const;
get_sfinaeEvaluated
bool get_sfinaeEvaluated() const;
get_sfinaeSubstitutionFailure
bool get_sfinaeSubstitutionFailure() const;
get_sfinaeSummary
std::string get_sfinaeSummary() const;
get_sourceSpellsInjectedClassName
bool get_sourceSpellsInjectedClassName() const;
get_specializedTemplateDeclaration
SgDeclarationStatement* get_specializedTemplateDeclaration() const;
get_templateArguments
SgTemplateArgumentPtrList const& get_templateArguments() const;
get_templateDeclaration
SgTemplateClassDeclaration* get_templateDeclaration() const;
get_templateHeader
SgName get_templateHeader() const;
get_templateName
SgName get_templateName() 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
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_constraintSatisfactionContainsErrors
void set_constraintSatisfactionContainsErrors(bool constraintSatisfactionContainsErrors);
set_constraintSatisfactionEvaluated
void set_constraintSatisfactionEvaluated(bool constraintSatisfactionEvaluated);
set_constraintSatisfactionSatisfied
void set_constraintSatisfactionSatisfied(bool constraintSatisfactionSatisfied);
set_constraintSatisfactionSubstitutionFailure
void set_constraintSatisfactionSubstitutionFailure(bool constraintSatisfactionSubstitutionFailure);
set_constraintSatisfactionSummary
void set_constraintSatisfactionSummary(std::string constraintSatisfactionSummary);
set_definition
void set_definition(SgClassDefinition* definition);
set_sfinaeEvaluated
void set_sfinaeEvaluated(bool sfinaeEvaluated);
set_sfinaeSubstitutionFailure
void set_sfinaeSubstitutionFailure(bool sfinaeSubstitutionFailure);
set_sfinaeSummary
void set_sfinaeSummary(std::string sfinaeSummary);
set_sourceSpellsInjectedClassName
void set_sourceSpellsInjectedClassName(bool sourceSpellsInjectedClassName);
set_specializedTemplateDeclaration
void set_specializedTemplateDeclaration(SgDeclarationStatement* specializedTemplateDeclaration);
set_templateDeclaration
void set_templateDeclaration(SgTemplateClassDeclaration* templateDeclaration);
set_templateHeader
void set_templateHeader(SgName templateHeader);
set_templateName
void set_templateName(SgName templateName);
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 Data Members

Name
p_constraintSatisfactionContainsErrors
p_constraintSatisfactionEvaluated
p_constraintSatisfactionSatisfied
p_constraintSatisfactionSubstitutionFailure
p_constraintSatisfactionSummary
p_deducedTemplateArguments
p_semanticTemplateArguments
p_sfinaeEvaluated
p_sfinaeSubstitutionFailure
p_sfinaeSummary
p_sourceSpellsInjectedClassName
p_specializedTemplateDeclaration
p_templateArguments
p_templateDeclaration
p_templateHeader
p_templateName

Friends

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

Created with MrDocs