int main(int argc, char **argv) { std::vector<std::string> argvList(argv, argv + argc); //Read the comparison file std::string graphCompareOutput = ""; CommandlineProcessing::isOptionWithParameter(argvList, "-compare:", "(graph)", graphCompareOutput, true); CommandlineProcessing::removeArgsWithParameters(argvList, "-compare:"); //Run frontend SgProject* project = frontend(argvList); ROSE_ASSERT(project != NULL); // Build the callgraph CallGraphBuilder cgb(project); cgb.buildCallGraph(OnlyCurrentDirectory()); if (graphCompareOutput == "") graphCompareOutput = ((project->get_outputFileName()) + ".cg.dmp"); cout << "Writing custom compare to: " << graphCompareOutput << endl; SgIncidenceDirectedGraph *newGraph = cgb.getGraph(); sortedCallGraphDump(graphCompareOutput, newGraph); return 0; }
int main(int argc, char **argv) { // Initialize and check compatibility. See rose::initialize ROSE_INITIALIZE; SgProject *project = frontend(argc, argv); std::string fileName = project->get_outputFileName(); AST_FILE_IO::startUp(project); AST_FILE_IO::writeASTToFile(fileName += ".binary"); std::cout << "done writing AST to " << fileName << "!" << std::endl; }