Skip to content

SgProject

This class represents a source project, with a list of SgFile objects and global

Synopsis

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

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

Description

information about the project (commandline details, AST merge options, etc.). This IR nodes contains list of files, etc. after internal command-line processing. The original argc and argv are not modified and left in tact for processing by the ROSE translator. The SgProject node keeps a deep copy of the original argc and argv as an STL list of strings (representing the command-line arguments). SgFile::stripRoseCommandLineOptions operates on a vector of argument strings to remove REX options before backend invocation.

  • Internal: This IR node does not appear many times in an AST (typically only once).
  • Todo: Make the "*PtrList" typed objects non-pointer data members (lists) instead of pointer to lists.
  • Todo: Implement a "-dumpversion" for compatibility with GNU (icc does the same).
  • See also: Example of using a SgProject object

Data members

SgProject::p_fileList_ptr

Points to the SgFileList holding the project's files.

SgProject::p_verbose

This is the level of verbosity assumed to apply to the whole project (all AST processing).

  • Internal: This is a static variable, which might make it difficult to multiple SgProject IR nodes to coexist within the same problem.

SgProject::p_originalCommandLineArgumentList

Copy of original argc and argv command line passed to ROSE translator (converted to STL list of strings).

  • Internal: This is a deep copy.

SgProject::p_frontendErrorCode

Error status from frontend processing; successful processing returns zero.

SgProject::p_backendErrorCode

Error code returnd from processing of generated source code using vendor compiler. This value should be passed back out of the main() function by the user translator (for support of makefile processing).

  • Internal: This error code is returned by the ROSE backend() function.

SgProject::p_outputFileName

Filename specific using "-o" option on command line. Set as part of normal command line processing within ROSE.

  • Internal: This is set to a default value of "a.out" if "-o" is not specified.

SgProject::p_sourceFileNameList

List of all source file names specified on the command line.

  • Internal: This can be an empty list (if none are specified). This should be updated by the AST Merge mechanism.

SgProject::p_objectFileNameList

List of all object files specified on the command line.

  • Internal: This can be an empty list (if none are specified).

SgProject::p_libraryFileList

List of all libraries specified on command line. List all libraries specified using ".a" or ".so" syntax.

  • Internal: Required to assemble link lines for backend vendor compiler.

SgProject::p_librarySpecifierList

List of libraries specified using "-lxxx" syntax.

  • Internal: Required to assemble link lines for backend vendor compiler.

SgProject::p_libraryDirectorySpecifierList

List of directories specified with "-L" option on command line

  • Internal:

SgProject::p_includeDirectorySpecifierList

List of directories specified with "-I" option on command line

  • Internal:

SgProject::p_compileOnly

This is true when "-c" requests compilation without linking.

SgProject::p_openmp_linking

This flag is used to indicate if OpenMP lowering is requested by the command line so linking to ROSE's OpenMP runtime library is needed. This flag is set to be false by default. "-rose:openmp:lowering" triggers this flag to be set to true. SgFile::p_openmp_lowering will not be sufficient since there is no SgFile in the AST when a ROSE translator is used as a linker wrapper. So we have to have a project level flag to indicate the need. Using a flag like SgProject::p_OpenMP_Only won't be sufficient neither since OpenMP input files can be handled in three different ways in ROSE: 1) parsing only 2) generating dedicated AST 3) actual OpenMP lowering Only the one with lowering will need special linking support to connect to libxomp.a and pthreads.

Member functions

list<string> SgProject::get_originalCommandLineArgumentList() const

Returns a list of strings representing the original command-line.

`SgProject::set_originalCommandLineArgumentList( list<string>

originalCommandLineArgumentList )` Sets the list of strings representing the original command-line.

bool SgProject::get_C99_only (void) const

This controls the c99 mode in the frontend.

Base Classes

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

Types

Name
CallGraphState
MutationState

Type Aliases

Name
base_node_type

Enums

Name Description
Unnamed enum static variant value
constant_folding_enum

Member Functions

