Skip to content

Commit 65062c9

Browse files
committed
Capture the proper module name even if the module indexing is disabled
1 parent 63c88b9 commit 65062c9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Index/IndexRecord.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,15 +426,15 @@ static void addModuleDependencies(ArrayRef<ImportedModule> imports,
426426
bool withoutUnitName = true;
427427
if (FU->getKind() == FileUnitKind::ClangModule) {
428428
auto clangModUnit = cast<ClangModuleUnit>(LFU);
429-
if ((!clangModUnit->isSystemModule() || indexSystemModules)
430-
&& indexClangModules) {
431-
withoutUnitName = false;
429+
if ((!clangModUnit->isSystemModule() || indexSystemModules)) {
430+
withoutUnitName = !indexClangModules;
432431
if (auto clangMod = clangModUnit->getUnderlyingClangModule()) {
433432
moduleName = clangMod->getTopLevelModuleName();
434433
// FIXME: clang's -Rremarks do not seem to go through Swift's
435434
// diagnostic emitter.
436-
clang::index::emitIndexDataForModuleFile(clangMod,
437-
clangCI, unitWriter);
435+
if (indexClangModules)
436+
clang::index::emitIndexDataForModuleFile(clangMod,
437+
clangCI, unitWriter);
438438
}
439439
}
440440
} else {

test/Index/Store/unit-pcm-dependency.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func test() {
6868
// FILE1-PCM: Unit | user | ClangModuleB | {{.*}}ClangModuleB-{{[A-Z0-9]*}}.pcm | ClangModuleB-{{[A-Z0-9]*}}.pcm-
6969
// FILE1-PCM: Unit | user | ClangModuleC | {{.*}}ClangModuleC-{{[A-Z0-9]*}}.pcm | ClangModuleC-{{[A-Z0-9]*}}.pcm-
7070
// FILE1-IGNORE: Unit | user | ClangModuleB | {{.*}}ClangModuleB-{{[A-Z0-9]*}}.pcm
71-
// FILE1-IGNORE: Unit | user | Sub1 | {{.*}}ClangModuleC-{{[A-Z0-9]*}}.pcm
71+
// FILE1-IGNORE: Unit | user | ClangModuleC | {{.*}}ClangModuleC-{{[A-Z0-9]*}}.pcm
7272
// FILE1-NOT: Unit |{{.*}}ClangModuleA
7373
// FILE1: Record | user | {{.*}}unit-pcm-dependency.swift | unit-pcm-dependency.swift-
7474
// FILE1-NOT: Unit |{{.*}}ClangModuleA

0 commit comments

Comments
 (0)