ROSE  0.11.145.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Sg_File_Info Class Reference

Description

This class represents the location of the code associated with the IR node in the original source code.

This object is used to represent the starting and the ending position of the source code associated with some IR nodes (in other cases the endOfConstruct returnes the same data as the startOfConstruct).

Classification of the IR nodes is included in this object and applies to:
- SgStatements
- SgExpression
- SgInitializedName
- SgFile (and maybe SgDirectory)
- Perhaps also SgTemplateArguments, SgTemplateParameters, SgBaseClass

classifications are:

Note that p_filename is correctly initialized in the Sg_File_Info object for a SgGlobal, but the p_line and p_col are set to 0 (zero). All other IR nodes have valid Sg_File_Info objects with correct p_filename and p_line and p_col set to nonzero values. A few IR nodes in the AST will have a default value of their Sg_File_Info nodes with p_filename set to "NULL_FILE" and p_line and p_col set to 0 (zero). These are increasingly rare to find in the AST, but since some IR nodes can't be associated with their source position in the AST they persist.

Definition at line 24582 of file Cxx_Grammar.h.

Inheritance diagram for Sg_File_Info:
Inheritance graph
[legend]
Collaboration diagram for Sg_File_Info:
Collaboration graph
[legend]

Public Types

enum  classifier {
  e_transformation = 0x1,
  e_compiler_generated = 0x2,
  e_output_in_code_generation = 0x4,
  e_shared = 0x8,
  e_frontend_specific = 0x10,
  e_source_position_unavailable_in_frontend = 0x20,
  e_comment_or_directive = 0x40,
  e_token = 0x80,
  e_default_argument = 0x100,
  e_implicit_cast = 0x200
}
 Enum type containing classifications if IR nodes. More...
 
enum  p_fileflags {
  COPY_FILE_ID = -1,
  NULL_FILE_ID = -2,
  TRANSFORMATION_FILE_ID = -3,
  COMPILER_GENERATED_FILE_ID = -4,
  COMPILER_GENERATED_MARKED_FOR_OUTPUT_FILE_ID = -5,
  BAD_FILE_ID = -6
}
 Enum to hold previously common default values for filename used by the default and static SgNULL_File constructors. More...
 
enum  { static_variant = V_Sg_File_Info }
 static variant value
 
typedef SgSupport base_node_type
 
- Public Types inherited from SgSupport
enum  { static_variant = V_SgSupport }
 static variant value
 
typedef SgNode base_node_type
 
- Public Types inherited from SgNode
enum  { static_variant = V_SgNode }
 static variant value
 

Public Member Functions

virtual SgNodecopy (SgCopyHelp &help) const override
 This function clones the current IR node object recursively or not, depending on the argument. More...
 
 Sg_File_Info ()
 This is the less useful default constructor. More...
 
 Sg_File_Info (const std::string &filename, int line=0, int col=0)
 
 Sg_File_Info (const Sg_File_Info &X)
 This the copy constructor (deep copy made).
 
 Sg_File_Info (int file_id, int line, int column)
 
void post_construction_initialization () override
 Final initialization for constructors This function is called at the end of generated constructors to allow the specification writer to add special initialization functions or tests. Default is to do nothing. Otherwise it should be overridden in the spec file, in NewHeaderCode/NewOutlinedCode.
 
void check_file_id (const char *label, bool assertion=true) const
 
void set_filename (const char *filename) ROSE_DEPRECATED_FUNCTION
 This function sets the filename of the construct's association with source code.
 
void set_filenameString (const std::string &filename)
 
void set_line (int line)
 This function sets the line number of the construct's association with source code in the source file named by p_filename. More...
 
void set_col (int n)
 
void display (const std::string label) const
 
void display () const
 
std::string displayString (const std::string &label="") const
 
const char * get_filename () const ROSE_DEPRECATED_FUNCTION
 Returns filename of source code associated with IR node. More...
 
const std::string & get_filenameString () const
 
int get_line () const
 Returns the line number of the associated code for this IR node. More...
 
int get_col () const
 Returns the column number of the associated code for this IR node. More...
 
int get_line (int file_id) const
 Where this is a shared IR node across multiple files, return the line number location of the IR node for a specific file.
 
void set_file_id (int file_id)
 
int get_file_id () const
 
std::string get_raw_filename () const
 Returns filename of source code associated with IR node. More...
 
int get_raw_line () const
 Returns the line number of the associated code for this IR node. More...
 
int get_raw_col () const
 Returns the column number of the associated code for this IR node. More...
 
void set_physical_filename (const std::string &filename)
 
std::string get_physical_filename () const
 
void set_physical_file_id (int physical_file_id)
 
int get_physical_file_id () const
 
void set_physical_line (int line)
 
int get_physical_line () const
 
void set_physical_source_position_to_match_logical_source_position ()
 
int * get_physical_file_id_reference ()
 
int get_physical_line (int file_id) const
 Where this is a shared IR node across multiple files, return the line number location of the IR node for a specific file.
 
int get_physical_file_id (int file_id) const
 
void set_source_sequence_number (unsigned int n)
 
unsigned int get_source_sequence_number () const
 
void updateSourcePosition (Sg_File_Info *update)
 
bool hasPositionInSource () const
 No earthly idea what this function does! More...
 
