Sg_File_Info Class Reference

#include <Cxx_Grammar.h>

Inheritance diagram for Sg_File_Info:

Inheritance graph
[legend]
Collaboration diagram for Sg_File_Info:

Collaboration graph
[legend]
List of all members.

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:

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.

For internal use only.

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


Public Types

typedef SgSupport base_node_type
 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
 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
 static_variant = V_Sg_File_Info
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
}
 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...

Public Member Functions

virtual SgNodecopy (SgCopyHelp &help) const
 Sg_File_Info ()
 This is the less useful default constructor.
 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 ()
 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 set_filename (const char *filename) ROSE_DEPRECATED_FUNCTION
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.
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.
const std::string & get_filenameString () const
int get_line () const
 Returns the line number of the associated code for this IR node.
int get_col () const
 Returns the column number of the associated code for this IR node.
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.
int get_raw_line () const
 Returns the line number of the associated code for this IR node.
int get_raw_col () const
 Returns the column number of the associated code for this IR node.
void updateSourcePosition (Sg_File_Info *update)
bool hasPositionInSource () const
 No earthly idea what this function does!
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.
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 ()
void unsetTransformation ()
 Set/unset functions for classification bit field.
void setTransformation ()
 Marks an IR node to be a transformation if it is not one already.
void unsetCompilerGeneratedNodeToBeUnparsed () ROSE_DEPRECATED_FUNCTION
 Mark as compiler generated but as required to be output by unparser (e.g. required template instatiations).
void setCompilerGeneratedNodeToBeUnparsed () ROSE_DEPRECATED_FUNCTION
 Marks IR node as compiler generated but required in the generated source (e.g. requied templates).
void unsetOutputInCodeGeneration ()
 Mark as to be output by the unparser (code generator).
void setOutputInCodeGeneration ()
 Marks IR node as compiler generated but required in the generated source (e.g. requied templates).
void unsetShared ()
 Support for shared IR nodes (shared via AST merge mechanism).
void setShared ()
 Marks IR node as shared.
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.
void setCompilerGenerated ()
 Marks IR node as compiler generated.
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.
bool get_isPartOfTransformation () ROSE_DEPRECATED_FUNCTION
 This function indicates of the IR nodes is part of a transformation.
void register_node (SgLocatedNode *node) ROSE_DEPRECATED_FUNCTION
void deregister_node (SgLocatedNode *node) ROSE_DEPRECATED_FUNCTION
bool ok () const
Sg_File_Infooperator= (const Sg_File_Info &X)
virtual std::string class_name () const
 Copies AST (whole subtree, depending on the SgCopyHelp class returns a string representing the class name.
virtual VariantT variantT () const
 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 ()
 FOR INTERNAL USE within ROSE traverals mechanism only.
virtual std::vector< std::string > get_traversalSuccessorNamesContainer ()
 FOR INTERNAL USE within ROSE traverals mechanism only.
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.
virtual const char * sage_class_name () const ROSE_DEPRECATED_FUNCTION
void executeVisitorMemberFunction (ROSE_VisitorPattern &visitor)
 FOR INTERNAL USE Support for visitor pattern.
virtual void accept (ROSE_VisitorPattern &visitor)
 DXN (08/09/2010): support for the classic visitor pattern done in GoF.
virtual bool isInMemoryPool ()
 FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap.
virtual void checkDataMemberPointersIfInMemoryPool ()
 FOR INTERNAL USE This is used in internal tests to verify that all IR nodes are allocated from the heap.
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
virtual void processDataMemberReferenceToPointers (ReferenceToPointerHandler *)
 FOR INTERNAL USE Processes pairs of references to SgNode* and strings for use in AST tools
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.
 Sg_File_Info (const Sg_File_InfoStorageClass &source)
Sg_File_InfoaddRegExpAttribute (std::string s, AstRegExAttribute *a)
 Support for AST matching using regular expression.
SgFileIdList get_fileIDsToUnparse () const
void set_fileIDsToUnparse (SgFileIdList fileIDsToUnparse)
virtual ~Sg_File_Info ()
 This is the destructor.

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.
static Sg_File_InfogenerateDefaultFileInfoForTransformationNode ()
 Static function to return new Sg_File_Info object set to default values appropriate for transformations.
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.
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.
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 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.
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.

Protected Attributes

int p_file_id
 This is a key that maps integers to file names, it prevents redundent storage of filename strings.
int p_line
 This is the line number of the location of the source code for this IR node.
int p_col
 This is the column number of the location of the source code for this IR node.
unsigned int p_classificationBitField
 This is mechanism for classification of the IR node.
SgFileIdList p_fileIDsToUnparse
 This set contains a list of all file ids for which the accompanying IR node should be unparsed.

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

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.
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.
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.
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.
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.
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.
Sg_File_InfoisSg_File_Info (SgNode *s)
 Casts pointer from base class to derived class.
const Sg_File_InfoisSg_File_Info (const SgNode *s)
 Casts pointer from base class to derived class (for const pointers).
Sg_File_InfoSg_File_Info_getPointerFromGlobalIndex (unsigned long globalIndex)
 Constructor for use by AST File I/O MechanismTypedef 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)
 Get the size of the memory pool.
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 ()


