Also fetch proper module name for system modules

This commit is contained in:
David Goldman
2022-06-02 10:02:01 -04:00
parent 65062c9261
commit b9391289e1

View File

@@ -426,16 +426,16 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
bool withoutUnitName = true;
if (FU->getKind() == FileUnitKind::ClangModule) {
auto clangModUnit = cast<ClangModuleUnit>(LFU);
if ((!clangModUnit->isSystemModule() || indexSystemModules)) {
withoutUnitName = !indexClangModules;
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
moduleName = clangMod->getTopLevelModuleName();
// FIXME: clang's -Rremarks do not seem to go through Swift's
// diagnostic emitter.
if (indexClangModules)
clang::index::emitIndexDataForModuleFile(clangMod,
clangCI, unitWriter);
}
bool shouldIndexModule = indexClangModules &&
(!clangModUnit->isSystemModule() || indexSystemModules);
withoutUnitName = !shouldIndexModule;
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
moduleName = clangMod->getTopLevelModuleName();
// FIXME: clang's -Rremarks do not seem to go through Swift's
// diagnostic emitter.
if (shouldIndexModule)
clang::index::emitIndexDataForModuleFile(clangMod,
clangCI, unitWriter);
}
} else {
// Serialized AST file.