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();
32ROSE_DLL_API
SgProject* frontend (
int argc,
char** argv,
bool frontendConstantFolding =
false );
33ROSE_DLL_API
SgProject* frontend (
const std::vector<std::string>& argv,
bool frontendConstantFolding =
false );
47SgProject* frontendShell (
int argc,
char** argv);
48ROSE_DLL_API
SgProject* frontendShell (
const std::vector<std::string>& argv);
57ROSE_DLL_API
int backend (
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL, UnparseDelegate* unparseDelegate = NULL );
62ROSE_DLL_API
int backendCompilesUsingOriginalInputFile (
SgProject* project,
bool compile_with_USE_ROSE_macro =
false );
70ROSE_DLL_API
int backendGeneratesSourceCodeButCompilesUsingOriginalInputFile (
SgProject* project );
75ROSE_DLL_API
int copy_backend(
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL );
81ROSE_DLL_API
void generatePDF (
const SgProject & project );
84ROSE_DLL_API
void generateDOT (
const SgProject & project, std::string filenamePostfix =
"",
bool excludeTemplateInstantiations =
false );
89ROSE_DLL_API
void generateDOT (
SgNode* node, std::string filename );
93ROSE_DLL_API
void generateDOT_withIncludes (
const SgProject & project, std::string filenamePostfix =
"" );
94ROSE_DLL_API
void generateDOTforMultipleFile (
const SgProject & project, std::string filenamePostfix =
"" );
98ROSE_DLL_API
void generateAstGraph (
const SgProject* project,
int maxSize = 2000, std::string filenameSuffix =
"" );
113#include "AstDOTGeneration.h"
115template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
120template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
123template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
153 bool frontend_warnings;
155 bool backend_warnings;
163 ROSE_DLL_API
bool get_frontend_notes();
164 ROSE_DLL_API
void set_frontend_notes(
bool flag);
165 ROSE_DLL_API
bool get_frontend_warnings();
166 ROSE_DLL_API
void set_frontend_warnings(
bool flag);
167 ROSE_DLL_API
bool get_backend_notes();
168 ROSE_DLL_API
void set_backend_notes(
bool flag);
169 ROSE_DLL_API
bool get_backend_warnings();
170 ROSE_DLL_API
void set_backend_warnings(
bool flag);
174 ROSE_DLL_API
extern Options global_options;
187 int containsString (
const std::string& masterString,
const std::string& targetString );
190 std::string getFileNameByTraversalBackToFileNode (
const SgNode* astNode );
194 std::string getFileName (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
195 int getLineNumber (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
196 int getColumnNumber (
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
197 bool isPartOfTransformation(
SgLocatedNode* locatedNodePointer ) ROSE_DEPRECATED_FUNCTION;
199 ROSE_DLL_API std::string getWorkingDirectory ();
203 ROSE_DLL_API std::string utility_stripPathFromFileName (
const std::string& fileNameWithPath );
221 ROSE_DLL_API
void usage (
int status);
223 void filterInputFile (
const std::string inputFileName,
const std::string outputFileName );
233 extern std::map<int,std::map<SgNode*,TokenStreamSequenceToNodeMapping*>* > tokenSubsequenceMapOfMaps;
236 extern std::map<SgSourceFile*,std::map<SgNode*,TokenStreamSequenceToNodeMapping*>* > tokenSubsequenceMapOfMapsBySourceFile;
240 extern std::map<SgSourceFile*,std::map<SgScopeStatement*,std::pair<SgStatement*,SgStatement*> > > firstAndLastStatementsToUnparseInScopeMapBySourceFile;
245 extern std::map<int,std::map<SgStatement*,FrontierNode*>*> frontierNodesMapOfMaps;
249 extern std::map<int,std::map<SgNode*,PreviousAndNextNodeData*>*> previousAndNextNodeMapOfMaps;
254 extern std::map<int,std::multimap<int,SgStatement*>*> redundantlyMappedTokensToStatementMapOfMultimaps;
255 extern std::map<int,std::set<int>*> redundantTokenEndingsMapOfSets;
259 extern std::map<int,std::map<SgScopeStatement*,SgStatement*>*> representativeWhitespaceStatementMapOfMaps;
263 extern std::map<int,std::map<SgStatement*,MacroExpansion*>*> macroExpansionMapOfMaps;
266 extern std::map<std::string, SgIncludeFile*> includeFileMapForUnparsing;
275 void initDiagnostics();
293 extern bool is_Ada_language;
294 extern bool is_C_language;
295 extern bool is_Cobol_language;
296 extern bool is_OpenMP_language;
297 extern bool is_UPC_language;
298 extern bool is_UPC_dynamic_threads;
299 extern bool is_C99_language;
300 extern bool is_Cxx_language;
301 extern bool is_Java_language;
302 extern bool is_Jvm_language;
303 extern bool is_Jovial_language;
304 extern bool is_Fortran_language;
305 extern bool is_CAF_language;
306 extern bool is_PHP_language;
307 extern bool is_Python_language;
308 extern bool is_Cuda_language;
309 extern bool is_OpenCL_language;
310 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