Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public extension Driver {
}

try commandLine.appendLast(.clangIncludeTree, from: &parsedOptions)
try commandLine.appendLast(.clangScannerModuleCachePath, from: &parsedOptions)

// Pass on the input files
commandLine.append(contentsOf: inputFiles.filter { $0.type == .swift }.map { .path($0.file) })
Expand Down
2 changes: 2 additions & 0 deletions Sources/SwiftOptions/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ extension Option {
public static let clangHeaderExposeModule: Option = Option("-clang-header-expose-module", .separate, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "<imported-module-name>=<generated-header-name>", helpText: "Allow the compiler to assume that APIs from the specified module are exposed to C/C++/Objective-C in another generated header, so that APIs in the current module that depend on declarations from the specified module can be exposed in the generated header.")
public static let clangIncludeTreeRoot: Option = Option("-clang-include-tree-root", .separate, attributes: [.helpHidden, .frontend, .noDriver], metaVar: "<cas-id>", helpText: "Clang Include Tree CASID")
public static let clangIncludeTree: Option = Option("-clang-include-tree", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Use clang include tree")
public static let clangScannerModuleCachePath: Option = Option("-clang-scanner-module-cache-path", .separate, attributes: [.frontend, .doesNotAffectIncrementalBuild, .argumentIsPath], helpText: "Specifies the Clang dependency scanner module cache path")
public static let clangTarget: Option = Option("-clang-target", .separate, attributes: [.frontend], helpText: "Separately set the target we should use for internal Clang instance")
public static let codeCompleteCallPatternHeuristics: Option = Option("-code-complete-call-pattern-heuristics", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Use heuristics to guess whether we want call pattern completions")
public static let codeCompleteInitsInPostfixExpr: Option = Option("-code-complete-inits-in-postfix-expr", .flag, attributes: [.helpHidden, .frontend, .noDriver], helpText: "Include initializers when completing a postfix expression")
Expand Down Expand Up @@ -867,6 +868,7 @@ extension Option {
Option.clangHeaderExposeModule,
Option.clangIncludeTreeRoot,
Option.clangIncludeTree,
Option.clangScannerModuleCachePath,
Option.clangTarget,
Option.codeCompleteCallPatternHeuristics,
Option.codeCompleteInitsInPostfixExpr,
Expand Down
22 changes: 22 additions & 0 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,28 @@ final class ExplicitModuleBuildTests: XCTestCase {
}
}

/// Test that the scanner invocation does not rely in response files
func testDependencyScanningSeparateClangScanCache() throws {
try withTemporaryDirectory { path in
let scannerCachePath: AbsolutePath = path.appending(component: "ClangScannerCache")
let moduleCachePath: AbsolutePath = path.appending(component: "ModuleCache")
let main = path.appending(component: "testDependencyScanningSeparateClangScanCache.swift")
let sdkArgumentsForTesting = (try? Driver.sdkArgumentsForTesting()) ?? []
var driver = try Driver(args: ["swiftc",
"-explicit-module-build",
"-clang-scanner-module-cache-path",
scannerCachePath.nativePathString(escaped: true),
"-module-cache-path",
moduleCachePath.nativePathString(escaped: true),
"-working-directory", path.nativePathString(escaped: true),
main.nativePathString(escaped: true)] + sdkArgumentsForTesting,
env: ProcessEnv.vars)
let scannerJob = try driver.dependencyScanningJob()
XCTAssertTrue(scannerJob.commandLine.contains(subsequence: [.flag("-clang-scanner-module-cache-path"),
.path(.absolute(scannerCachePath))]))
}
}

func testDependencyScanningFailure() throws {
let (stdlibPath, shimsPath, toolchain, _) = try getDriverArtifactsForScanning()

Expand Down