ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Sg_File_Info Class Reference

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

#include <Cxx_Grammar.h>

Inheritance diagram for Sg_File_Info:
Collaboration diagram for Sg_File_Info:

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 More...
 
typedef SgSupport base_node_type
 
- Public Types inherited from SgSupport
enum  { static_variant = V_SgSupport }
 static variant value More...
 
typedef SgNode base_node_type
 
- Public Types inherited from SgNode
enum  { static_variant = V_SgNode }
 static variant value More...
 

Public Member Functions

virtual SgNodecopy (SgCopyHelp &help) const
 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). More...
 
 Sg_File_Info (int file_id, int line, int column)
 
void post_construction_initialization ()
 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. More...
 
void set_filename (const char *filename) ROSE_DEPRECATED_FUNCTION
 This function sets the filename of the construct's association with source code. More...
 
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...
 
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 ()
 
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). More...
 
bool isCompilerGeneratedNodeToBeUnparsed () const ROSE_DEPRECATED_FUNCTION
 Returns true only if compiler generated and required to be unparsed in generated code. More...
 
bool isOutputInCodeGeneration () const
 Returns true only if required to be unparsed in generated code. More...
 
bool isShared () const
 Returns true only if shared internally (either by the front-end or by ROSE). More...
 
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. More...
 
bool shouldUnparse (int file_id)
 Should this node be unparsed by this file? More...
 
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. More...
 
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
 Copies AST (whole subtree, depending on the SgCopyHelp class. More...
 
virtual VariantT variantT () const
 returns new style SageIII enum values More...
 
void * operator new (size_t size)
 returns pointer to newly allocated IR node More...
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse) More...
 
void operator delete (void *pointer)
 
virtual std::vector< SgNode * > get_traversalSuccessorContainer ()
 FOR INTERNAL USE within ROSE traverals mechanism only. More...
 
virtual std::vector< std::string > get_traversalSuccessorNamesContainer ()
 FOR INTERNAL USE within ROSE traverals mechanism only. More...
 
virtual size_t get_numberOfTraversalSuccessors ()
 
virtual SgNodeget_traversalSuccessorByIndex (size_t idx)
 
virtual size_t get_childIndex (SgNode *child)
 
virtual RTIReturnType roseRTI ()
 FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes. More...
 
virtual const char * sage_class_name () const ROSE_DEPRECATED_FUNCTION
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
virtual void accept (ROSE_VisitorPattern &visitor)
 DXN (08/09/2010): support for the classic visitor pattern done in GoF. More...
 
virtual bool isInMemoryPool ()
 FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap. More...
 
virtual void checkDataMemberPointersIfInMemoryPool ()
 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
 FOR INTERNAL USE Returns STL vector of pairs of SgNode* and strings for use in AST tools More...
 
virtual void processDataMemberReferenceToPointers (ReferenceToPointerHandler *)
 FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools More...
 
virtual long getChildIndex (SgNode *childNode) const
 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)
 
Sg_File_InfoaddRegExpAttribute (std::string s, AstRegExAttribute *a)
 Support for AST matching using regular expression. More...
 
SgFileIdList get_fileIDsToUnparse () const
 
void set_fileIDsToUnparse (SgFileIdList fileIDsToUnparse)
 
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 More...
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse) More...
 
void operator delete (void *pointer)
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
 SgSupport (const SgSupportStorageClass &source)
 
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 More...
 
void operator delete (void *pointer, size_t size)
 deallocated memory for IR node (returns memory to memory pool for reuse) More...
 
void operator delete (void *pointer)
 
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
 SgNode (const SgNodeStorageClass &source)
 
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...
 
bool get_isModified () const
 Acess function for isModified flag This flag records if the current IR node has been modified. It is set to false after and ROSE front-end processing. 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...
 
bool isChild (SgNode *node) const
 Query function for if the input IR nodes is a child of the current IR node. More...
 
virtual std::string unparseToString (SgUnparse_Info *info) const
 This function unparses the AST node (excluding comments and unnecessary white space) More...
 
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. More...
 
virtual AstAttributegetAttribute (std::string s) const
 Returns attribute of name 's'. More...
 
