@@ -188,9 +188,10 @@ extension Driver {
188188 }
189189 }
190190
191- try commandLine. appendAll ( . I, from: & parsedOptions)
192- try commandLine. appendAll ( . F, . Fsystem, from: & parsedOptions)
193- try commandLine. appendAll ( . vfsoverlay, from: & parsedOptions)
191+ // TODO: Can we drop all search paths for compile jobs for explicit module build?
192+ try addAllArgumentsWithPath ( . I, to: & commandLine, remap: jobNeedPathRemap)
193+ try addAllArgumentsWithPath ( . F, . Fsystem, to: & commandLine, remap: jobNeedPathRemap)
194+ try addAllArgumentsWithPath ( . vfsoverlay, to: & commandLine, remap: jobNeedPathRemap)
194195
195196 if let gccToolchain = parsedOptions. getLastArgument ( . gccToolchain) {
196197 appendXccFlag ( " --gcc-toolchain= \( gccToolchain. asSingle) " )
@@ -247,8 +248,8 @@ extension Driver {
247248 commandLine. appendFlag ( " -sample-profile-use-profi " )
248249 }
249250 try commandLine. appendAllExcept (
250- includeList: [ . warningTreating] ,
251- excludeList: [ ] ,
251+ includeList: [ . warningTreating] ,
252+ excludeList: [ ] ,
252253 from: & parsedOptions
253254 )
254255 try commandLine. appendLast ( . sanitizeEQ, from: & parsedOptions)
@@ -350,9 +351,9 @@ extension Driver {
350351 }
351352
352353 if isFrontendArgSupported ( . blockListFile) {
353- try Driver . findBlocklists ( RelativeTo : try toolchain . executableDir ) . forEach {
354+ try findBlocklists ( ) . forEach {
354355 commandLine. appendFlag ( . blockListFile)
355- commandLine . appendPath ( $0)
356+ try addPathArgument ( VirtualPath . absolute ( $0) , to : & commandLine )
356357 }
357358 }
358359
@@ -1012,15 +1013,20 @@ extension Driver {
10121013 }
10131014
10141015 public mutating func addPathOption( option: Option , path: VirtualPath , to commandLine: inout [ Job . ArgTemplate ] , remap: Bool = true ) throws {
1015- commandLine. appendFlag ( option)
1016- let needRemap = remap && option. attributes. contains ( . argumentIsPath) &&
1016+ let needRemap = remap && isCachingEnabled && option. attributes. contains ( . argumentIsPath) &&
10171017 !option. attributes. contains ( . cacheInvariant)
1018- try addPathArgument ( path, to: & commandLine, remap: needRemap)
1018+ let commandPath = needRemap ? remapPath ( path) : path
1019+ if option. kind == . joined {
1020+ commandLine. append ( . joinedOptionAndPath( option. spelling, commandPath) )
1021+ } else {
1022+ // All other kinds that involves a path can be added as separated args.
1023+ commandLine. appendFlag ( option)
1024+ commandLine. appendPath ( commandPath)
1025+ }
10191026 }
10201027
10211028 /// Helper function to add last argument with path to command-line.
10221029 public mutating func addLastArgumentWithPath( _ options: Option ... ,
1023- from parsedOptions: inout ParsedOptions ,
10241030 to commandLine: inout [ Job . ArgTemplate ] ,
10251031 remap: Bool = true ) throws {
10261032 guard let parsedOption = parsedOptions. last ( for: options) else {
@@ -1031,7 +1037,6 @@ extension Driver {
10311037
10321038 /// Helper function to add all arguments with path to command-line.
10331039 public mutating func addAllArgumentsWithPath( _ options: Option ... ,
1034- from parsedOptions: inout ParsedOptions ,
10351040 to commandLine: inout [ Job . ArgTemplate ] ,
10361041 remap: Bool ) throws {
10371042 for matching in parsedOptions. arguments ( for: options) {
0 commit comments