Member Typedef Documentation

typedef SgSupport Sg_File_Info::base_node_type

Reimplemented from SgSupport.


Member Enumeration Documentation

enum Sg_File_Info::classifier

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

For internal use only.

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)

enum Sg_File_Info::p_fileflags

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

For internal use only.

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

anonymous enum

static variant value

Enumerator:
static_variant 


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.

For internal use only.

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

For internal use only.

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]

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.

void Sg_File_Info::set_filename ( const char *  filename  ) 

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 internal use only.

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

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.

For internal use only.

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::updateSourcePosition ( Sg_File_Info update  ) 

Sg_File_Info::hasPositionInSource (  )  const

No earthly idea what this function does!

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.

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:
Returns bool.

Sg_File_Info::isCompilerGenerated (  )  const

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

For internal use only.

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.

Sg_File_Info::isCompilerGeneratedNodeToBeUnparsed (  )  const

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

For internal use only.

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.

For internal use only.

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

For internal use only.

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

Sg_File_Info::unsetTransformation (  ) 

Set/unset functions for classification bit field.

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

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

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

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

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

Reimplemented from SgSupport.

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

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

Reimplemented from SgSupport.

void Sg_File_Info::operator delete ( void *  pointer  ) 

Reimplemented from SgSupport.

static size_t Sg_File_Info::numberOfNodes (  )  [static]

Returns the total number of IR nodes of this type.

Reimplemented from SgSupport.

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.

Reimplemented from SgSupport.

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.

Reimplemented from SgSupport.

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.

Reimplemented from SgSupport.

static void Sg_File_Info::traverseMemoryPoolVisitorPattern ( ROSE_VisitorPattern visitor  )  [static]

FOR INTERNAL USE Support for visitor pattern.

Reimplemented from SgSupport.

static void Sg_File_Info::visitRepresentativeNode ( ROSE_VisitTraversal visit  )  [static]

FOR INTERNAL USE Support for type-based traversal.

Reimplemented from SgSupport.

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.

Reimplemented from SgSupport.

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]

Reimplemented from SgSupport.

friend class Sg_File_InfoStorageClass [friend]

friend class AstSpecificDataManagingClass [friend]

Reimplemented from SgSupport.

friend class AstSpecificDataManagingClassStorageClass [friend]

Reimplemented from SgSupport.

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.

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

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

For internal use only.

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

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.

For internal use only.

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

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.

For internal use only.

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

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

For internal use only.

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

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.

For internal use only.

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

std::map< int, std::string > Sg_File_Info::p_fileidtoname_map [static, protected]

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

std::map< std::string, int > Sg_File_Info::p_nametofileid_map [static, protected]

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


The documentation for this class was generated from the following files:
Generated on Tue Jan 31 05:34:39 2012 for ROSE by  doxygen 1.4.7