本文整理汇总了C++中llvm::OwningPtr::getContext方法的典型用法代码示例。如果您正苦于以下问题:C++ OwningPtr::getContext方法的具体用法?C++ OwningPtr::getContext怎么用?C++ OwningPtr::getContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::OwningPtr
的用法示例。
在下文中一共展示了OwningPtr::getContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleTranslationUnit
virtual void HandleTranslationUnit(ASTContext &C) {
{
PrettyStackTraceString CrashInfo("Per-file LLVM IR generation");
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.startTimer();
Gen->HandleTranslationUnit(C);
if (llvm::TimePassesIsEnabled)
LLVMIRGeneration.stopTimer();
}
// Silently ignore if we weren't initialized for some reason.
if (!TheModule)
return;
// Make sure IR generation is happy with the module. This is released by
// the module provider.
Module *M = Gen->ReleaseModule();
if (!M) {
// The module has been released by IR gen on failures, do not double
// free.
TheModule.take();
return;
}
assert(TheModule.get() == M &&
"Unexpected module change during IR generation");
// Install an inline asm handler so that diagnostics get printed through
// our diagnostics hooks.
LLVMContext &Ctx = TheModule->getContext();
LLVMContext::InlineAsmDiagHandlerTy OldHandler =
Ctx.getInlineAsmDiagnosticHandler();
void *OldContext = Ctx.getInlineAsmDiagnosticContext();
Ctx.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler, this);
EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
TheModule.get(), Action, AsmOutStream);
Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
}