3 #ifndef UTILITY_FUNCTIONS_H
4 #define UTILITY_FUNCTIONS_H
6 #include "Cxx_Grammar.h"
9 #define BACKEND_VERBOSE_LEVEL 2
13 std::string version_message();
17 std::string version_number();
20 unsigned int rose_boost_version_id();
23 std::string rose_boost_version_path();
27 void outputPredefinedMacros();
32 ROSE_DLL_API
SgProject* frontend (
int argc,
char** argv,
bool frontendConstantFolding =
false );
33 ROSE_DLL_API
SgProject* frontend (
const std::vector<std::string>& argv,
bool frontendConstantFolding =
false );
47 SgProject* frontendShell (
int argc,
char** argv);
48 ROSE_DLL_API
SgProject* frontendShell (
const std::vector<std::string>& argv);
57 ROSE_DLL_API
int backend (
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL, UnparseDelegate* unparseDelegate = NULL );
62 ROSE_DLL_API
int backendCompilesUsingOriginalInputFile (
SgProject* project,
bool compile_with_USE_ROSE_macro =
false );
70 ROSE_DLL_API
int backendGeneratesSourceCodeButCompilesUsingOriginalInputFile (
SgProject* project );
75 ROSE_DLL_API
int copy_backend(
SgProject* project, UnparseFormatHelp *unparseFormatHelp = NULL );
81 ROSE_DLL_API
void generatePDF (
const SgProject & project );
84 ROSE_DLL_API
void generateDOT (
const SgProject & project, std::string filenamePostfix =
"",
bool excludeTemplateInstantiations =
false );
89 ROSE_DLL_API
void generateDOT (
SgNode* node, std::string filename );
93 ROSE_DLL_API
void generateDOT_withIncludes (
const SgProject & project, std::string filenamePostfix =
"" );
94 ROSE_DLL_API
void generateDOTforMultipleFile (
const SgProject & project, std::string filenamePostfix =
"" );
98 ROSE_DLL_API
void generateAstGraph (
const SgProject* project,
int maxSize = 2000, std::string filenameSuffix =
"" );
113 #include "AstDOTGeneration.h"
115 template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
120 template <
typename ExtraNodeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeInfo,
typename ExtraNodeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraNodeOptions,
typename ExtraEdgeInfo_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeInfo,
typename ExtraEdgeOptions_t = AstDOTGenerationExtended_Defaults::DefaultExtraEdgeOptions>
123 template <
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;
241 extern std::map<int,std::map<SgStatement*,FrontierNode*>*> frontierNodesMapOfMaps;
245 extern std::map<int,std::map<SgNode*,PreviousAndNextNodeData*>*> previousAndNextNodeMapOfMaps;
250 extern std::map<int,std::multimap<int,SgStatement*>*> redundantlyMappedTokensToStatementMapOfMultimaps;
251 extern std::map<int,std::set<int>*> redundantTokenEndingsMapOfSets;
255 extern std::map<int,std::map<SgScopeStatement*,SgStatement*>*> representativeWhitespaceStatementMapOfMaps;
259 extern std::map<int,std::map<SgStatement*,MacroExpansion*>*> macroExpansionMapOfMaps;
262 extern std::map<std::string, SgIncludeFile*> includeFileMapForUnparsing;
267 void initDiagnostics();
286 extern bool is_OpenMP_language;
287 extern bool is_UPC_language;
288 extern bool is_UPC_dynamic_threads;
289 extern bool is_C99_language;
290 extern bool is_Cxx_language;
291 extern bool is_Fortran_language;
292 extern bool is_CAF_language;
293 extern bool is_Cuda_language;
294 extern bool is_OpenCL_language;
301 #endif // ifndef UTILITY_FUNCTIONS_H