@@ -415,7 +415,7 @@ struct ClangModuleVerifierPayload: ClangModuleVerifierPayloadType {
415
415
}
416
416
}
417
417
418
- public struct ClangTaskPayload : ClangModuleVerifierPayloadType , DependencyInfoEditableTaskPayload , Encodable {
418
+ public struct ClangTaskPayload : ClangModuleVerifierPayloadType , DependencyInfoEditableTaskPayload , TaskDependencySettingsPayload , Encodable {
419
419
let dependencyInfoEditPayload : DependencyInfoEditPayload ?
420
420
421
421
/// The path to the serialized diagnostic output. Every clang task must provide this path.
@@ -432,7 +432,9 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
432
432
433
433
public let fileNameMapPath : Path ?
434
434
435
- fileprivate init ( serializedDiagnosticsPath: Path ? , indexingPayload: ClangIndexingPayload ? , explicitModulesPayload: ClangExplicitModulesPayload ? = nil , outputObjectFilePath: Path ? = nil , fileNameMapPath: Path ? = nil , developerPathString: String ? = nil ) {
435
+ public let taskDependencySettings : TaskDependencySettings ?
436
+
437
+ fileprivate init ( serializedDiagnosticsPath: Path ? , indexingPayload: ClangIndexingPayload ? , explicitModulesPayload: ClangExplicitModulesPayload ? = nil , outputObjectFilePath: Path ? = nil , fileNameMapPath: Path ? = nil , developerPathString: String ? = nil , taskDependencySettings: TaskDependencySettings ? = nil ) {
436
438
if let developerPathString, explicitModulesPayload == nil {
437
439
self . dependencyInfoEditPayload = . init( removablePaths: [ ] , removableBasenames: [ ] , developerPath: Path ( developerPathString) )
438
440
} else {
@@ -443,16 +445,18 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
443
445
self . explicitModulesPayload = explicitModulesPayload
444
446
self . outputObjectFilePath = outputObjectFilePath
445
447
self . fileNameMapPath = fileNameMapPath
448
+ self . taskDependencySettings = taskDependencySettings
446
449
}
447
450
448
451
public func serialize< T: Serializer > ( to serializer: T ) {
449
- serializer. serializeAggregate ( 6 ) {
452
+ serializer. serializeAggregate ( 7 ) {
450
453
serializer. serialize ( serializedDiagnosticsPath)
451
454
serializer. serialize ( indexingPayload)
452
455
serializer. serialize ( explicitModulesPayload)
453
456
serializer. serialize ( outputObjectFilePath)
454
457
serializer. serialize ( fileNameMapPath)
455
458
serializer. serialize ( dependencyInfoEditPayload)
459
+ serializer. serialize ( taskDependencySettings)
456
460
}
457
461
}
458
462
@@ -464,6 +468,7 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
464
468
self . outputObjectFilePath = try deserializer. deserialize ( )
465
469
self . fileNameMapPath = try deserializer. deserialize ( )
466
470
self . dependencyInfoEditPayload = try deserializer. deserialize ( )
471
+ self . taskDependencySettings = try deserializer. deserialize ( )
467
472
}
468
473
}
469
474
@@ -1158,6 +1163,24 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
1158
1163
dependencyData = nil
1159
1164
}
1160
1165
1166
+ let taskDependencySettings = TaskDependencySettings (
1167
+ traceFile: Path ( outputNode. path. str + " .trace.json " ) ,
1168
+ dependencySettings: DependencySettings ( cbc. scope)
1169
+ )
1170
+
1171
+ if ( taskDependencySettings. dependencySettings. verification) {
1172
+ commandLine += [
1173
+ " -Xclang " ,
1174
+ " -header-include-file " ,
1175
+ " -Xclang " ,
1176
+ taskDependencySettings. traceFile. str,
1177
+ " -Xclang " ,
1178
+ " -header-include-filtering=only-direct-system " ,
1179
+ " -Xclang " ,
1180
+ " -header-include-format=json "
1181
+ ]
1182
+ }
1183
+
1161
1184
// Add the diagnostics serialization flag. We currently place the diagnostics file right next to the output object file.
1162
1185
let diagFilePath : Path ?
1163
1186
if let serializedDiagnosticsOptions = self . serializedDiagnosticsOptions ( scope: cbc. scope, outputPath: outputNode. path) {
@@ -1268,7 +1291,8 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
1268
1291
explicitModulesPayload: explicitModulesPayload,
1269
1292
outputObjectFilePath: shouldGenerateRemarks ? outputNode. path : nil ,
1270
1293
fileNameMapPath: verifierPayload? . fileNameMapPath,
1271
- developerPathString: recordSystemHeaderDepsOutsideSysroot ? cbc. scope. evaluate ( BuiltinMacros . DEVELOPER_DIR) . str : nil
1294
+ developerPathString: recordSystemHeaderDepsOutsideSysroot ? cbc. scope. evaluate ( BuiltinMacros . DEVELOPER_DIR) . str : nil ,
1295
+ taskDependencySettings: taskDependencySettings
1272
1296
)
1273
1297
1274
1298
var inputNodes : [ any PlannedNode ] = inputDeps. map { delegate. createNode ( $0) }
@@ -1318,8 +1342,10 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
1318
1342
extraInputs = [ ]
1319
1343
}
1320
1344
1345
+ additionalSignatureData += taskDependencySettings. signatureData ( )
1346
+
1321
1347
// Finally, create the task.
1322
- delegate. createTask ( type: self , dependencyData: dependencyData, payload: payload, ruleInfo: ruleInfo, additionalSignatureData: additionalSignatureData, commandLine: commandLine, additionalOutput: additionalOutput, environment: environmentBindings, workingDirectory: compilerWorkingDirectory ( cbc) , inputs: inputNodes + extraInputs, outputs: [ outputNode] , action: action ?? delegate. taskActionCreationDelegate. createDeferredExecutionTaskActionIfRequested ( userPreferences : cbc . producer . userPreferences ) , execDescription: resolveExecutionDescription ( cbc, delegate) , enableSandboxing: enableSandboxing, additionalTaskOrderingOptions: [ . compilationForIndexableSourceFile] , usesExecutionInputs: usesExecutionInputs, showEnvironment: true , priority: . preferred)
1348
+ delegate. createTask ( type: self , dependencyData: dependencyData, payload: payload, ruleInfo: ruleInfo, additionalSignatureData: additionalSignatureData, commandLine: commandLine, additionalOutput: additionalOutput, environment: environmentBindings, workingDirectory: compilerWorkingDirectory ( cbc) , inputs: inputNodes + extraInputs, outputs: [ outputNode] , action: action ?? delegate. taskActionCreationDelegate. createClangNonModularCompileTaskAction ( ) , execDescription: resolveExecutionDescription ( cbc, delegate) , enableSandboxing: enableSandboxing, additionalTaskOrderingOptions: [ . compilationForIndexableSourceFile] , usesExecutionInputs: usesExecutionInputs, showEnvironment: true , priority: . preferred)
1323
1349
1324
1350
// If the object file verifier is enabled and we are building with explicit modules, also create a job to produce adjacent objects using implicit modules, then compare the results.
1325
1351
if cbc. scope. evaluate ( BuiltinMacros . CLANG_ENABLE_EXPLICIT_MODULES_OBJECT_FILE_VERIFIER) && action != nil {
0 commit comments