Skip to content

Commit ccdd620

Browse files
committed
[SourceKit] Don’t set DisableModulesValidateSystemDependencies to true
It appears that swiftlang/llvm-project@a6ebd30 changed the behavior of `-fno-modules-validate-system-headers` (aka. `DisableModulesValidateSystemDependencies`) in conjunction with `-fmodules-validate-once-per-build-session`: Before that change, `-fno-modules-validate-system-headers` needed to be passed for `-fmodules-validate-once-per-build-session` to have any effect (we were always validating system dependencies if `-fno-modules-validate-once-per-build-session` was not set). After the change, `-fno-modules-validate-once-per-build-session` causes system dependencies to never be validated, independent of the build session timestamp. This change should have no effect on Xcode because it adds `-fmodules-validate-system-headers` to the compiler arguments for Swift files, which overrides `SearchPathOpts.DisableModulesValidateSystemDependencies = true;`
1 parent f3d4969 commit ccdd620

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

lib/IDETool/CompilerInvocation.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ bool ide::initCompilerInvocation(
256256
std::to_string(sessionTimestamp - 1));
257257
ImporterOpts.ExtraArgs.push_back(
258258
"-fmodules-validate-once-per-build-session");
259-
260-
SearchPathOpts.DisableModulesValidateSystemDependencies = true;
261259
}
262260

263261
// Disable expensive SIL options to reduce time spent in SILGen.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
// RUN: %sourcekitd-test -req=diags %t/test.swift -- %t/test.swift -Xcc -fmodule-map-file=%t/module.modulemap -module-cache-path %t/module-cache | %FileCheck %s
4+
// Sleep for 1 second so that touching the modulemap modifies its timestamp on the second level.
5+
// RUN: sleep 1
6+
// RUN: touch %t/module.modulemap
7+
// RUN: %sourcekitd-test -req=diags %t/test.swift -- %t/test.swift -Xcc -fmodule-map-file=%t/module.modulemap -module-cache-path %t/module-cache | %FileCheck %s
8+
9+
// CHECK: 'guard' body must not fall through
10+
11+
//--- test.swift
12+
13+
import Lib
14+
15+
func test(value: Bool) {
16+
guard value else {
17+
18+
}
19+
}
20+
21+
//--- module.modulemap
22+
23+
module Lib [system] {
24+
export *
25+
}

0 commit comments

Comments
 (0)