bool isSameFile (SgFile *file) const
 
bool isSameFile (Sg_File_Info *fileInfo) const
 
bool isSameFile (const Sg_File_Info &fileInfo) const
 
bool isTransformation () const
 Access function for classification bit field. More...
 
bool isCompilerGenerated () const
 Returns true only if compiler generated (either by the front-end or by ROSE).
 
bool isCompilerGeneratedNodeToBeUnparsed () const ROSE_DEPRECATED_FUNCTION
 Returns true only if compiler generated and required to be unparsed in generated code.
 
bool isOutputInCodeGeneration () const
 Returns true only if required to be unparsed in generated code.
 
bool isShared () const
 Returns true only if shared internally (either by the front-end or by ROSE).
 
bool isFrontendSpecific () const
 
bool isSourcePositionUnavailableInFrontend () const
 
void unsetSourcePositionUnavailableInFrontend ()
 
void setSourcePositionUnavailableInFrontend ()
 
bool isCommentOrDirective () const
 
void unsetCommentOrDirective ()
 
void setCommentOrDirective ()
 
bool isToken () const
 
void unsetToken ()
 
void setToken ()
 
bool isDefaultArgument () const
 
void unsetDefaultArgument ()
 
void setDefaultArgument ()
 
bool isImplicitCast () const
 
void unsetImplicitCast ()
 
void setImplicitCast ()
 
void unsetTransformation ()
 Set/unset functions for classification bit field. More...
 
void setTransformation ()
 Marks an IR node to be a transformation if it is not one already. More...
 
void unsetCompilerGeneratedNodeToBeUnparsed () ROSE_DEPRECATED_FUNCTION
 Mark as compiler generated but as required to be output by unparser (e.g. required template instatiations) More...
 
void setCompilerGeneratedNodeToBeUnparsed () ROSE_DEPRECATED_FUNCTION
 Marks IR node as compiler generated but required in the generated source (e.g. requied templates). More...
 
void unsetOutputInCodeGeneration ()
 Mark as to be output by the unparser (code generator) More...
 
void setOutputInCodeGeneration ()
 Marks IR node as compiler generated but required in the generated source (e.g. requied templates). More...
 
void unsetShared ()
 Support for shared IR nodes (shared via AST merge mechanism) More...
 
void setShared ()
 Marks IR node as shared. More...
 
void unsetFrontendSpecific ()
 
void setFrontendSpecific ()
 
void addFileToUnparse (int file_id)
 Add files to the set that should be able to unparse the node.
 
bool shouldUnparse (int file_id)
 Should this node be unparsed by this file?
 
void unsetCompilerGenerated ()
 Unmarks IR node as compiler generated. More...
 
void setCompilerGenerated ()
 Marks IR node as compiler generated. More...
 
unsigned int get_classificationBitField (void) const
 Get whole bit field fr modifier set.
 
void set_classificationBitField (unsigned int)
 
void set_isPartOfTransformation (bool isPartOfTransformation) ROSE_DEPRECATED_FUNCTION
 This function marks an IR nodes as being part of a transformation, this function is deprecated. More...
 
bool get_isPartOfTransformation () ROSE_DEPRECATED_FUNCTION
 This function indicates of the IR nodes is part of a transformation. More...
 
void register_node (SgLocatedNode *node) ROSE_DEPRECATED_FUNCTION
 
void deregister_node (SgLocatedNode *node) ROSE_DEPRECATED_FUNCTION
 
bool ok () const
 Checks internal consistancy of data. More...
 
Sg_File_Infooperator= (const Sg_File_Info &X)
 
virtual std::string class_name () const override
 returns a string representing the class name
 
virtual VariantT variantT () const override
 returns new style SageIII enum values
 
void * operator new (size_t size)
 returns pointer to newly allocated IR node
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse)
 
void operator delete (void *pointer)
 
virtual std::vector< SgNode * > get_traversalSuccessorContainer () override
 container of pointers to AST successor nodes used in the traversal overridden in every class by generated implementation
 
virtual std::vector< std::string > get_traversalSuccessorNamesContainer () override
 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
 
virtual size_t get_numberOfTraversalSuccessors () override
 return number of children in the traversal successor list
 
virtual SgNodeget_traversalSuccessorByIndex (size_t idx) override
 index-based access to traversal successors by index number
 
virtual size_t get_childIndex (SgNode *child) override
 index-based access to traversal successors by child node
 
virtual RTIReturnType roseRTI () override
 return C++ Runtime-Time-Information
 
virtual const char * sage_class_name () const override ROSE_DEPRECATED_FUNCTION
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
virtual void accept (ROSE_VisitorPattern &visitor) override
 support for the classic visitor pattern done in GoF
 
virtual bool isInMemoryPool () override
 FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap. More...
 
virtual void checkDataMemberPointersIfInMemoryPool () override
 FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap. More...
 
virtual std::vector< std::pair< SgNode *, std::string > > returnDataMemberPointers () const override
 FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools More...
 
virtual void processDataMemberReferenceToPointers (ReferenceToPointerHandler *) override
 FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools More...
 
virtual long getChildIndex (SgNode *childNode) const override
 FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR node. More...
 
 Sg_File_Info (const Sg_File_InfoStorageClass &source)
 IR node constructor to support AST File I/O.
 
