Skip to content

SgSymbolTable

This class represents the symbol tables used in both SgScopeStatement and

Synopsis

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

class [[visibility("default")]] SgSymbolTable
    : public SgSupport

Description

the SgFunctionTypeSymbolTable IR node.

  • Todo: The rose_hash_multimap should perhaps be included as a data member instead of implemented as a pointer. We should consider this detail.
  • Todo: We should decide if we want to give Symbol Tables a name or not, it seems that we rarely if ever do this so perhaps we should not have such a field.
  • See also: Example of using a SgSymbolTable object

Data members

SgSymbolTable::p_iterator

This iterator is used within some of the deprecated functions.

  • Deprecated: I think this iterator should be removed.

SgSymbolTable::p_name

This is the symbol name (mangled is required).

SgSymbolTable::p_no_name

This is a flag to indicate that p_name is empty Some symbols don't have a name.

  • Todo: generate a list of instances where symbols don't have names. (Namespaces don't have to have a name for example).

SgSymbolTable::p_table

This is lower level symbol table implementation (using an STL hash_multimap)

Base Classes

Name Description
SgSupport This class represents the base class of a numbr of IR nodes that don't otherwise fit

Type Aliases

Name
BaseHashType
base_node_type
hash_iterator

Enums

Name Description
Unnamed enum static variant value

Member Functions

