本文整理汇总了C++中ModuleDecl::isSystemModule方法的典型用法代码示例。如果您正苦于以下问题:C++ ModuleDecl::isSystemModule方法的具体用法?C++ ModuleDecl::isSystemModule怎么用?C++ ModuleDecl::isSystemModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleDecl
的用法示例。
在下文中一共展示了ModuleDecl::isSystemModule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addModuleDependencies
static void addModuleDependencies(ArrayRef<ModuleDecl::ImportedModule> imports,
StringRef indexStorePath,
bool indexSystemModules,
StringRef targetTriple,
const clang::CompilerInstance &clangCI,
DiagnosticEngine &diags,
IndexUnitWriter &unitWriter,
StringScratchSpace &moduleNameScratch) {
auto &fileMgr = clangCI.getFileManager();
for (auto &import : imports) {
ModuleDecl *mod = import.second;
if (mod->isOnoneSupportModule())
continue; // ignore the Onone support library.
if (mod->isSwiftShimsModule())
continue;
for (auto *FU : mod->getFiles()) {
switch (FU->getKind()) {
case FileUnitKind::Source:
case FileUnitKind::Builtin:
break;
case FileUnitKind::SerializedAST:
case FileUnitKind::DWARFModule:
case FileUnitKind::ClangModule: {
auto *LFU = cast<LoadedFile>(FU);
if (auto *F = fileMgr.getFile(LFU->getFilename())) {
std::string moduleName = mod->getNameStr();
bool withoutUnitName = true;
if (FU->getKind() == FileUnitKind::ClangModule) {
withoutUnitName = false;
auto clangModUnit = cast<ClangModuleUnit>(LFU);
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
moduleName = clangMod->getTopLevelModuleName();
// FIXME: clang's -Rremarks do not seem to go through Swift's
// diagnostic emitter.
clang::index::emitIndexDataForModuleFile(clangMod,
clangCI, unitWriter);
}
} else {
// Serialized AST file.
// Only index system modules (essentially stdlib and overlays).
// We don't officially support binary swift modules, so normally
// the index data for user modules would get generated while
// building them.
if (mod->isSystemModule() && indexSystemModules) {
emitDataForSwiftSerializedModule(mod, indexStorePath,
indexSystemModules,
targetTriple, clangCI, diags,
unitWriter);
withoutUnitName = false;
}
}
clang::index::writer::OpaqueModule opaqMod =
moduleNameScratch.createString(moduleName);
unitWriter.addASTFileDependency(F, mod->isSystemModule(), opaqMod,
withoutUnitName);
}
break;
}
}
}
}
}