virtual void updateAttribute (std::string s, AstAttribute *a)
 Replace existing attribute of name 's' with new AstAttribute. More...
 
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. More...
 
virtual void removeAttribute (std::string s)
 Remove attribute of name 's' if present. More...
 
virtual bool attributeExists (std::string s) const
 Tests if attribute of name 's' is present. More...
 
virtual int numberOfAttributes () const
 Returns the number of attributes on this IR node. More...
 
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. More...
 
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). More...
 
virtual Sg_File_Infoget_endOfConstruct (void) const
 New function interface for Sg_File_Info data stores ending location of contruct (typically the closing brace). More...
 
VirtualCFG::CFGNode cfgForBeginning ()
 Returns the CFG node for just before this AST node. More...
 
VirtualCFG::CFGNode cfgForEnd ()
 Returns the CFG node for just after this AST node. More...
 
virtual unsigned int cfgIndexForEnd () const
 Determine the CFG index for the end of this construct. More...
 
virtual bool cfgIsIndexInteresting (unsigned int index) const
 Determine whether a particular CFG node index is "interesting" for this kind of node. More...
 
virtual unsigned int cfgFindChildIndex (SgNode *n)
 Find the index of n in this node's CFG children. More...
 
virtual unsigned int cfgFindNextChildIndex (SgNode *n)
 Find the index just after n in this node's CFG children. More...
 
virtual std::vector
< VirtualCFG::CFGEdge
cfgOutEdges (unsigned int index=false)
 Find the out edges of a CFG node – internal version. More...
 
virtual std::vector
< VirtualCFG::CFGEdge
cfgInEdges (unsigned int index=false)
 Find the in edges of a CFG node – internal version. More...
 
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...
 
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...
 

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. More...
 
static int numberOfSourceFiles ()
 Returns the number of entries in the filename map. More...
 
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. More...
 
static void set_fileidtoname_map (std::map< int, std::string > &X)
 Access function for map of file names. More...
 
static std::map< std::string,
int > & 
get_nametofileid_map ()
 Access function for static datamember nametofileid_map. More...
 
static void set_nametofileid_map (std::map< std::string, int > &X)
 Access function for map of file names. More...
 
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type. More...
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type. More...
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal. More...
 
- Static Public Member Functions inherited from SgSupport
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type. More...
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type. More...
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal. More...
 
- Static Public Member Functions inherited from SgNode
static size_t numberOfNodes ()
 Returns the total number of IR nodes of this type. More...
 
static size_t memoryUsage ()
 Returns the size in bytes of the total memory allocated for all IR nodes of this type. More...
 