Name Description
SgProject
SgProject(); [constructor]
Constructors
~SgProject
virtual ~SgProject(); [destructor] [virtual]
Destructor
RunFrontend
int RunFrontend();
accept
virtual void accept(ROSE_VisitorPattern& visitor) override; [virtual]
support for the classic visitor pattern done in GoF
addNewAttribute
virtual void addNewAttribute( std::string s, AstAttribute* a) override; [virtual]
Add a new attribute represented by the named string.
appendDestructorOwnedNodes
virtual void appendDestructorOwnedNodes(std::vector<SgNode*>& nodes) const override; [virtual]
attributeExists
virtual bool attributeExists(std::string s) const override; [virtual]
Tests if attribute of name 's' is present.
class_name
virtual std::string class_name() const override; [virtual]
returns a string representing the class name
compileOutput
int compileOutput();
function to compile the output from unparsing the project
copy
virtual SgNode* copy(SgCopyHelp& help) const override; [virtual]
display
void display(std::string const& label) const;
fixupCopy_references
virtual void fixupCopy_references( SgNode* copy, SgCopyHelp& help) const override; [virtual]
fixupCopy_scopes
virtual void fixupCopy_scopes( SgNode* copy, SgCopyHelp& help) const override; [virtual]
fixupCopy_symbols
virtual void fixupCopy_symbols( SgNode* copy, SgCopyHelp& help) const override; [virtual]
getAbsolutePathFileNames
std::vector<std::string> getAbsolutePathFileNames() const;
This function generates a list of files resolved to absolute paths (symbolic links should not be resolved).
getAttribute
virtual AstAttribute* getAttribute(std::string s) const override; [virtual]
Returns attribute of name 's'.
get_C11_gnu_only
bool get_C11_gnu_only() const;
get_C11_only
bool get_C11_only() const;
get_C17_gnu_only
bool get_C17_gnu_only() const;
get_C17_only
bool get_C17_only() const;
get_C23_gnu_only
bool get_C23_gnu_only() const;
get_C23_only
bool get_C23_only() const;
get_C2y_gnu_only
bool get_C2y_gnu_only() const;
get_C2y_only
bool get_C2y_only() const;
get_C89_gnu_only
bool get_C89_gnu_only() const;
get_C89_only
bool get_C89_only() const;
get_C90_gnu_only
bool get_C90_gnu_only() const;
get_C90_only
bool get_C90_only() const;
get_C99_gnu_only
bool get_C99_gnu_only() const;
get_C99_only
bool get_C99_only() const;
get_C_PreprocessorOnly
bool get_C_PreprocessorOnly() const;
get_C_only
bool get_C_only() const;
get_CoArrayFortran_only
bool get_CoArrayFortran_only() const;
get_Cxx03_gnu_only
bool get_Cxx03_gnu_only() const;
get_Cxx03_only
bool get_Cxx03_only() const;
get_Cxx11_gnu_only
bool get_Cxx11_gnu_only() const;
get_Cxx11_only
bool get_Cxx11_only() const;
get_Cxx14_gnu_only
bool get_Cxx14_gnu_only() const;
get_Cxx14_only
bool get_Cxx14_only() const;
get_Cxx17_gnu_only
bool get_Cxx17_gnu_only() const;
get_Cxx17_only
bool get_Cxx17_only() const;
get_Cxx20_gnu_only
bool get_Cxx20_gnu_only() const;
get_Cxx20_only
bool get_Cxx20_only() const;
get_Cxx23_gnu_only
bool get_Cxx23_gnu_only() const;
get_Cxx23_only
bool get_Cxx23_only() const;
get_Cxx26_gnu_only
bool get_Cxx26_gnu_only() const;
get_Cxx26_only
bool get_Cxx26_only() const;
get_Cxx98_gnu_only
bool get_Cxx98_gnu_only() const;
get_Cxx98_only
bool get_Cxx98_only() const;
get_Cxx_only
bool get_Cxx_only() const;
get_F2003_only
bool get_F2003_only() const;
get_F2008_only
bool get_F2008_only() const;
get_F2018_only
bool get_F2018_only() const;
get_F77_only
bool get_F77_only() const;
get_F90_only
bool get_F90_only() const;
get_F95_only
bool get_F95_only() const;
get_Fortran_only
bool get_Fortran_only() const;
get_addCppDirectivesToAST
bool get_addCppDirectivesToAST() const;
get_appendPID
bool get_appendPID() const;
get_applicationRootDirectory
std::string get_applicationRootDirectory() const;
get_astfile_out
std::string get_astfile_out() const;
get_astfiles_in
std::list<std::string> get_astfiles_in() const;
get_attributeMechanism
virtual AstAttributeMechanism* get_attributeMechanism() const override; [virtual]
get_backendErrorCode
int get_backendErrorCode() const;
get_callGraphState
CallGraphState& get_callGraphState();
get_childIndex
virtual size_t get_childIndex(SgNode* child) const override; [virtual]
index-based access to traversal successors by child node
get_compilationPerformanceFile
std::string get_compilationPerformanceFile() const;
get_compileOnly
bool get_compileOnly() const;
get_dataBaseFilename
std::string get_dataBaseFilename() const;
get_detect_dangling_pointers
int get_detect_dangling_pointers() const;
get_directoryList
SgDirectoryList* get_directoryList() const;
get_excludeFileList
SgStringList& get_excludeFileList();
get_excludePathList
SgStringList& get_excludePathList();
get_exit_after_parser
bool get_exit_after_parser() const;
get_extraIncludeDirectorySpecifierAfterList
SgStringList const& get_extraIncludeDirectorySpecifierAfterList() const;
get_extraIncludeDirectorySpecifierBeforeList
SgStringList const& get_extraIncludeDirectorySpecifierBeforeList() const;
get_file
SgFile& get_file(int i) const;
Access function for retriving a SgFile object from the list stored internally This function is depricated and "operator[unsigned int]" should be used instead.
get_fileList
SgFilePtrList& get_fileList() const;
get_fileList_ptr
SgFileList* get_fileList_ptr() const;
get_files
SgFilePtrList get_files() const;
get_frontendConstantFolding
SgProject::constant_folding_enum get_frontendConstantFolding() const;
get_frontendErrorCode
int get_frontendErrorCode() const;
get_globalScopeAcrossFiles
SgGlobal* get_globalScopeAcrossFiles() const;
get_gnuOptionForUndefinedSymbol
std::string get_gnuOptionForUndefinedSymbol() const;
get_includeDirectorySpecifierList
SgStringList const& get_includeDirectorySpecifierList() const;
get_includeFileList
SgStringList& get_includeFileList();
get_includePathList
SgStringList& get_includePathList();
get_includingPreprocessingInfosMap
std::map<std::string, std::set<PreprocessingInfo*>> get_includingPreprocessingInfosMap() const;
get_libraryDirectorySpecifierList
SgStringList const& get_libraryDirectorySpecifierList() const;
get_libraryFileList
SgStringList const& get_libraryFileList() const;
get_librarySpecifierList
SgStringList const& get_librarySpecifierList() const;
get_macroSpecifierList
SgStringList const& get_macroSpecifierList() const;
get_midendErrorCode
int get_midendErrorCode() const;
get_mode_32_bit
bool get_mode_32_bit() const;
get_mutationState
MutationState& get_mutationState();
get_noclobber_if_different_output_file
bool get_noclobber_if_different_output_file() const;
get_noclobber_output_file
bool get_noclobber_output_file() const;
get_numberOfTraversalSuccessors
virtual size_t get_numberOfTraversalSuccessors() const override; [virtual]
return number of children in the traversal successor list
get_objectFileNameList
SgStringList const& get_objectFileNameList() const;
get_openmp_linking
bool get_openmp_linking() const;
get_originalCommandLineArgumentList
SgStringList const& get_originalCommandLineArgumentList() const;
get_original_header_snapshots
std::map<std::string, std::string> const& get_original_header_snapshots() const;
get_outputFileName
std::string get_outputFileName() const;
get_preincludeDirectoryList
SgStringList const& get_preincludeDirectoryList() const;
get_preincludeFileList
SgStringList const& get_preincludeFileList() const;
get_projectSpecificDatabaseFile
std::string get_projectSpecificDatabaseFile() const;
get_reportOnHeaderFileUnparsing
bool get_reportOnHeaderFileUnparsing() const;
get_skip_post_processing
bool get_skip_post_processing() const;
get_skip_transformation
bool get_skip_transformation() const;
get_skip_unparse
bool get_skip_unparse() const;
get_skipfinalCompileStep
bool get_skipfinalCompileStep() const;
get_sourceFileNameList
SgStringList const& get_sourceFileNameList() const;
get_stop_after_compilation_do_not_assemble_file
bool get_stop_after_compilation_do_not_assemble_file() const;
get_suppressNameQualificationAcrossWholeTranslationUnit
bool get_suppressNameQualificationAcrossWholeTranslationUnit() const;
get_traversalSuccessorByIndex
virtual SgNode* get_traversalSuccessorByIndex(size_t idx) const override; [virtual]
index-based access to traversal successors by index number
get_traversalSuccessorContainer
virtual std::vector<SgNode*> get_traversalSuccessorContainer() const override; [virtual]
container of pointers to AST successor nodes used in the traversal overridden in every class by generated implementation
get_traversalSuccessorIsListElement
virtual std::vector<bool> get_traversalSuccessorIsListElement() const override; [virtual]
get_traversalSuccessorNamesContainer
virtual std::vector<std::string> get_traversalSuccessorNamesContainer() const override; [virtual]
container of names of variables or container indices used used in the traversal to access AST successor nodes overridden in every class by generated implementation
get_unparseHeaderFilesRootFolder
std::string get_unparseHeaderFilesRootFolder() const;
get_unparse_in_same_directory_as_input_file
bool get_unparse_in_same_directory_as_input_file() const;
get_unparse_tokens
bool get_unparse_tokens() const;
get_unparser__clobber_input_file
bool get_unparser__clobber_input_file() const;
get_useBackendOnly
bool get_useBackendOnly() const;
get_usingApplicationRootDirectory
bool get_usingApplicationRootDirectory() const;
initialization
void initialization();
link
int link(std::string linkerName);
numberOfAttributes
virtual int numberOfAttributes() const override; [virtual]
Returns the number of attributes on this IR node.
numberOfDirectories
int numberOfDirectories() const;
Total number of directories in the project.
numberOfFiles
int numberOfFiles() const;
The total number of files in this project (equal to the number of source files specified on the command line)
operator delete
void operator delete( void* pointer, size_t size);
deallocated memory for IR node (returns memory to memory pool for reuse)
operator new
void* operator new(size_t size);
returns pointer to newly allocated IR node
operator[]
SgFile* operator[](std::string filename);
Subscript operators
parse
int parse();
parse overloads
processCommandLine
void processCommandLine(std::vector<std::string> const& argv);
process command line and store options in the SgProject object. This options are used by parse und unparse.
processDataMemberReferenceToPointers
virtual void processDataMemberReferenceToPointers(ReferenceToPointerHandler*) override; [virtual]
Pass references to stored node pointers to a handler.
release_callGraphState
void release_callGraphState();
release_mutationState
void release_mutationState();
removeAttribute
virtual void removeAttribute(std::string s) override; [virtual]
Remove attribute of name 's' if present.
returnDataMemberPointers
virtual std::vector<std::pair<SgNode*, std::string>> returnDataMemberPointers() const override; [virtual]
Return the node pointers stored in this node's data members.
roseRTI
virtual RTIReturnType roseRTI() override; [virtual]
return C++ Runtime-Time-Information
sage_class_name
virtual char const* sage_class_name() const override; [virtual]
returns a C style string (char*) representing the class name
setAttribute
virtual void setAttribute( std::string s, AstAttribute* a) override; [virtual]
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.
set_C_PreprocessorOnly
void set_C_PreprocessorOnly(bool C_PreprocessorOnly);
set_C_only
void set_C_only(bool value);
set_Cxx_only
void set_Cxx_only(bool value);
set_Fortran_only
void set_Fortran_only(bool value);
set_addCppDirectivesToAST
void set_addCppDirectivesToAST(bool addCppDirectivesToAST);
set_appendPID
void set_appendPID(bool appendPID);
set_applicationRootDirectory
void set_applicationRootDirectory(std::string applicationRootDirectory);
set_astfile_out
void set_astfile_out(std::string astfile_out);
set_astfiles_in
void set_astfiles_in(std::list<std::string> astfiles_in);
set_attributeMechanism
virtual void set_attributeMechanism(AstAttributeMechanism* attributeMechanism) override; [virtual]
set_backendErrorCode
void set_backendErrorCode(int backendErrorCode);
set_compilationPerformanceFile
void set_compilationPerformanceFile(std::string compilationPerformanceFile);
set_compileOnly
void set_compileOnly(bool compileOnly);
set_dataBaseFilename
void set_dataBaseFilename(std::string dataBaseFilename);
set_directoryList
void set_directoryList(SgDirectoryList* directoryList);
set_excludeFileList
void set_excludeFileList(SgStringList const& excludeFileList);
set_excludePathList
void set_excludePathList(SgStringList const& excludePathList);
set_file
void set_file(SgFile& file);
Access function for putting a new SgFile object into the list stored internally This function is depricated and "get_fileList->push_back(SgFile*)" should be used instead.
set_fileList_ptr
void set_fileList_ptr(SgFileList* fileList_ptr);
set_frontendConstantFolding
void set_frontendConstantFolding(SgProject::constant_folding_enum frontendConstantFolding);
set_frontendErrorCode
void set_frontendErrorCode(int frontendErrorCode);
set_globalScopeAcrossFiles
void set_globalScopeAcrossFiles(SgGlobal* globalScopeAcrossFiles);
set_gnuOptionForUndefinedSymbol
void set_gnuOptionForUndefinedSymbol(std::string gnuOptionForUndefinedSymbol);
set_includeFileList
void set_includeFileList(SgStringList const& includeFileList);
set_includePathList
void set_includePathList(SgStringList const& includePathList);
set_includingPreprocessingInfosMap
void set_includingPreprocessingInfosMap(std::map<std::string, std::set<PreprocessingInfo*>> includingPreprocessingInfosMap);
set_midendErrorCode
void set_midendErrorCode(int midendErrorCode);
set_mode_32_bit
void set_mode_32_bit(bool mode_32_bit);
set_noclobber_if_different_output_file
void set_noclobber_if_different_output_file(bool noclobber_if_different_output_file);
set_noclobber_output_file
void set_noclobber_output_file(bool noclobber_output_file);
set_openmp_linking
void set_openmp_linking(bool openmp_linking);
set_outputFileName
void set_outputFileName(std::string outputFileName);
set_projectSpecificDatabaseFile
void set_projectSpecificDatabaseFile(std::string projectSpecificDatabaseFile);
set_reportOnHeaderFileUnparsing
void set_reportOnHeaderFileUnparsing(bool reportOnHeaderFileUnparsing);
set_skip_post_processing
void set_skip_post_processing(bool skip_post_processing);
set_stop_after_compilation_do_not_assemble_file
void set_stop_after_compilation_do_not_assemble_file(bool stop_after_compilation_do_not_assemble_file);
set_suppressNameQualificationAcrossWholeTranslationUnit
void set_suppressNameQualificationAcrossWholeTranslationUnit(bool suppressNameQualificationAcrossWholeTranslationUnit);
set_unparseHeaderFilesRootFolder
void set_unparseHeaderFilesRootFolder(std::string unparseHeaderFilesRootFolder);
set_unparse_in_same_directory_as_input_file
void set_unparse_in_same_directory_as_input_file(bool unparse_in_same_directory_as_input_file);
set_unparser__clobber_input_file
void set_unparser__clobber_input_file(bool unparser__clobber_input_file);
set_usingApplicationRootDirectory
void set_usingApplicationRootDirectory(bool usingApplicationRootDirectory);
skipfinalCompileStep
void skipfinalCompileStep(bool value);
unparse
void unparse( UnparseFormatHelp* unparseFormatHelp = NULL, UnparseDelegate* unparseDelegate = NULL);
function to generate output for all files in the project (arguments control code generation)
updateAttribute
virtual void updateAttribute( std::string s, AstAttribute* a) override; [virtual]
Replace existing attribute of name 's' with new AstAttribute.
variantT
virtual VariantT variantT() const override; [virtual]
returns new style SageIII enum values

