本文整理汇总了C++中ModuleDecl::setHasResolvedImports方法的典型用法代码示例。如果您正苦于以下问题:C++ ModuleDecl::setHasResolvedImports方法的具体用法?C++ ModuleDecl::setHasResolvedImports怎么用?C++ ModuleDecl::setHasResolvedImports使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleDecl
的用法示例。
在下文中一共展示了ModuleDecl::setHasResolvedImports方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: indexModule
static void indexModule(llvm::MemoryBuffer *Input,
StringRef ModuleName,
StringRef Hash,
IndexingConsumer &IdxConsumer,
CompilerInstance &CI,
ArrayRef<const char *> Args) {
ASTContext &Ctx = CI.getASTContext();
std::unique_ptr<SerializedModuleLoader> Loader;
ModuleDecl *Mod = nullptr;
if (ModuleName == Ctx.StdlibModuleName.str()) {
Mod = Ctx.getModule({ {Ctx.StdlibModuleName, SourceLoc()} });
} else {
Loader = SerializedModuleLoader::create(Ctx);
auto Buf = std::unique_ptr<llvm::MemoryBuffer>(
llvm::MemoryBuffer::getMemBuffer(Input->getBuffer(),
Input->getBufferIdentifier()));
// FIXME: These APIs allocate memory on the ASTContext, meaning it may not
// be freed for a long time.
Mod = ModuleDecl::create(Ctx.getIdentifier(ModuleName), Ctx);
// Indexing is not using documentation now, so don't open the module
// documentation file.
// FIXME: refactor the frontend to provide an easy way to figure out the
// correct filename here.
auto FUnit = Loader->loadAST(*Mod, None, std::move(Buf), nullptr);
// FIXME: Not knowing what went wrong is pretty bad. loadModule() should be
// more modular, rather than emitting diagnostics itself.
if (!FUnit) {
IdxConsumer.failed("failed to load module");
return;
}
Mod->setHasResolvedImports();
}
// Setup a typechecker for protocol conformance resolving.
(void)createTypeChecker(Ctx);
SKIndexDataConsumer IdxDataConsumer(IdxConsumer);
index::indexModule(Mod, Hash, IdxDataConsumer);
}