@@ -188,9 +188,10 @@ extension Driver {
188
188
}
189
189
}
190
190
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)
194
195
195
196
if let gccToolchain = parsedOptions. getLastArgument ( . gccToolchain) {
196
197
appendXccFlag ( " --gcc-toolchain= \( gccToolchain. asSingle) " )
@@ -247,8 +248,8 @@ extension Driver {
247
248
commandLine. appendFlag ( " -sample-profile-use-profi " )
248
249
}
249
250
try commandLine. appendAllExcept (
250
- includeList: [ . warningTreating] ,
251
- excludeList: [ ] ,
251
+ includeList: [ . warningTreating] ,
252
+ excludeList: [ ] ,
252
253
from: & parsedOptions
253
254
)
254
255
try commandLine. appendLast ( . sanitizeEQ, from: & parsedOptions)
@@ -350,9 +351,9 @@ extension Driver {
350
351
}
351
352
352
353
if isFrontendArgSupported ( . blockListFile) {
353
- try Driver . findBlocklists ( RelativeTo : try toolchain . executableDir ) . forEach {
354
+ try findBlocklists ( ) . forEach {
354
355
commandLine. appendFlag ( . blockListFile)
355
- commandLine . appendPath ( $0)
356
+ try addPathArgument ( VirtualPath . absolute ( $0) , to : & commandLine )
356
357
}
357
358
}
358
359
@@ -1012,15 +1013,20 @@ extension Driver {
1012
1013
}
1013
1014
1014
1015
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) &&
1017
1017
!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
+ }
1019
1026
}
1020
1027
1021
1028
/// Helper function to add last argument with path to command-line.
1022
1029
public mutating func addLastArgumentWithPath( _ options: Option ... ,
1023
- from parsedOptions: inout ParsedOptions ,
1024
1030
to commandLine: inout [ Job . ArgTemplate ] ,
1025
1031
remap: Bool = true ) throws {
1026
1032
guard let parsedOption = parsedOptions. last ( for: options) else {
@@ -1031,7 +1037,6 @@ extension Driver {
1031
1037
1032
1038
/// Helper function to add all arguments with path to command-line.
1033
1039
public mutating func addAllArgumentsWithPath( _ options: Option ... ,
1034
- from parsedOptions: inout ParsedOptions ,
1035
1040
to commandLine: inout [ Job . ArgTemplate ] ,
1036
1041
remap: Bool ) throws {
1037
1042
for matching in parsedOptions. arguments ( for: options) {
0 commit comments