Sg_File_InfoaddRegExpAttribute (std::string s, AstRegExAttribute *a)
 Support for AST matching using regular expression. More...
 
const SgFileIdList & get_fileIDsToUnparse () const
 
SgFileIdList & get_fileIDsToUnparse ()
 
const SgFileLineNumberList & get_fileLineNumbersToUnparse () const
 
SgFileLineNumberList & get_fileLineNumbersToUnparse ()
 
virtual ~Sg_File_Info ()
 This is the destructor. More...
 
- Public Member Functions inherited from SgSupport
void * operator new (size_t size)
 returns pointer to newly allocated IR node
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse)
 
void operator delete (void *pointer)
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
 SgSupport (const SgSupportStorageClass &source)
 IR node constructor to support AST File I/O.
 
SgSupportaddRegExpAttribute (std::string s, AstRegExAttribute *a)
 Support for AST matching using regular expression. More...
 
virtual ~SgSupport ()
 This is the destructor. More...
 
 SgSupport ()
 This is the constructor. More...
 
- Public Member Functions inherited from SgNode
void * operator new (size_t size)
 returns pointer to newly allocated IR node
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse)
 
void operator delete (void *pointer)
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
 SgNode (const SgNodeStorageClass &source)
 IR node constructor to support AST File I/O.
 
SgNodeaddRegExpAttribute (std::string s, AstRegExAttribute *a)
 Support for AST matching using regular expression. More...
 
void set_isModified (bool isModified)
 All nodes in the AST contain a isModified flag used to track changes to the AST. More...
 
void set_containsTransformation (bool containsTransformation)
 Many nodes can hide other AST nodes and we need to track when outer nodes contain modified nodes even if they are not themselves modified. More...
 
bool get_isModified () const
 Acess function for isModified flag. More...
 
bool get_containsTransformation () const
 Acess function for containsTransformation flag. More...
 
void set_parent (SgNode *parent)
 All nodes in the AST contain a reference to a parent node. More...
 
SgNodeget_parent () const
 Access function for parent node. More...
 
SgNodeget_raw_parent () const
 Access function for direct access to uncomputed value of parent node.
 
bool isChild (SgNode *node) const
 Query function for if the input IR nodes is a child of the current IR node.
 
virtual std::string unparseToString (SgUnparse_Info *info) const
 This function unparses the AST node (excluding comments and unnecessary white space)
 
std::string unparseToString () const
 
std::string unparseToCompleteString ()
 This function unparses the AST node (including comments and white space) More...
 
int variant () const ROSE_DEPRECATED_FUNCTION
 Older version function returns enum value "NODE". More...
 
virtual void addNewAttribute (std::string s, AstAttribute *a)
 Add a new attribute represented by the named string.
 
virtual AstAttributegetAttribute (std::string s) const
 Returns attribute of name 's'.
 
virtual void updateAttribute (std::string s, AstAttribute *a)
 Replace existing attribute of name 's' with new AstAttribute.
 
virtual void setAttribute (std::string s, AstAttribute *a)
 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.
 
virtual void removeAttribute (std::string s)
 Remove attribute of name 's' if present.
 
virtual bool attributeExists (std::string s) const
 Tests if attribute of name 's' is present.
 
virtual int numberOfAttributes () const
 Returns the number of attributes on this IR node.
 
virtual AstAttributeMechanismget_attributeMechanism () const
 FOR INTERNAL USE Access function; if an attribute exists then a pointer to it is returned, else error. More...
 
virtual void set_attributeMechanism (AstAttributeMechanism *a)
 FOR INTERNAL USE Access function; sets poiner to value AstAttributeMechanism. More...
 
virtual void fixupCopy (SgNode *copy, SgCopyHelp &help) const
 
virtual Sg_File_Infoget_file_info (void) const
 File information containing filename, line number, column number, and if the SgNode is a part of a new transformation, etc.
 
virtual Sg_File_Infoget_startOfConstruct (void) const
 New function interface for Sg_File_Info data stores starting location of contruct (typically the opening brace or first letter of keyword).
 
virtual Sg_File_Infoget_endOfConstruct (void) const
 New function interface for Sg_File_Info data stores ending location of contruct (typically the closing brace).
 
VirtualCFG::CFGNode cfgForBeginning ()
 Returns the CFG node for just before this AST node.
 
VirtualCFG::CFGNode cfgForEnd ()
 Returns the CFG node for just after this AST node.
 
virtual unsigned int cfgIndexForEnd () const
 Determine the CFG index for the end of this construct.
 
virtual bool cfgIsIndexInteresting (unsigned int index) const
 Determine whether a particular CFG node index is "interesting" for this kind of node.
 
virtual unsigned int cfgFindChildIndex (SgNode *n)
 Find the index of n in this node's CFG children.
 
virtual unsigned int cfgFindNextChildIndex (SgNode *n)
 Find the index just after n in this node's CFG children.
 
virtual std::vector< VirtualCFG::CFGEdgecfgOutEdges (unsigned int index=false)
 Find the out edges of a CFG node – internal version.
 
virtual std::vector< VirtualCFG::CFGEdgecfgInEdges (unsigned int index=false)
 Find the in edges of a CFG node – internal version.
 
int numberOfNodesInSubtree ()
 Computes the number of nodes in the defined subtree of the AST. More...
 