static void traverseMemoryPoolNodes (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void traverseMemoryPoolVisitorPattern (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern. More...
 
static void visitRepresentativeNode (ROSE_VisitTraversal &visit)
 FOR INTERNAL USE Support for type-based traversal. More...
 
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< VariantTgetClassHierarchySubTreeFunction (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. More...
 
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::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. More...
 
static void set_globalFunctionTypeTable (SgFunctionTypeTable *globalFunctionTypeTable)
 Access function for symbol table specific to function types. More...
 
static SgTypeTableget_globalTypeTable ()
 Access function for symbol table specific to non-function types. More...
 
static void set_globalTypeTable (SgTypeTable *globalTypeTable)
 Access function for symbol table specific to non-function types. 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...
 

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). More...
 
static std::map< std::string, int > p_nametofileid_map
 This is a static STL map of file names (strings) to file id (integers). More...
 

Friends

class AST_FILE_IO
 
class Sg_File_InfoStorageClass
 
class AstSpecificDataManagingClass
 
class AstSpecificDataManagingClassStorageClass
 
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_Info
isSg_File_Info (const SgNode *s)
 Casts pointer from base class to derived class (for const pointers) More...
 
Sg_File_InfoSg_File_Info_getPointerFromGlobalIndex (unsigned long globalIndex)
 Constructor for use by AST File I/O Mechanism. More...
 
unsigned long Sg_File_Info_getNumberOfValidNodesAndSetGlobalIndexInFreepointer (unsigned long)
 Get the size of the memory pool. More...
 
void Sg_File_Info_clearMemoryPool ()
 
void Sg_File_Info_extendMemoryPoolForFileIO (unsigned long)
 
void Sg_File_Info_getNextValidPointer (std::pair< Sg_File_Info *, std::vector< unsigned char * >::const_iterator > &)
 
void Sg_File_Info_resetValidFreepointers ()
 

Detailed 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:

  • e_transformation
    The IR node is part of a transformation. The transformation may be assigned to a file, in which case the file id references the file (default is the source file, that reachable from the scope where the transformation is done).
  • e_compiler_generated
    The IR node may be part of a compiler generated IR nodes (or subtree, in which case all IR nodes in the subtree are marked as compiler generated). Compiler generated IR nodes include:
    1. implicit casts
    2. instantiated templates (not explicitly specialized)
    3. non-explicit return statements in main function.
    4. (... complete this list)
  • e_output_in_code_generation
    1. Used to explicitly makr any compiler generated IR nodes for output (forces template instaiations to be output in the generated source if transformed).
  • e_shared
    Marks IR nodes as shared (set by AST merge mechanism). Note that SgTypes and SgSymbols don't have a Sg_File_Info object, but are ALWAYS shared.
    (multiple classifications can co-exist).

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.

A pointer for this object is in the SgNode, but it is only valid for SgLocatedNodes and the SgInitializedName. The get_File_Info() member function (and associated get_startOfConstruct() and get_endOfConstruct() member functions) are implemented in the SgNode, for uniformity, but return NULL for all but the SgLocatedNodes and the SgInitializedName IR nodes.

Todo:
isOutputInCodeGeneration() is orthogonal to isCompilerGenerated and isTransformation(). Currently IR nodes that are marked as isTransformation() are output, but these need to be marked as also being isOutputInCodeGeneration() so that orthogonality of the concepts is maintained.
Todo:
It is possible to call get_file_info() on a SgFileInfo object and this needs to be fixed because it does not make any sense. This is because get_file_info is defined as a virtual function on SgNode. Not sure this is a great design, but maybe it just needs a local implementation of a private get_file_info() member function so that it can't be called (can be hidden).
Todo:
Should there be a simpler way to copy a SgFileInfo object than: "new Sg_File_Info(*fileInfo);" or "fileInfo->copy();"; likely not!
Todo:
Define the subset of IR nodes which would all have:
  1. Sg_File_Info
  2. AstAttributeMechanism
  3. SgNode (parent pointer)
    This will make the documentation more intuative. The argument supporting this is that we operate on those IR nodes that correspond to the visual representation of the source code (so we can exclude SgSymbols, and SgTypes). Having the same subset of IR nodes permits a simpler documentation of the API and intuition as to where it applies. A likely subset would be:
  4. SgLocatedNodes
  5. SgFile
  6. SgDirectory (questionable)
  7. SgInitializedName
  8. SgBaseClass
  9. SgTemplateArgument
  10. SgTemplateParameter
Todo:
Remove the functions: isCompilerGeneratedNodeToBeUnparsed(), setCompilerGeneratedNodeToBeUnparsed(), and unsetCompilerGeneratedNodeToBeUnparsed() from where they are called.
Todo:
Consider putting the endOfConstruct information into the single Sg_File_Info object. Currently the SgLocatedNode stores two Sg_File_Info objects, one for the beginning and the end of each construct. This would save significant space in the AST. Additional information in the Sg_File_Info could be:
  • offset from starting line number to the end of construct
  • flag for if end of construct is located in the same file as the start of construct
Todo:
Consider using "short int" instead of "int" for the file_id, line, and col (and maybe the classificationBitField) to reduce the size of the data structure. Padding is not a significant issue since data structures are allocated in contiguious memory (except for padding to at least the nearest byte if bit field widths are used.
See Also
Example of using a Sg_File_Info object

Definition at line 20046 of file Cxx_Grammar.h.

Member Typedef Documentation

Definition at line 20698 of file Cxx_Grammar.h.

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"

We need constructors taking a value of this type.

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 20083 of file Cxx_Grammar.h.

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

These values can and likely should disappear in the future.

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 20334 of file Cxx_Grammar.h.

anonymous enum

static variant value

Enumerator
static_variant 

Definition at line 20386 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.

This constructor should be deprecated since we don't want it to be used. It's presence is historical, since it was previously used a lot (inappropriately). Before it is removed we likely need a constructor that can take a Sg_File_Info::classifier enum value.

See Also
Example:create an Sg_File_Info object
Sg_File_Info::Sg_File_Info ( const std::string &  filename,
int  line = 0,
int  col = 0 
)
Sg_File_Info::Sg_File_Info ( const Sg_File_Info X)

This the copy constructor (deep copy made).

This constructor does a deep copy of all data in the Sg_File_Info object.

See Also
Example:create an Sg_File_Info object
Sg_File_Info::Sg_File_Info ( int  file_id,
int  line,
int  column 
)
Sg_File_Info::Sg_File_Info ( const Sg_File_InfoStorageClass source)
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
virtual

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.

It appears the the copy functions don't set the parents of anything that they do a deep copy of! This can cause AST tests to fail. In particular some functions that require the parent pointers to be valid will return NULL pointers (e.g. SgInitializedName::get_declaration()). It might be that we should allow this to be done as part of the SgCopyHelp::clone function or perhaps another member function of SgCopyHelp would be useful for this support. It is not serious if the AST post processing is done since that will set any NULL pointers that are found within its traversal.

Exceptions
noneNo exceptions are thrown by this function.

Reimplemented from SgSupport.

void Sg_File_Info::post_construction_initialization ( )
virtual

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.

Reimplemented from SgNode.

static int Sg_File_Info::addFilenameToMap ( const std::string &  filename)
static

Access function to permit files referenced in Dwarf to be mapped to integers using the same scheme as for source code.

static int Sg_File_Info::numberOfSourceFiles ( )
static

Returns the number of entries in the filename map.

Sg_File_Info::set_filename ( const char *  filename)

This function sets the filename of the construct's association with source code.

This function should be updated to take and return a string. Likely we can implement an overloaded function with takes and resturns a string and preserve this function (deprecated) for a period of time.

Returns
Returns char* (will return C++ string at some point later)
void Sg_File_Info::set_filenameString ( const std::string &  filename)
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.
void Sg_File_Info::set_col ( int  n)
void Sg_File_Info::display ( const std::string  label) const
void Sg_File_Info::display ( ) const
std::string Sg_File_Info::displayString ( const std::string &  label = "") const
static void Sg_File_Info::display_static_data ( const std::string  label)
static
Sg_File_Info::get_filename ( ) const

Returns filename of source code associated with IR node.

The filename returned is manipulated under some contitions:

For debugging purposes it is an error to ask for the filename from any IR node for which hasPositionInSource() == false.

Returns
Returns char* (will return C++ string in the future).

Referenced by ssa_private::FunctionFilter::operator()().

const std::string& Sg_File_Info::get_filenameString ( ) const
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
void Sg_File_Info::set_file_id ( int  file_id)
int Sg_File_Info::get_file_id ( ) const
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.

This is useful for debugging.

Returns
Returns a C++ string object.
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
void Sg_File_Info::set_physical_filename ( const std::string &  filename)
std::string Sg_File_Info::get_physical_filename ( ) const
void Sg_File_Info::set_physical_file_id ( int  physical_file_id)
int Sg_File_Info::get_physical_file_id ( ) const
void Sg_File_Info::set_physical_line ( int  line)
int Sg_File_Info::get_physical_line ( ) const
void Sg_File_Info::set_physical_source_position_to_match_logical_source_position ( )
void Sg_File_Info::set_source_sequence_number ( unsigned int  n)
unsigned int Sg_File_Info::get_source_sequence_number ( ) const
void Sg_File_Info::updateSourcePosition ( Sg_File_Info update)
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).

Todo:
figure out what this does, it appears to be called in two places (attachment of comments and CPP directives (attachPreprocessingInfo.C) and marking template specializations for output (markTemplateSpecializationsForOutput.C)).
Returns
Returns bool.

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

This is an evolving set of reasons, so abstracting it as a member function is helpful.

Returns
Returns bool.
bool Sg_File_Info::isSameFile ( SgFile file) const
bool Sg_File_Info::isSameFile ( Sg_File_Info fileInfo) const
bool Sg_File_Info::isSameFile ( const Sg_File_Info fileInfo) const
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::isCompilerGenerated ( ) const

Returns true only if compiler generated (either by the front-end or by ROSE).

We do not presently distinguish between compiler generated code from EDG or by ROSE. For example template instatiations are not marked as compiler generated by EDG, but if ROSE generates specializations from instatioated templates then they are marked by ROSE as being compiler generated.

Returns
Returns bool.

Referenced by CGFunction::iterator::getTarget(), ssa_unfiltered_cfg::FunctionFilter::operator()(), and ssa_private::FunctionFilter::operator()().

Sg_File_Info::isCompilerGeneratedNodeToBeUnparsed ( ) const

Returns true only if compiler generated and required to be unparsed in generated code.

Templates instatiated by ROSE are marked as compiler generated, but only those instatiated templates that are used in the source file are required and so only those must be unparsed in the generated code.

Deprecated:
This now calls isOutputInCodeGeneration(), and will be removed soon.
Returns
Returns bool.
Sg_File_Info::isOutputInCodeGeneration ( ) const

Returns true only if required to be unparsed in generated code.

Templates instatiated by ROSE are marked as compiler generated, but only those instatiated templates that are used in the source file are required and so only those must be unparsed in the generated code. Note that currently all transformed IR nodes are implicitly considered to be marked as outputInCodeGeneration, but this will be made an explicit requirement in the future.

Returns
Returns bool.
Sg_File_Info::isShared ( ) const

Returns true only if shared internally (either by the front-end or by ROSE).

This is a new classification supporting the AST merge mechanism. Currently numerous types of IR nodes that are shared (SgType, SgSymbol, many non-defining declarations, etc.) are not explicitly marked as shared. This may be correct in a future release (requires more thought).

Returns
Returns bool.
bool Sg_File_Info::isFrontendSpecific ( ) const
bool Sg_File_Info::isSourcePositionUnavailableInFrontend ( ) const
void Sg_File_Info::unsetSourcePositionUnavailableInFrontend ( )
void Sg_File_Info::setSourcePositionUnavailableInFrontend ( )
bool Sg_File_Info::isCommentOrDirective ( ) const
void Sg_File_Info::unsetCommentOrDirective ( )
void Sg_File_Info::setCommentOrDirective ( )
bool Sg_File_Info::isToken ( ) const
void Sg_File_Info::unsetToken ( )
void Sg_File_Info::setToken ( )
bool Sg_File_Info::isDefaultArgument ( ) const
void Sg_File_Info::unsetDefaultArgument ( )
void Sg_File_Info::setDefaultArgument ( )
bool Sg_File_Info::isImplicitCast ( ) const
void Sg_File_Info::unsetImplicitCast ( )
void Sg_File_Info::setImplicitCast ( )
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).

Deprecated:
This now calls unsetOutputInCodeGeneration(), and will be removed soon.
Returns
Returns void.
Sg_File_Info::setCompilerGeneratedNodeToBeUnparsed ( )

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

Deprecated:
This now calls setOutputInCodeGeneration(), and will be removed soon.
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.
void Sg_File_Info::unsetFrontendSpecific ( )
void Sg_File_Info::setFrontendSpecific ( )
void Sg_File_Info::addFileToUnparse ( int  file_id)

Add files to the set that should be able to unparse the node.

bool Sg_File_Info::shouldUnparse ( int  file_id)

Should this node be unparsed by this file?

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.
static Sg_File_Info* Sg_File_Info::generateFileInfoForTransformationNode ( std::string  filename)
static
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.
unsigned int Sg_File_Info::get_classificationBitField ( void  ) const

Get whole bit field fr modifier set.

void Sg_File_Info::set_classificationBitField ( unsigned  int)
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.
Deprecated:
This function is deprecated.
Sg_File_Info::get_isPartOfTransformation ( )

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

Returns
Returns bool
Deprecated:
This function is deprecated.
void Sg_File_Info::register_node ( SgLocatedNode node)
void Sg_File_Info::deregister_node ( SgLocatedNode node)
bool Sg_File_Info::ok ( ) const

Checks internal consistancy of data.

 This function verifies:
   -# filename pointer is valid
   -# if not compiler generaated then line number > 0

 Defined to be used in tests:
      ROSE_ASSERT(statement->get_file_info()->ok());
Returns
Returns bool.
static const std::string& Sg_File_Info::getFilenameFromID ( int  id)
static
static int Sg_File_Info::getIDFromFilename ( std::string  filename)
static
Sg_File_Info& Sg_File_Info::operator= ( const Sg_File_Info X)
static std::map<int, std::string>& Sg_File_Info::get_fileidtoname_map ( )
static

Access function for static datamember fileidtoname_map.

static void Sg_File_Info::set_fileidtoname_map ( std::map< int, std::string > &  X)
static

Access function for map of file names.

static std::map<std::string, int>& Sg_File_Info::get_nametofileid_map ( )
static

Access function for static datamember nametofileid_map.

static void Sg_File_Info::set_nametofileid_map ( std::map< std::string, int > &  X)
static

Access function for map of file names.

virtual std::string Sg_File_Info::class_name ( ) const
virtual

Copies AST (whole subtree, depending on the SgCopyHelp class.

returns a string representing the class name

Reimplemented from SgSupport.

virtual VariantT Sg_File_Info::variantT ( ) const
virtual

returns new style SageIII enum values

Reimplemented from SgSupport.

void* Sg_File_Info::operator new ( size_t  size)

returns pointer to newly allocated IR node

void Sg_File_Info::operator delete ( void *  pointer,
size_t  size 
)

deallocated memory for IR node (returns memory to memory pool for reuse)

void Sg_File_Info::operator delete ( void *  pointer)
static size_t Sg_File_Info::numberOfNodes ( )
static

Returns the total number of IR nodes of this type.

static size_t Sg_File_Info::memoryUsage ( )
static

Returns the size in bytes of the total memory allocated for all IR nodes of this type.

virtual std::vector<SgNode*> Sg_File_Info::get_traversalSuccessorContainer ( )
virtual

FOR INTERNAL USE within ROSE traverals mechanism only.

This function builds and returns a copy of ordered container holding pointers to children of this node in a traversal. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change.

Warning
This function can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change.
Returns
Returns ordered STL Container of pointers to children nodes in AST.

Reimplemented from SgSupport.

virtual std::vector<std::string> Sg_File_Info::get_traversalSuccessorNamesContainer ( )
virtual

FOR INTERNAL USE within ROSE traverals mechanism only.

This function builds and returns a copy of ordered container holding strings used to name data members that are traversed in the IR node. It is associated with the definition of a tree that is travered by the AST traversal mechanism; a tree that is embeded in the AST (which is a more general graph). This function is used within the implementation of the AST traversal and has a semantics may change in subtle ways that makes it difficult to use in user code. It can return unexpected data members and thus the order and the number of elements is unpredicable and subject to change.

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

Each string is a name of a member variable holding a pointer to a child in the AST. The names are the same as used in the generated enums for accessing attributes in a traversal. The order is the same in which they are traversed and the same in which the access enums are defined. Therefore this method can be used to get the corresponding name (string) of an access enum which allows to produce more meaningful messages for attribute computations.

Returns
Returns ordered STL container of names (strings) of access names to children nodes in AST.

Reimplemented from SgSupport.

virtual size_t Sg_File_Info::get_numberOfTraversalSuccessors ( )
virtual

Reimplemented from SgSupport.

virtual SgNode* Sg_File_Info::get_traversalSuccessorByIndex ( size_t  idx)
virtual

Reimplemented from SgSupport.

virtual size_t Sg_File_Info::get_childIndex ( SgNode child)
virtual

Reimplemented from SgSupport.

virtual RTIReturnType Sg_File_Info::roseRTI ( )
virtual

FOR INTERNAL USE Access to Runtime Type Information (RTI) for this IR nodes.

 This function provides runtime type information for accessing the

structure of the current node. It is useful for generating code which would dump out or rebuild IR nodes.

Returns
Returns a RTIReturnType object (runtime type information).

Reimplemented from SgSupport.

virtual const char* Sg_File_Info::sage_class_name ( ) const
virtual

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

Reimplemented from SgSupport.

void Sg_File_Info::executeVisitorMemberFunction ( ROSE_VisitorPattern visitor)

FOR INTERNAL USE Support for visitor pattern.

virtual void Sg_File_Info::accept ( ROSE_VisitorPattern visitor)
virtual

DXN (08/09/2010): support for the classic visitor pattern done in GoF.

Reimplemented from SgSupport.

static void Sg_File_Info::traverseMemoryPoolNodes ( ROSE_VisitTraversal visit)
static

FOR INTERNAL USE Support for visitor pattern.

static void Sg_File_Info::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern visitor)
static

FOR INTERNAL USE Support for visitor pattern.

static void Sg_File_Info::visitRepresentativeNode ( ROSE_VisitTraversal visit)
static

FOR INTERNAL USE Support for type-based traversal.

virtual bool Sg_File_Info::isInMemoryPool ( )
virtual

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 ( )
virtual

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
virtual

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 *  )
virtual

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
virtual

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.

SgFileIdList Sg_File_Info::get_fileIDsToUnparse ( ) const
void Sg_File_Info::set_fileIDsToUnparse ( SgFileIdList  fileIDsToUnparse)

Friends And Related Function Documentation

friend class AST_FILE_IO
friend

Definition at line 20657 of file Cxx_Grammar.h.

friend class Sg_File_InfoStorageClass
friend

Definition at line 20658 of file Cxx_Grammar.h.

friend class AstSpecificDataManagingClass
friend

Definition at line 20659 of file Cxx_Grammar.h.

friend class AstSpecificDataManagingClassStorageClass
friend

Definition at line 20660 of file Cxx_Grammar.h.

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.
Sg_File_Info* Sg_File_Info_getPointerFromGlobalIndex ( unsigned long  globalIndex)
friend

Constructor for use by AST File I/O Mechanism.

This constructor permits the IR node to be rebuilt from the contiguously arranged data in memory which obtained via fast binary file I/O from disk.

Typedef used for low level memory access.

Typedef used to hold memory addresses as values.

Methods to find the pointer to a global and local index

unsigned long Sg_File_Info_getNumberOfValidNodesAndSetGlobalIndexInFreepointer ( unsigned  long)
friend

Get the size of the memory pool.

It actually returns the size of the whole blocks allocated, no matter they contain valid pointers or not.

