本文整理汇总了C++中llvm::OwningPtr::getJobs方法的典型用法代码示例。如果您正苦于以下问题:C++ OwningPtr::getJobs方法的具体用法?C++ OwningPtr::getJobs怎么用?C++ OwningPtr::getJobs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::OwningPtr
的用法示例。
在下文中一共展示了OwningPtr::getJobs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strcpy
llvm::Module *NodeCompiler::compile(const char *fileName)
{
// Add filename as the last argument of the compiler
char globfilename[512];
strcpy(globfilename, SRC_DIR"/");
strcat(globfilename, fileName);
m_args.push_back(globfilename);
const llvm::OwningPtr<Compilation>
Compilation(
//m_driver->BuildCompilation(llvm::makeArrayRef(m_args)));
m_driver->BuildCompilation(m_args));
// Compilation Job to get the correct arguments
const JobList &Jobs = Compilation->getJobs();
const Command *Cmd = llvm::cast<Command>(*Jobs.begin());
const ArgStringList *const CC1Args = &Cmd->getArguments();
//m_driver->PrintActions(*Compilation);
llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
CompilerInvocation::CreateFromArgs(
*CI, CC1Args->data() + 1, CC1Args->data() + CC1Args->size(), *m_diagEngine);
// Show the invocation, with -v.
// TO debug the -fvectorize issue
//if (CI->getHeaderSearchOpts().Verbose) {
// llvm::errs() << "clang invocation:\n";
// Compilation->PrintJob(llvm::errs(), Jobs, "\n", true);
// llvm::errs() << "\n";
//}
// Create the compiler instance
m_clang->setInvocation(CI.take());
// Diagnostics
m_clang->createDiagnostics();
//m_args.pop_back(); // Remove filename for future compilation
if (!m_clang->hasDiagnostics())
return NULL;
// Emit only llvm code
llvm::Module *mod=NULL;
std::cout << "emitting llvm code" << "\n";
if (!m_clang->ExecuteAction(*m_action)) {
std::cout << "unable to generate llvm code" << "\n";
} else {
mod = m_action->takeModule();
}
std::cout << "code generated\n";
return mod;
}