Skip to content

Commit 4e227f8

Browse files
committed
[Index] Apply -index-ignore-system-modules to clang modules
1 parent a4d182c commit 4e227f8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/Index/IndexRecord.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,16 @@ static void addModuleDependencies(ArrayRef<ModuleDecl::ImportedModule> imports,
416416
StringRef moduleName = mod->getNameStr();
417417
bool withoutUnitName = true;
418418
if (FU->getKind() == FileUnitKind::ClangModule) {
419-
withoutUnitName = false;
420419
auto clangModUnit = cast<ClangModuleUnit>(LFU);
421-
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
422-
moduleName = clangMod->getTopLevelModuleName();
423-
// FIXME: clang's -Rremarks do not seem to go through Swift's
424-
// diagnostic emitter.
425-
clang::index::emitIndexDataForModuleFile(clangMod,
426-
clangCI, unitWriter);
420+
if (!clangModUnit->isSystemModule() || indexSystemModules) {
421+
withoutUnitName = false;
422+
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
423+
moduleName = clangMod->getTopLevelModuleName();
424+
// FIXME: clang's -Rremarks do not seem to go through Swift's
425+
// diagnostic emitter.
426+
clang::index::emitIndexDataForModuleFile(clangMod,
427+
clangCI, unitWriter);
428+
}
427429
}
428430
} else {
429431
// Serialized AST file.

0 commit comments

Comments
 (0)