本文整理汇总了C++中SgProject::compileOutput方法的典型用法代码示例。如果您正苦于以下问题:C++ SgProject::compileOutput方法的具体用法?C++ SgProject::compileOutput怎么用?C++ SgProject::compileOutput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SgProject
的用法示例。
在下文中一共展示了SgProject::compileOutput方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: myTraversal
int
main( int argc, char * argv[] )
{
// This test code demonstrates the differences between an ordinary
// SgTopDownBottomUpProcessing traversal and a traversal using the
// AST Rewrite Mechanism.
// DQ (4/6/2017): This will not fail if we skip calling ROSE_INITIALIZE (but
// any warning message using the message looging feature in ROSE will fail).
ROSE_INITIALIZE;
ios::sync_with_stdio(); // Syncs C++ and C I/O subsystems!
if (argc == 1)
{
// Print usage and exit with exit status == 1
rose::usage (1);
}
// Build the project object which we will fill up with multiple files and use as a
// handle for all processing of the AST(s) associated with one or more source files.
int EDG_FrontEndErrorCode = 0;
SgProject* sageProject = new SgProject(argc,argv,EDG_FrontEndErrorCode);
// Warnings from EDG processing are OK but not errors
ROSE_ASSERT (EDG_FrontEndErrorCode <= 3);
cout << "EDG/SAGE Processing DONE! (manipulate with ROSE ...) " << endl;
// Output the source code file (as represented by the SAGE AST) as a PDF file (with bookmarks)
AstPDFGeneration pdftest;
pdftest.generateInputFiles(sageProject);
// Build the inherited attribute
MyInheritedAttribute inheritedAttribute;
// The traversal uses the AST rewrite mechanism which requires the SgProject object to retrive the
// command line for compilation of the intermeditate files (from strings to AST fragments) before
// patching them into the application's AST.
MyTraversal myTraversal(*sageProject);
// Call the traversal starting at the sageProject node of the AST
myTraversal.traverseInputFiles(sageProject,inheritedAttribute);
// Generate the final C++ source code from the potentially modified SAGE AST
sageProject->unparse();
cout << "Generation of final source code (unparsing) DONE! (compile ...) " << endl;
// What remains is to run the specified compiler (typically the C++ compiler) using
// the generated output file (unparsed and transformed application code) to generate
// an object file.
int finalCombinedExitStatus = sageProject->compileOutput();
printf ("Program Compiled Normally (exit status = %d)! \n\n\n\n",finalCombinedExitStatus);
return finalCombinedExitStatus;
}
示例2: PrintUsage
int
main ( int argc, char * argv[] )
{
// Initialize and check compatibility. See rose::initialize
ROSE_INITIALIZE;
if (argc <= 1) {
PrintUsage(argv[0]);
return -1;
}
vector<string> argvList(argv, argv + argc);
CmdOptions::GetInstance()->SetOptions(argvList);
AssumeNoAlias aliasInfo;
LoopTransformInterface::cmdline_configure(argvList);
LoopTransformInterface::set_aliasInfo(&aliasInfo);
#ifdef USE_OMEGA
DepStats.SetFileName(buffer.str());
#endif
OperatorSideEffectAnnotation *funcInfo =
OperatorSideEffectAnnotation::get_inst();
funcInfo->register_annot();
ReadAnnotation::get_inst()->read();
if (DebugAnnot())
funcInfo->Dump();
LoopTransformInterface::set_sideEffectInfo(funcInfo);
SgProject *project = new SgProject ( argvList);
int filenum = project->numberOfFiles();
for (int i = 0; i < filenum; ++i) {
// SgFile &sageFile = sageProject->get_file(i);
// SgGlobal *root = sageFile.get_root();
SgSourceFile* file = isSgSourceFile(project->get_fileList()[i]);
SgGlobal *root = file->get_globalScope();
SgDeclarationStatementPtrList& declList = root->get_declarations ();
for (SgDeclarationStatementPtrList::iterator p = declList.begin(); p != declList.end(); ++p) {
SgFunctionDeclaration *func = isSgFunctionDeclaration(*p);
if (func == 0)
continue;
SgFunctionDefinition *defn = func->get_definition();
if (defn == 0)
continue;
SgBasicBlock *stmts = defn->get_body();
AstInterfaceImpl faImpl = AstInterfaceImpl(stmts);
LoopTransformInterface::TransformTraverse(faImpl, AstNodePtrImpl(stmts));
// JJW 10-29-2007 Adjust for iterator invalidation and possible changes to declList
p = std::find(declList.begin(), declList.end(), func);
assert (p != declList.end());
}
}
if (CmdOptions::GetInstance()->HasOption("-fd")) {
simpleIndexFiniteDifferencing(project);
}
if (CmdOptions::GetInstance()->HasOption("-pre")) {
PRE::partialRedundancyElimination(project);
}
#ifdef USE_OMEGA
DepStats.SetDepChoice(0x1 | 0x2 | 0x4);
DepStats.PrintResults();
#endif
//Qing's loop transformations are not robust enough to pass all tests.
//AstTests::runAllTests(sageProject);
unparseProject(project);
if (GenerateObj())
return project->compileOutput();
return 0;
}