本文整理汇总了C++中cl::opt::append方法的典型用法代码示例。如果您正苦于以下问题:C++ opt::append方法的具体用法?C++ opt::append怎么用?C++ opt::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cl::opt
的用法示例。
在下文中一共展示了opt::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv, char **envp) {
// Print a stack trace if we signal out.
sys::PrintStackTraceOnErrorSignal();
PrettyStackTraceProgram X(argc, argv);
LLVMContext &Context = getGlobalContext();
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
// Initialize passes
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeCore(Registry);
initializeScalarOpts(Registry);
initializeIPO(Registry);
initializeAnalysis(Registry);
initializeIPA(Registry);
initializeTransformUtils(Registry);
initializeInstCombine(Registry);
initializeTarget(Registry);
// Initial global variable above for convenience printing of program name.
progname = sys::path::stem(argv[0]);
// Parse the command line options
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
#if defined(_WIN32) || defined(__CYGWIN__)
if (!LinkAsLibrary) {
// Default to "a.exe" instead of "a.out".
if (OutputFilename.getNumOccurrences() == 0)
OutputFilename = "a.exe";
// If there is no suffix add an "exe" one.
if (sys::path::extension(OutputFilename).empty())
OutputFilename.append(".exe");
}
#endif
// Generate the bitcode for the optimized module.
// If -b wasn't specified, use the name specified
// with -o to construct BitcodeOutputFilename.
if (BitcodeOutputFilename.empty()) {
BitcodeOutputFilename = OutputFilename;
if (!LinkAsLibrary) BitcodeOutputFilename += ".bc";
}
// Arrange for the bitcode output file to be deleted on any errors.
BitcodeOutputRemover.setFile(BitcodeOutputFilename);
sys::RemoveFileOnSignal(sys::Path(BitcodeOutputFilename));
// Arrange for the output file to be deleted on any errors.
if (!LinkAsLibrary) {
OutputRemover.setFile(OutputFilename);
sys::RemoveFileOnSignal(sys::Path(OutputFilename));
}
// Construct a Linker (now that Verbose is set)
Linker TheLinker(progname, OutputFilename, Context, Verbose);
// Keep track of the native link items (versus the bitcode items)
Linker::ItemList NativeLinkItems;
// Add library paths to the linker
TheLinker.addPaths(LibPaths);
TheLinker.addSystemPaths();
// Remove any consecutive duplicates of the same library...
Libraries.erase(std::unique(Libraries.begin(), Libraries.end()),
Libraries.end());
if (LinkAsLibrary) {
std::vector<sys::Path> Files;
for (unsigned i = 0; i < InputFilenames.size(); ++i )
Files.push_back(sys::Path(InputFilenames[i]));
if (TheLinker.LinkInFiles(Files))
return 1; // Error already printed
// The libraries aren't linked in but are noted as "dependent" in the
// module.
for (cl::list<std::string>::const_iterator I = Libraries.begin(),
E = Libraries.end(); I != E ; ++I) {
TheLinker.getModule()->addLibrary(*I);
}
} else {
// Build a list of the items from our command line
Linker::ItemList Items;
BuildLinkItems(Items, InputFilenames, Libraries);
// Link all the items together
if (TheLinker.LinkInItems(Items, NativeLinkItems) )
return 1; // Error already printed
}
std::auto_ptr<Module> Composite(TheLinker.releaseModule());
// Optimize the module
Optimize(Composite.get());
// Generate the bitcode output.
GenerateBitcode(Composite.get(), BitcodeOutputFilename);
//.........这里部分代码省略.........