int depthOfSubtree ()
 Computes the depth of the current defined subtree of the AST. More...
 
template<class T >
T * initParentPointer (T *child, SgNode *parent)
 Generated for tree edge data member initializations. More...
 
SgNodeget_freepointer () const
 
void set_freepointer (SgNode *freepointer)
 
virtual ~SgNode ()
 This is the destructor. More...
 
 SgNode ()
 This is the constructor. More...
 
bool get_isVisited () const ROSE_DEPRECATED_FUNCTION
 DOCS IN HEADER: Access function for p_isVisited flag used previously by the AST traversals. More...
 
void set_isVisited (bool isVisited) ROSE_DEPRECATED_FUNCTION
 Access function for p_isVisited flag used previously by the AST traversals. More...
 
template<class T >
std::enable_if< std::is_pointer< T >::value, void >::type changeChildPointer (T &edge, T const &child)
 Set a child edge in a tree to point to a specific child. More...
 
template<class T >
std::enable_if< !std::is_pointer< T >::value, void >::type changeChildPointer (T &edge, T const &child)
 Set a child edge in a tree to point to a specific child. More...
 

Static Public Member Functions

static int addFilenameToMap (const std::string &filename)
 Access function to permit files referenced in Dwarf to be mapped to integers using the same scheme as for source code.
 
static int numberOfSourceFiles ()
 Returns the number of entries in the filename map.
 
static void display_static_data (const std::string label)
 
static Sg_File_InfogenerateDefaultFileInfo ()
 Static function to return new Sg_File_Info object set to default values. More...
 
static Sg_File_InfogenerateDefaultFileInfoForTransformationNode ()
 Static function to return new Sg_File_Info object set to default values appropriate for transformations. More...
 
static Sg_File_InfogenerateFileInfoForTransformationNode (int file_id)
 Static function to return new Sg_File_Info object set to default values appropriate for transformations that are not in the source file. More...
 
static Sg_File_InfogenerateFileInfoForTransformationNode (std::string filename)
 
static Sg_File_InfogenerateDefaultFileInfoForCompilerGeneratedNode ()
 Static function to return new Sg_File_Info object set to default values appropriate for compiler generated code. More...
 
static const std::string & getFilenameFromID (int id)
 
static int getIDFromFilename (std::string filename)
 
static std::map< int, std::string > & get_fileidtoname_map ()
 Access function for static datamember fileidtoname_map.
 
static void set_fileidtoname_map (std::map< int, std::string > &X)
 Access function for map of file names.
 
static std::map< std::string, int > & get_nametofileid_map ()
 Access function for static datamember nametofileid_map.
 
static void set_nametofileid_map (std::map< std::string, int > &X)
 Access function for map of file names.
 
static void deleteMemoryPool ()
 
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type.
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type.
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal.
 
static SgNodegetNodeByNodeId (VariantT variantT, size_t poolIdx, size_t itemIdx)
 Find a node by its variant type, pool index, and item index.
 
static Sg_File_InfogetNodeByNodeIdInternal (size_t poolIdx, size_t itemIdx)
 FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
 
static std::string getNodeIdString (Sg_File_Info *sgnode)
 compute the NodeId for a particular SgNode*.
 
static std::string getNodeIdStringInternal (Sg_File_Info *sgnode)
 
- Static Public Member Functions inherited from SgSupport
static void deleteMemoryPool ()
 
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type.
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type.
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal.
 
static SgNodegetNodeByNodeId (VariantT variantT, size_t poolIdx, size_t itemIdx)
 Find a node by its variant type, pool index, and item index.
 
static SgSupportgetNodeByNodeIdInternal (size_t poolIdx, size_t itemIdx)
 FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
 
static std::string getNodeIdString (SgSupport *sgnode)
 compute the NodeId for a particular SgNode*.
 
static std::string getNodeIdStringInternal (SgSupport *sgnode)
 
- Static Public Member Functions inherited from SgNode
static void deleteMemoryPool ()
 
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type.
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type.
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal.
 
static SgNodegetNodeByNodeId (VariantT variantT, size_t poolIdx, size_t itemIdx)
 Find a node by its variant type, pool index, and item index.
 
static SgNodegetNodeByNodeIdInternal (size_t poolIdx, size_t itemIdx)
 FOR INTERNAL USE Find an SgNode from its memory pool and location therin.
 
static std::string getNodeIdString (SgNode *sgnode)
 compute the NodeId for a particular SgNode*.
 
static std::string getNodeIdStringInternal (SgNode *sgnode)
 
static std::vector< std::string > buildCommandLineToSubstituteTransformationFile (const std::vector< std::string > &argv, std::string newFileName)
 Command line support for this compilation The command line is saved as a static variable so that it will be available to support the rewrite mechanism. More...
 
static std::vector< VariantT > getClassHierarchySubTreeFunction (VariantT v)
 
static void getClassHierarchySubTreeFunction (VariantT v, std::vector< VariantT > &)
 
static std::map< SgNode *, std::string > & get_globalMangledNameMap ()
 Access function for performance optimizing global mangled name map. More...
 
static void clearGlobalMangledNameMap ()
 Support to clear the performance optimizing global mangled name map.
 
static std::map< std::string, int > & get_shortMangledNameCache ()
 Access function for lower level optimizing of global mangled name map. More...
 
