3#ifndef UTILITY_FUNCTIONS_H
4#define UTILITY_FUNCTIONS_H
6#include "Cxx_Grammar.h"
9#define BACKEND_VERBOSE_LEVEL 2
13std::string version_message();
17std::string version_number();
20unsigned int rose_boost_version_id();
23std::string rose_boost_version_path();
27void outputPredefinedMacros();
33ROSE_DLL_API
SgProject* frontend (
int argc,
char** argv,
bool frontendConstantFolding)
34 ROSE_DEPRECATED(
"use frontend(int, char**, SgProject::constant_folding_enum)");
35ROSE_DLL_API
SgProject* frontend (
const std::vector<std::string>& argv,
bool frontendConstantFolding)
36 ROSE_DEPRECATED(
"use frontend(const std::vector<std::string>&, SgProject::constant_folding_enum)");
38ROSE_DLL_API
SgProject* frontend (
int argc,
char** argv, SgProject::constant_folding_enum = SgProject::e_original_expressions_only );
39ROSE_DLL_API
SgProject* frontend (
const std::vector<std::string>& argv, SgProject::constant_folding_enum = SgProject::e_original_expressions_only );
54SgProject* frontendShell (
int argc,
char** argv);
55ROSE_DLL_API
SgProject* frontendShell (
const std::vector<std::string>& argv);
64ROSE_DLL_API
int backend (
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL, UnparseDelegate* unparseDelegate = NULL );
69ROSE_DLL_API
int backendCompilesUsingOriginalInputFile (
SgProject* project,
bool compile_with_USE_ROSE_macro =
false );
77ROSE_DLL_API
int backendGeneratesSourceCodeButCompilesUsingOriginalInputFile (
SgProject* project );
82ROSE_DLL_API
int copy_backend(
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL );
88ROSE_DLL_API
void generatePDF (
const SgProject & project );
91ROSE_DLL_API
void generateDOT (
const SgProject & project, std::string filenamePostfix =
"",
bool excludeTemplateInstantiations =
false );
96ROSE_DLL_API
void generateDOT (
SgNode* node, std::string filename );
100ROSE_DLL_API
void generateDOT_withIncludes (
const SgProject & project, std::string filenamePostfix =
"" );
101ROSE_DLL_API
void generateDOTforMultipleFile (
const SgProject & project, std::string filenamePostfix =
"" );
105ROSE_DLL_API
void generateAstGraph (
const SgProject* project,
int maxSize = 2000, std::string filenameSuffix =
"" );
120#include "AstDOTGeneration.h"
122template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
127template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
130template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
160 bool frontend_warnings;
162 bool backend_warnings;
170 ROSE_DLL_API
bool get_frontend_notes();
171 ROSE_DLL_API
void set_frontend_notes(
bool flag);
172 ROSE_DLL_API
bool get_frontend_warnings();
173 ROSE_DLL_API
void set_frontend_warnings(
bool flag);
174 ROSE_DLL_API
bool get_backend_notes();
175 ROSE_DLL_API
void set_backend_notes(
bool flag);
176 ROSE_DLL_API
bool get_backend_warnings();
177 ROSE_DLL_API
void set_backend_warnings(
bool flag);
181 ROSE_DLL_API
extern Options global_options;
194 int containsString (
const std::string& masterString,
const std::string& targetString );
197 std::string getFileNameByTraversalBackToFileNode (
const SgNode* astNode );
201 std::string getFileName (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
202 int getLineNumber (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
203 int getColumnNumber (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
204 bool isPartOfTransformation(
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
206 ROSE_DLL_API std::string getWorkingDirectory ();
210 ROSE_DLL_API std::string utility_stripPathFromFileName (
const std::string& fileNameWithPath );
228 ROSE_DLL_API
void usage (
int status);
230 void filterInputFile (
const std::string inputFileName,
const std::string outputFileName );
240 extern std::map<int,std::map<SgNode*,TokenStreamSequenceToNodeMapping*>* > tokenSubsequenceMapOfMaps;
243 extern std::map<SgSourceFile*,std::map<SgNode*,TokenStreamSequenceToNodeMapping*>* > tokenSubsequenceMapOfMapsBySourceFile;
247 extern std::map<SgSourceFile*,std::map<SgScopeStatement*,std::pair<SgStatement*,SgStatement*> > > firstAndLastStatementsToUnparseInScopeMapBySourceFile;
252 extern std::map<int,std::map<SgStatement*,FrontierNode*>*> frontierNodesMapOfMaps;
256 extern std::map<int,std::map<SgNode*,PreviousAndNextNodeData*>*> previousAndNextNodeMapOfMaps;
261 extern std::map<int,std::multimap<int,SgStatement*>*> redundantlyMappedTokensToStatementMapOfMultimaps;
262 extern std::map<int,std::set<int>*> redundantTokenEndingsMapOfSets;
266 extern std::map<int,std::map<SgScopeStatement*,SgStatement*>*> representativeWhitespaceStatementMapOfMaps;
270 extern std::map<int,std::map<SgStatement*,MacroExpansion*>*> macroExpansionMapOfMaps;
273 extern std::map<std::string, SgIncludeFile*> includeFileMapForUnparsing;
282 void initDiagnostics();
300 extern bool is_Ada_language;
301 extern bool is_C_language;
302 extern bool is_Cobol_language;
303 extern bool is_OpenMP_language;
304 extern bool is_UPC_language;
305 extern bool is_UPC_dynamic_threads;
306 extern bool is_C99_language;
307 extern bool is_Cxx_language;
308 extern bool is_Java_language;
309 extern bool is_Jvm_language;
310 extern bool is_Jovial_language;
311 extern bool is_Fortran_language;
312 extern bool is_CAF_language;
313 extern bool is_PHP_language;
314 extern bool is_Python_language;
315 extern bool is_Cuda_language;
316 extern bool is_OpenCL_language;
317 extern bool is_binary_executable;
This class represents the notion of an expression or statement which has a position within the source...
This class represents strings within the IR nodes.
This class represents the base class for all IR nodes within Sage III.
This class represents a source project, with a list of SgFile objects and global information about th...
This class represents the notion of a statement.
SgStatement * getPreviousStatement(SgStatement *targetStatement, bool climbOutScope=true)
Functions to move to SgStatement object in SAGE III later.
ROSE_DLL_API std::string getSourceDirectory(std::string fileNameWithPath)
get the current directory
ROSE_DLL_API std::string getPathFromFileName(std::string fileNameWithPath)
get the filename from the full filename
std::string getFileNameWithoutPath(SgStatement *statementPointer)
get the sourceDirectory directory
SgName concatenate(const SgName &X, const SgName &Y)
get the path from the full filename