Static Member Functions

Name Description
get_showBackendCommandLine
static bool get_showBackendCommandLine();
get_unparseHeaderFilesDebug
static int get_unparseHeaderFilesDebug();
get_verbose
static int get_verbose();
DQ: Modified to accept a value on the command line (no longer a boolean variable) value of 0 means quiet and higher values output more information, default value is zero (quiet).
memoryUsage
static size_t memoryUsage();
Returns the size in bytes of the total memory allocated for all IR nodes of this type
numberOfNodes
static size_t numberOfNodes();
Returns the total number of IR nodes of this type
set_showBackendCommandLine
static void set_showBackendCommandLine(bool show);
set_unparseHeaderFilesDebug
static void set_unparseHeaderFilesDebug(int);
set_verbose
static void set_verbose(int);
traverseMemoryPoolNodes
static void traverseMemoryPoolNodes(ROSE_VisitTraversal& visit);
FOR INTERNAL USE Support for visitor pattern over all IR nodes by type of IR node.
traverseMemoryPoolVisitorPattern
static void traverseMemoryPoolVisitorPattern(ROSE_VisitorPattern& visitor);
FOR INTERNAL USE Support for visitor pattern.
visitRepresentativeNode
static void visitRepresentativeNode(ROSE_VisitTraversal& visit);
FOR INTERNAL USE Support for type-based traversal.

Static Data Members

Name Description
free_slots Free slots, each numbered pool_index * pool_size + slot_index. The last entry is allocated next.
p_showBackendCommandLine global to output the command line that goes to the backend compiler. Default is false.
p_unparseHeaderFilesDebug global concept of verbose level which controls useful output from the unparse headers feature (values greater than zero increase output level)
p_verbose global concept of verbose level which controls useful output from the compiler (values greater than zero increase output level)
pool_live_flags
pool_size
pools

Protected Data Members

Name
p_C11_only
p_C14_only
p_C_PreprocessorOnly
p_C_only
p_Cxx0x_only
p_Cxx11_only
p_Cxx14_only
p_Cxx_only
p_Fortran_only
p_addCppDirectivesToAST
p_appendPID
p_applicationRootDirectory
p_astfile_out
p_astfiles_in
p_attributeMechanism
p_backendErrorCode
p_callGraphState
p_compilationPerformanceFile
p_compileOnly
p_dataBaseFilename
p_directoryList
p_excludeFileList
p_excludePathList
p_extraIncludeDirectorySpecifierAfterList
p_extraIncludeDirectorySpecifierBeforeList
p_fileList_ptr
p_frontendConstantFolding
p_frontendErrorCode
p_globalScopeAcrossFiles
p_gnuOptionForUndefinedSymbol
p_includeDirectorySpecifierList
p_includeFileList
p_includePathList
p_includingPreprocessingInfosMap
p_libraryDirectorySpecifierList
p_libraryFileList
p_librarySpecifierList
p_macroSpecifierList
p_midendErrorCode
p_mode_32_bit
p_mutationState
p_noclobber_if_different_output_file
p_noclobber_output_file
p_objectFileNameList
p_openmp_linking
p_originalCommandLineArgumentList
p_original_header_snapshots
p_outputFileName
p_preincludeDirectoryList
p_preincludeFileList
p_projectSpecificDatabaseFile
p_reportOnHeaderFileUnparsing
p_skip_post_processing
p_sourceFileNameList
p_stop_after_compilation_do_not_assemble_file
p_suppressNameQualificationAcrossWholeTranslationUnit
p_unparseHeaderFilesRootFolder
p_unparse_in_same_directory_as_input_file
p_unparser__clobber_input_file
p_usingApplicationRootDirectory

Friends

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

Created with MrDocs