static std::map< SgNode *, std::string > & get_globalQualifiedNameMapForNames ()
 Access function for name qualification support (for names). More...
 
static void set_globalQualifiedNameMapForNames (const std::map< SgNode *, std::string > &X)
 Access function for name qualification support (for names). More...
 
static std::map< SgNode *, std::string > & get_globalQualifiedNameMapForTypes ()
 Access function for name qualification support (for type). More...
 
static void set_globalQualifiedNameMapForTypes (const std::map< SgNode *, std::string > &X)
 Access function for name qualification support (for type). More...
 
static std::map< SgNode *, std::map< SgNode *, std::string > > & get_globalQualifiedNameMapForMapsOfTypes ()
 Access function for name qualification support (for maps of types). More...
 
static void set_globalQualifiedNameMapForMapsOfTypes (const std::map< SgNode *, std::map< SgNode *, std::string > > &X)
 Access function for name qualification support (for maps of types). More...
 
static std::map< SgNode *, std::string > & get_globalQualifiedNameMapForTemplateHeaders ()
 Access function for name qualification support (for template headers in template declarations). More...
 
static void set_globalQualifiedNameMapForTemplateHeaders (const std::map< SgNode *, std::string > &X)
 Access function for name qualification support (for template headers in template declarations). More...
 
static std::map< SgNode *, std::string > & get_globalTypeNameMap ()
 Access function for name qualification support (for names of types). More...
 
static void set_globalTypeNameMap (const std::map< SgNode *, std::string > &X)
 Access function for name qualification support (for names of types). More...
 
static SgFunctionTypeTableget_globalFunctionTypeTable ()
 Access function for symbol table specific to function types.
 
static void set_globalFunctionTypeTable (SgFunctionTypeTable *globalFunctionTypeTable)
 Access function for symbol table specific to function types.
 
static SgTypeTableget_globalTypeTable ()
 Access function for symbol table specific to non-function types.
 
static void set_globalTypeTable (SgTypeTable *globalTypeTable)
 Access function for symbol table specific to non-function types.
 
static VariantT variantFromPool (SgNode const *n)
 
template<class T >
static std::enable_if< std::is_base_of< SgNode, T >::value, T * >::type createAndParent (SgNode *parent)
 Allocate and return a new node after setting its parent. More...
 

Protected Attributes

int p_file_id
 This is a key that maps integers to file names, it prevents redundent storage of filename strings. More...
 
int p_line
 This is the line number of the location of the source code for this IR node. More...
 
int p_col
 This is the column number of the location of the source code for this IR node. More...
 
unsigned int p_classificationBitField
 This is mechanism for classification of the IR node. More...
 
int p_physical_file_id
 
int p_physical_line
 
unsigned int p_source_sequence_number
 
SgFileIdList p_fileIDsToUnparse
 This set contains a list of all file ids for which the accompanying IR node should be unparsed. More...
 
SgFileLineNumberList p_fileLineNumbersToUnparse
 
- Protected Attributes inherited from SgNode
SgNodep_parent
 This is the pointer to the parent IR node in the AST. More...
 
bool p_isModified
 Records if IR node has been modified (data members reset). More...
 
bool p_containsTransformation
 
SgNodep_freepointer
 This is the pointer to the chain of previously freed objects.
 

Static Protected Attributes

static std::map< int, std::string > p_fileidtoname_map
 This is a static STL map of file id (integers) to file names (strings).
 
static std::map< std::string, int > p_nametofileid_map
 This is a static STL map of file names (strings) to file id (integers).
 
- Static Protected Attributes inherited from SgNode
static std::vector< std::tuple< unsigned char *, unsigned, VariantT > > all_pools
 
static SgFunctionTypeTablep_globalFunctionTypeTable
 Pointer to symbol table specific to function types.
 
static SgTypeTablep_globalTypeTable
 
static std::map< SgNode *, std::string > p_globalMangledNameMap
 Cache of mangled names to avoid regeneration of previously build mangled names or parts of mangled names. This is a performance optimization.
 
static std::map< std::string, int > p_shortMangledNameCache
 STL map used as a cache to shorten generated mangled names. This is mostly a space optimization ofr mangled names of templates.
 
static std::map< SgNode *, std::string > p_globalQualifiedNameMapForNames
 
static std::map< SgNode *, std::string > p_globalQualifiedNameMapForTypes
 
static std::map< SgNode *, std::string > p_globalQualifiedNameMapForTemplateHeaders
 
static std::map< SgNode *, std::string > p_globalTypeNameMap
 
static std::map< SgNode *, std::map< SgNode *, std::string > > p_globalQualifiedNameMapForMapsOfTypes
 

Friends