void Sg_File_Info_clearMemoryPool ( )
friend
void Sg_File_Info_extendMemoryPoolForFileIO ( unsigned  long)
friend
void Sg_File_Info_getNextValidPointer ( std::pair< Sg_File_Info *, std::vector< unsigned char * >::const_iterator > &  )
friend
void Sg_File_Info_resetValidFreepointers ( )
friend

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).

We will in the future limit the range of this value (expect a signed short int: 16 bits, 32K = 32768 files plus negative values for special cases).

Definition at line 20722 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.

We will in the future limit the range of this value (expect a short int: 20 bits, 1000K = 1,048,576 lines per file).

Definition at line 20726 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.

We will in the future limit the range of this value (expect a short int: 16 bits, 64K = 65536 charaters per line).

Definition at line 20730 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).

We will in the future limit the range of this value (expect an unsigned char: 8 bits, 64K = 65536 charaters per line).

Definition at line 20734 of file Cxx_Grammar.h.

int Sg_File_Info::p_physical_file_id
protected

Definition at line 20738 of file Cxx_Grammar.h.

int Sg_File_Info::p_physical_line
protected

Definition at line 20742 of file Cxx_Grammar.h.

unsigned int Sg_File_Info::p_source_sequence_number
protected

Definition at line 20746 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.

NOTE: This set should be empty unless the node is marked as shared

Definition at line 20750 of file Cxx_Grammar.h.

std::map< int, std::string > Sg_File_Info::p_fileidtoname_map
staticprotected

This is a static STL map of file id (integers) to file names (strings).

Definition at line 20754 of file Cxx_Grammar.h.

std::map< std::string, int > Sg_File_Info::p_nametofileid_map
staticprotected

This is a static STL map of file names (strings) to file id (integers).

Definition at line 20758 of file Cxx_Grammar.h.


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