Name Description
SgSymbolTable
SgSymbolTable(); [constructor]
Added to support scopes that have more symbols (e.g. SgGlobal, and the function type table)
~SgSymbolTable
virtual ~SgSymbolTable(); [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
clear_symbol_indexes
void clear_symbol_indexes();
copy
virtual SgNode* copy(SgCopyHelp& help) const override; [virtual]
count
int count(SgName const&) const;
Complexity O(n) Computes the number of symbols of a specific name
count_aliases
int count_aliases(SgName const&) const;
Computes the number of alias symbols of a specific name (used in name qualification support).
exists
bool exists(SgName const& name) const;
find
SgSymbol* find(SgFunctionType const* functionType);
find_aliased_symbol
SgAliasSymbol* find_aliased_symbol( SgName const& nm, SgSymbol* sp);
find_any
SgSymbol* find_any();
find_class
SgClassSymbol* find_class();
find_class_instantiation
SgClassSymbol* find_class_instantiation( SgTemplateClassDeclaration* primary, SgTemplateArgumentPtrList const& semanticArguments) const;
find_enum
SgEnumSymbol* find_enum();
find_enum_field
SgEnumFieldSymbol* find_enum_field();
find_for_ast_copy_fixup
SgSymbol* find_for_ast_copy_fixup( SgName const& name, VariantT requestedSymbolKind, SgType const* type, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentList);
Lookup used by AST snippet-copy fixup. This explicitly enables the otherwise-disabled recursive base-class search for one call.
find_for_name_qualification
SgSymbol* find_for_name_qualification( SgName const& name, VariantT requestedSymbolKind, SgType const* type, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentList, SgUnorderedNodeSet const& visibleAliasCausalNodes, bool searchBaseClasses);
Name-qualification lookup with an explicit invocation-owned view of alias and base-class causal nodes. Recursive base lookup is an explicit typed operation and is never enabled for ordinary name-only lookup.
find_function
SgFunctionSymbol* find_function();
find_function_type
SgFunctionTypeSymbol* find_function_type(SgName const& name);
find_label
SgLabelSymbol* find_label();
find_namespace
SgNamespaceSymbol* find_namespace();
find_nonreal
SgNonrealSymbol* find_nonreal( SgName const& name, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentsList);
find_nontemplate_function
SgFunctionSymbol* find_nontemplate_function( SgName const& name, SgType const* type, SgTemplateArgumentPtrList* templateArgumentList);
find_nontemplate_member_function
SgMemberFunctionSymbol* find_nontemplate_member_function( SgName const& name, SgType const* type, SgTemplateArgumentPtrList* templateArgumentList);
find_symbols_with_exact_basis
std::vector<SgSymbol*> const& find_symbols_with_exact_basis(SgNode const* basis) const;
find_template_class
SgTemplateClassSymbol* find_template_class( SgName const& nm, SgTemplateParameterPtrList* templateList, SgTemplateArgumentPtrList* templateArgumentList);
find_template_function
SgTemplateFunctionSymbol* find_template_function( SgName const& name, SgType const* type, SgTemplateParameterPtrList* templateList);
find_template_member_function
SgTemplateMemberFunctionSymbol* find_template_member_function( SgName const& name, SgType const* type, SgTemplateParameterPtrList* templateList);
find_template_typedef
SgTemplateTypedefSymbol* find_template_typedef(SgName const& nm);
find_template_variable
SgTemplateVariableSymbol* find_template_variable( SgName const& name, SgTemplateParameterPtrList* templateList, SgTemplateArgumentPtrList* templateArgumentsList);
find_typedef
SgTypedefSymbol* find_typedef();
find_variable
SgVariableSymbol* find_variable();
get_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_name
SgName get_name() const;
Generates name from any IR node used to generate symbols (only works on specific IR nodes)
get_no_name
bool get_no_name() const;
get_numberOfTraversalSuccessors
virtual size_t get_numberOfTraversalSuccessors() const override; [virtual]
return number of children in the traversal successor list
get_symbolBasisExactIndex
SymbolBasisExactIndex& get_symbolBasisExactIndex();
get_symbolSet
SgNodeSet get_symbolSet() const;
get_symbols
std::set<SgNode*> get_symbols() const;
generate an STL set of all symbols (supports AST merge, but may be temporary)
get_table
rose_hash_multimap* get_table() 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
hasMatchingTemplateArgumentsOrNoTemplateArguments
bool hasMatchingTemplateArgumentsOrNoTemplateArguments( SgTemplateArgumentPtrList* templateArgumentsList, SgSymbol* symbol);
hasMatchingTemplateParametersArgumentsOrNoTemplateParametersArguments
bool hasMatchingTemplateParametersArgumentsOrNoTemplateParametersArguments( SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentsList, SgSymbol* symbol);
hasMatchingTemplateParametersOrArgumentsOrNoTemplateParametersOrArguments
template<class T> bool hasMatchingTemplateParametersOrArgumentsOrNoTemplateParametersOrArguments( std::vector<T*>* templateParametersOrArgumentsList, SgSymbol* symbol);
hasMatchingTemplateParametersOrNoTemplateParameters
bool hasMatchingTemplateParametersOrNoTemplateParameters( SgTemplateParameterPtrList* templateParameterList, SgSymbol* symbol);
insert
void insert( SgName const& name, SgSymbol* sp);
isCaseInsensitive
bool isCaseInsensitive() const;
Query of scope symbol table behavior (is symbol table behavior case sensitive (C/C++) or case insensitive (Fortran).
maxCollisions
size_t maxCollisions();
next_any
SgSymbol* next_any();
next_class
SgClassSymbol* next_class();
Complexity O(n)
next_enum
SgEnumSymbol* next_enum();
Complexity O(n)
next_enum_field
SgEnumFieldSymbol* next_enum_field();
Complexity O(n)
next_function
SgFunctionSymbol* next_function();
Complexity O(n)
next_label
SgLabelSymbol* next_label();
Complexity O(n)
next_namespace
SgNamespaceSymbol* next_namespace();
Complexity O(n)
next_typedef
SgTypedefSymbol* next_typedef();
Complexity O(n)
next_variable
SgVariableSymbol* next_variable();
Complexity O(n)
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
print
void print();
Outputs symbol table information (useful for debugging)
processDataMemberReferenceToPointers
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler*) override; [virtual]
Pass references to stored node pointers to a handler.
reindex_symbol_basis
void reindex_symbol_basis( SgSymbol* symbol, SgNode const* prior_basis);
remove
void remove(SgSymbol const* symbol);
remove_function_type
void remove_function_type(SgName const& name);
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
setCaseInsensitive
void setCaseInsensitive(bool b);
set_name
void set_name(SgName name);
set_no_name
void set_no_name(bool no_name);
set_symbolSet
void set_symbolSet(SgNodeSet symbolSet);
set_table
void set_table(rose_hash_multimap* table);
size
int size() const;
stored_name_of
SgName stored_name_of(SgSymbol const* symbol) const;
validate_exact_symbol_indexes
void validate_exact_symbol_indexes() const;
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
find_symbol_with_type_support
template<class ReturnType> ReturnType* find_symbol_with_type_support( SgName const& nm, SgType const* type, SgTemplateParameterPtrList* templateParameters, SgTemplateArgumentPtrList* templateArgumentList, bool filterTemplateSymbols, SgUnorderedNodeSet const* visibleAliasCausalNodes = NULL, bool searchBaseClasses = false);

Protected Data Members

Name
p_iterator
p_name
p_no_name
p_symbolSet
p_table

Private Data Members

Name
p_symbolBasisExactIndex
p_symbolStoredNameMap

Friends

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

Created with MrDocs