bool operator== (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for equal position information. More...
 
bool operator!= (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for unequal position information. More...
 
bool operator> (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for X being after Y in the same file. More...
 
bool operator< (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for X being before Y in the same file. More...
 
bool operator>= (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for X being at the same position or after Y in the same file. More...
 
bool operator<= (const Sg_File_Info &X, const Sg_File_Info &Y)
 This relational operator tests two Sg_File_Info objects for X being at the same position or before Y in the same file. More...
 
ROSE_DLL_API friend Sg_File_InfoisSg_File_Info (SgNode *s)
 Casts pointer from base class to derived class. More...
 
ROSE_DLL_API friend const Sg_File_InfoisSg_File_Info (const SgNode *s)
 Casts pointer from base class to derived class (for const pointers) More...
 

Additional Inherited Members

- Protected Member Functions inherited from SgNode
virtual void destructorHelper ()
 This gets called by all Rosebud-generated destructors. More...
 
virtual void debugSerializationBegin (const char *className)
 Called by generated serializers. More...
 
virtual void debugSerializationEnd (const char *className)
 Called by generated serializers. More...
 

Member Enumeration Documentation

Enum type containing classifications if IR nodes.

This is part of the classification mechanism for IR nodes within ROSE. Compiler generated code is not output in the code generation phase, but some compiler generated IR nodes must be output so such nodes are explicitly marked within the classification process (implemented in ASTFixes.C).

  • Examples of transformation IR nodes include:
    1. Any relocated AST subtrees
    2. Any new IR nodes
  • Examples of compiler-generated IR nodes include:
    1. Any implicit or unnecessary casts not explicitly represented in the source code
    2. Instantiated templates
  • Examples of compiler-generated code marked for output (in code generation phase) include:
    1. Any transformed template instantiations
    2. required templates assigned to specific files (see ROSE prelinking details)
  • Examples of shared IR nodes include:
    1. All types (not implemented yet)
    2. All IR nodes shared across originally separate ASTs (see AST Merge Mechanism)
  • Examples of frontend specific IR nodes include:
    1. float __builtin_acosf (float __builtin__x);
    2. #define __builtin_va_start va_start
    3. All functions and variables defined in "rose_edg_required_macros_and_functions.h"
Enumerator
e_transformation 

classify as a transformation

e_compiler_generated 

classify as compiler generated

e_output_in_code_generation 

classify as required when generating code in unparser (orthogonal concept to transformation and compiler generated)

e_shared 

classify as a shared IR node (part of evolving support for AST merging)

e_frontend_specific 

classify as frontend specific (e.g. gnu compatable function from rose_edg_required_macros_and_functions.h)

e_source_position_unavailable_in_frontend 

classify as explictly unabailable from front-end

e_comment_or_directive 

classify as a comment or directive (not a part of the language grammar)

e_token 

classify as a token from the parser (not a part of the language grammar)

e_default_argument 

classify as a default arguement to function call expression

e_implicit_cast 

classify as a implicit cast

Definition at line 24619 of file Cxx_Grammar.h.

Enum to hold previously common default values for filename used by the default and static SgNULL_File constructors.

Enumerator
COPY_FILE_ID 

default value (equivalent to filename with "COPY")

NULL_FILE_ID 

value equivalent to filename with "NULL_FILE"

TRANSFORMATION_FILE_ID 

value for all nodes marked as part of a translation

COMPILER_GENERATED_FILE_ID 

value for compiler generated IR nodes (NOT marked for output)

COMPILER_GENERATED_MARKED_FOR_OUTPUT_FILE_ID 

value for compiler generated IR nodes (marked for output, deprecated value)

BAD_FILE_ID 

value returned if there is no file id mapped to given filename

Definition at line 24889 of file Cxx_Grammar.h.

Constructor & Destructor Documentation

Sg_File_Info::Sg_File_Info ( )

This is the less useful default constructor.

This constructor builds the Sg_File_Info base class.

Sg_File_Info::~Sg_File_Info ( )
virtual

This is the destructor.

There is nothing to delete in this object.

Member Function Documentation

virtual SgNode* Sg_File_Info::copy ( SgCopyHelp help) const
overridevirtual

This function clones the current IR node object recursively or not, depending on the argument.

This function performs a copy based on the specification of the input parameter. The input parameter is used to determin which data members are copied by reference and which are copied by value.

Parameters
help- If this argument is of type SgTreeCopy, then the IR node is cloned recursively. If its of type SgShallowCopy only the first level of the IR node is copied, everything else is left pointing to the the original IR node's object's data members.
Returns
a pointer to the new clone.

Reimplemented from SgSupport.

Sg_File_Info::set_line ( int  line)

This function sets the line number of the construct's association with source code in the source file named by p_filename.

Returns
Returns an integer.
Sg_File_Info::get_filename ( ) const

Returns filename of source code associated with IR node.

The filename returned is manipulated under some contitions:

Sg_File_Info::get_line ( ) const

Returns the line number of the associated code for this IR node.

Returns
Returns integer.
Sg_File_Info::get_col ( ) const

Returns the column number of the associated code for this IR node.

Returns
Returns integer
Sg_File_Info::get_raw_filename ( ) const

Returns filename of source code associated with IR node.

The filename is not manipulated! The value of p_filename is returned whatever the IR node classification.

Sg_File_Info::get_raw_line ( ) const

Returns the line number of the associated code for this IR node.

Returns
Returns integer.
Sg_File_Info::get_raw_col ( ) const

Returns the column number of the associated code for this IR node.

Returns
Returns
Sg_File_Info::hasPositionInSource ( ) const

No earthly idea what this function does!

Abstracts query as to if an IR node maps back to the source code (evolving set of reasons whey this can be false).

Returns
Returns bool.

There are several reasons why an IR node might NOT have a mapping back to the source code:

Sg_File_Info::isTransformation ( ) const

Access function for classification bit field.

Returns true only if part of a transformation.

Returns
Returns bool.
Sg_File_Info::unsetTransformation ( )

Set/unset functions for classification bit field.

If the IR node is a transformation it marks it false (zeros transformation marker bit internally).

Returns
Returns void.
Sg_File_Info::setTransformation ( )

Marks an IR node to be a transformation if it is not one already.

Returns
Returns void.
Sg_File_Info::unsetCompilerGeneratedNodeToBeUnparsed ( )

Mark as compiler generated but as required to be output by unparser (e.g. required template instatiations)

Unmarks IR node as compiler generated but required in the generated source (e.g. requied templates).

Returns
Returns void.
Sg_File_Info::setCompilerGeneratedNodeToBeUnparsed ( )

Marks IR node as compiler generated but required in the generated source (e.g. requied templates).

Returns
Returns void.
Sg_File_Info::unsetOutputInCodeGeneration ( )

Mark as to be output by the unparser (code generator)

Unmarks IR node as compiler generated but required in the generated source (e.g. requied templates).

Returns
Returns void.
Sg_File_Info::setOutputInCodeGeneration ( )

Marks IR node as compiler generated but required in the generated source (e.g. requied templates).

Returns
Returns void.
Sg_File_Info::unsetShared ( )

Support for shared IR nodes (shared via AST merge mechanism)

Unmarks IR node as shared.

Returns
Returns void.
Sg_File_Info::setShared ( )

Marks IR node as shared.

Returns
Returns void.
Sg_File_Info::unsetCompilerGenerated ( )

Unmarks IR node as compiler generated.

Returns
Returns void.
Sg_File_Info::setCompilerGenerated ( )

Marks IR node as compiler generated.

Returns
Returns void.
Sg_File_Info::generateDefaultFileInfo ( )
static

Static function to return new Sg_File_Info object set to default values.

Returns
Returns pointer to Sg_File_Info.
Sg_File_Info::generateDefaultFileInfoForTransformationNode ( )
static

Static function to return new Sg_File_Info object set to default values appropriate for transformations.

This function calls setOutputInCodeGeneration() and sets the file_id to be TRANSFORMATION_FILE_ID.

Returns
Returns pointer to Sg_File_Info.
Sg_File_Info::generateFileInfoForTransformationNode ( int  file_id)
static

Static function to return new Sg_File_Info object set to default values appropriate for transformations that are not in the source file.

Static function which allows specification of transformation with assignement to a specific file (where it would be unparsed). This function will call setOutputInCodeGeneration() and sets the file_id to a non-negative value. This function is useful when transformation to a program happen within a header file (e.g. including a header file as part of a transformation).

Setting the file_id to the current source file should have the same result (semantics) as Sg_File_Info::generateDefaultFileInfoForTransformationNode().

Returns
Returns pointer to Sg_File_Info.
Sg_File_Info::generateDefaultFileInfoForCompilerGeneratedNode ( )
static

Static function to return new Sg_File_Info object set to default values appropriate for compiler generated code.

Returns
Returns pointer to Sg_File_Info.
Sg_File_Info::set_isPartOfTransformation ( bool  isPartOfTransformation)

This function marks an IR nodes as being part of a transformation, this function is deprecated.

Returns
Returns void.
Sg_File_Info::get_isPartOfTransformation ( )

This function indicates of the IR nodes is part of a transformation.

Returns
Returns bool
bool Sg_File_Info::ok ( ) const

Checks internal consistancy of data.

This function verifies:

  1. filename pointer is valid
  2. if not compiler generaated then line number > 0

Defined to be used in tests: ROSE_ASSERT(statement->get_file_info()->ok());

Returns
Returns bool.
virtual const char* Sg_File_Info::sage_class_name ( ) const
overridevirtual

returns a C style string (char*) representing the class name

Reimplemented from SgSupport.

virtual bool Sg_File_Info::isInMemoryPool ( )
overridevirtual

FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap.

The AST File I/O depends upon the allocation of IR nodes being from the heap, stack based or global IR nodes should not appear in the AST if it will be written out to a file and read back in. To enforce this concept, this function implements a test to verify that the IR node can be found on the heap and is part of a larger test of the whole AST. This test must pass before the AST can be written out to a file. This is part of a compromise in the design of the AST File I/O to support binary streaming of data to files; for performance. It is also rather difficult, but possible, to build a useful AST with IR nodes allocated on the stack or frm global scope, this test filters out such cased from being used with the AST File I/O mechanism.

Reimplemented from SgSupport.

virtual void Sg_File_Info::checkDataMemberPointersIfInMemoryPool ( )
overridevirtual

FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap.

The AST File I/O depends upon the allocation of IR nodes being from the heap, stack based or global IR nodes should not appear in the AST if it will be written out to a file and read back in. To enforce this concept, this function implements a test to verify that the IR node can be found on the heap and is part of a larger test of the whole AST. This test must pass before the AST can be written out to a file. This is part of a compromise in the design of the AST File I/O to support binary streaming of data to files; for performance. It is also rather difficult, but possible, to build a useful AST with IR nodes allocated on the stack or frm global scope, this test filters out such cased from being used with the AST File I/O mechanism.

Reimplemented from SgSupport.

virtual std::vector<std::pair<SgNode*,std::string> > Sg_File_Info::returnDataMemberPointers ( ) const
overridevirtual

FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools

This functions is part of general support for many possible tools to operate on the AST. The forms a list of ALL IR node pointers used by each IR node, and is a supperset of the get_traversalSuccessorContainer(). It is (I think) less than the set of pointers used by the AST file I/O. This is part of work implemented by Andreas, and support tools such as the AST graph generation.

Warning
This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change.
Returns
STL vector of pairs of SgNode* and strings

Reimplemented from SgSupport.

virtual void Sg_File_Info::processDataMemberReferenceToPointers ( ReferenceToPointerHandler *  )
overridevirtual

FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools

This functions similar to returnDataMemberPointers() except that it passes references to a handler object. As a result there is FAR more damage that can be done by using this function, but it is type-safe. This is provided for support of internal tools that operate on the AST, e.g the AST Merge mechanism.

Warning
This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change.

Reimplemented from SgSupport.

virtual long Sg_File_Info::getChildIndex ( SgNode childNode) const
overridevirtual

FOR INTERNAL USE Returns a unique index value for the childNode in the list of children at this IR node.

This function returns a unique value for the input childNode in set of children at this IR node. Note that a negative value indicates that the input node is not a child. This is the basis for the implementation of the isChild(SgNode*) member function. Data members that are NULL in the IR node are counted internally (so that this function returns value that could be statically defined, and so are not dynamically determined).

Warning
The mapping on children to integer values could change from release to release of ROSE.
Returns
long

Reimplemented from SgSupport.

Sg_File_Info* Sg_File_Info::addRegExpAttribute ( std::string  s,
AstRegExAttribute a 
)

Support for AST matching using regular expression.

This support is incomplete and the subject of current research to define RegEx trees to support inexact matching.

Friends And Related Function Documentation

bool Sg_File_Info::operator== ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for equal position information.

Returns
Returns bool.
bool Sg_File_Info::operator!= ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for unequal position information.

Returns
Returns bool.
Sg_File_Info::operator> ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for X being after Y in the same file.

Returns
Returns bool.
Sg_File_Info::operator< ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for X being before Y in the same file.

Returns
Returns bool.
Sg_File_Info::operator>= ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for X being at the same position or after Y in the same file.

Returns
Returns bool.
Sg_File_Info::operator<= ( const Sg_File_Info X,
const Sg_File_Info Y 
)
friend

This relational operator tests two Sg_File_Info objects for X being at the same position or before Y in the same file.

Returns
Returns bool.
Sg_File_Info::isSg_File_Info ( SgNode s)
friend

Casts pointer from base class to derived class.

Cast function (from derived class to Sg_File_Info pointer).

This functions returns a Sg_File_Info pointer for any input of a pointer to an object derived from a Sg_File_Info.

Returns
Returns valid pointer to Sg_File_Info if input is derived from a SgLocatedNode.
Sg_File_Info::isSg_File_Info ( const SgNode s)
friend

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

Cast function (from derived class to Sg_File_Info pointer).

This functions returns a Sg_File_Info pointer for any input of a pointer to an object derived from a Sg_File_Info.

Returns
Returns valid pointer to Sg_File_Info if input is derived from a SgLocatedNode.

Member Data Documentation

Sg_File_Info::p_file_id
protected

This is a key that maps integers to file names, it prevents redundent storage of filename strings.

This is part of a mechanism to reduce the memory requirements of the IR (to support whole program analysis in ROSE). The values are keys to an STL map which relates file ids to file name strings, allowing a more compressed representation of the filename data in the Sg_File_Info object. There are two maps, one for finding the filename string from a file id integer (p_fileidtoname_map), and another for the reverse map (p_nametofileid_map).

Definition at line 25342 of file Cxx_Grammar.h.

Sg_File_Info::p_line
protected

This is the line number of the location of the source code for this IR node.

This information is useful in the heuristics of attaching comments to IR nodes (SgStatement and SgExpression IR nodes).

The value of this variable is always greater than or equal to zero. In the case of isCompilerGenerated() == true or isTransformation() == true then value is INT_MAX-1. This value if define for this case so that all comments will be attached before the associated statement.

Definition at line 25346 of file Cxx_Grammar.h.

Sg_File_Info::p_col
protected

This is the column number of the location of the source code for this IR node.

This information is useful in the heuristics of attaching comments to IR nodes (SgStatement and SgExpression IR nodes).

The value of this variable is always greater than or equal to zero. If IR node is compiler generated for a transformation then value is set to INT_MAX-1.

Definition at line 25350 of file Cxx_Grammar.h.

Sg_File_Info::p_classificationBitField
protected

This is mechanism for classification of the IR node.

IR nodes use this mechanism to classify themselves as either part of a transformation or compiler generated (other enum values of Sg_File_Info::classifier are not used).

Definition at line 25354 of file Cxx_Grammar.h.

Sg_File_Info::p_fileIDsToUnparse
protected

This set contains a list of all file ids for which the accompanying IR node should be unparsed.

This is part of the AST Merge mechanism. This set contains a list of file ids. During unparsing, if we encounter a node with this Sg_File_Info object, we only want to unparse this file if the file we are currently unparsing is in this list.

Definition at line 25370 of file Cxx_Grammar.h.


The documentation for this class was generated from the following files: