@@ -434,8 +434,9 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
434434
435435 public let moduleDependenciesContext : ModuleDependenciesContext ?
436436 public let traceFilePath : Path ?
437+ public let dependencyValidationOutputPath : Path ?
437438
438- fileprivate init ( serializedDiagnosticsPath: Path ? , indexingPayload: ClangIndexingPayload ? , explicitModulesPayload: ClangExplicitModulesPayload ? = nil , outputObjectFilePath: Path ? = nil , fileNameMapPath: Path ? = nil , developerPathString: String ? = nil , moduleDependenciesContext: ModuleDependenciesContext ? = nil , traceFilePath: Path ? = nil ) {
439+ fileprivate init ( serializedDiagnosticsPath: Path ? , indexingPayload: ClangIndexingPayload ? , explicitModulesPayload: ClangExplicitModulesPayload ? = nil , outputObjectFilePath: Path ? = nil , fileNameMapPath: Path ? = nil , developerPathString: String ? = nil , moduleDependenciesContext: ModuleDependenciesContext ? = nil , traceFilePath: Path ? = nil , dependencyValidationOutputPath : Path ? = nil ) {
439440 if let developerPathString, explicitModulesPayload == nil {
440441 self . dependencyInfoEditPayload = . init( removablePaths: [ ] , removableBasenames: [ ] , developerPath: Path ( developerPathString) )
441442 } else {
@@ -448,10 +449,11 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
448449 self . fileNameMapPath = fileNameMapPath
449450 self . moduleDependenciesContext = moduleDependenciesContext
450451 self . traceFilePath = traceFilePath
452+ self . dependencyValidationOutputPath = dependencyValidationOutputPath
451453 }
452454
453455 public func serialize< T: Serializer > ( to serializer: T ) {
454- serializer. serializeAggregate ( 8 ) {
456+ serializer. serializeAggregate ( 9 ) {
455457 serializer. serialize ( serializedDiagnosticsPath)
456458 serializer. serialize ( indexingPayload)
457459 serializer. serialize ( explicitModulesPayload)
@@ -460,11 +462,12 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
460462 serializer. serialize ( dependencyInfoEditPayload)
461463 serializer. serialize ( moduleDependenciesContext)
462464 serializer. serialize ( traceFilePath)
465+ serializer. serialize ( dependencyValidationOutputPath)
463466 }
464467 }
465468
466469 public init ( from deserializer: any Deserializer ) throws {
467- try deserializer. beginAggregate ( 8 )
470+ try deserializer. beginAggregate ( 9 )
468471 self . serializedDiagnosticsPath = try deserializer. deserialize ( )
469472 self . indexingPayload = try deserializer. deserialize ( )
470473 self . explicitModulesPayload = try deserializer. deserialize ( )
@@ -473,6 +476,7 @@ public struct ClangTaskPayload: ClangModuleVerifierPayloadType, DependencyInfoEd
473476 self . dependencyInfoEditPayload = try deserializer. deserialize ( )
474477 self . moduleDependenciesContext = try deserializer. deserialize ( )
475478 self . traceFilePath = try deserializer. deserialize ( )
479+ self . dependencyValidationOutputPath = try deserializer. deserialize ( )
476480 }
477481}
478482
@@ -1165,10 +1169,14 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
11651169 dependencyData = nil
11661170 }
11671171
1172+ let extraOutputs : [ any PlannedNode ]
11681173 let moduleDependenciesContext = cbc. producer. moduleDependenciesContext
1174+ let dependencyValidationOutputPath : Path ?
11691175 let traceFilePath : Path ?
11701176 if clangInfo? . hasFeature ( " print-headers-direct-per-file " ) ?? false ,
11711177 ( moduleDependenciesContext? . validate ?? . defaultValue) != . no {
1178+ dependencyValidationOutputPath = Path ( outputNode. path. str + " .dependencies " )
1179+
11721180 let file = Path ( outputNode. path. str + " .trace.json " )
11731181 commandLine += [
11741182 " -Xclang " , " -header-include-file " ,
@@ -1177,8 +1185,12 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
11771185 " -Xclang " , " -header-include-format=json "
11781186 ]
11791187 traceFilePath = file
1188+
1189+ extraOutputs = [ MakePlannedPathNode ( dependencyValidationOutputPath!) , MakePlannedPathNode ( traceFilePath!) ]
11801190 } else {
1191+ dependencyValidationOutputPath = nil
11811192 traceFilePath = nil
1193+ extraOutputs = [ ]
11821194 }
11831195
11841196 // Add the diagnostics serialization flag. We currently place the diagnostics file right next to the output object file.
@@ -1293,7 +1305,8 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
12931305 fileNameMapPath: verifierPayload? . fileNameMapPath,
12941306 developerPathString: recordSystemHeaderDepsOutsideSysroot ? cbc. scope. evaluate ( BuiltinMacros . DEVELOPER_DIR) . str : nil ,
12951307 moduleDependenciesContext: moduleDependenciesContext,
1296- traceFilePath: traceFilePath
1308+ traceFilePath: traceFilePath,
1309+ dependencyValidationOutputPath: dependencyValidationOutputPath
12971310 )
12981311
12991312 var inputNodes : [ any PlannedNode ] = inputDeps. map { delegate. createNode ( $0) }
@@ -1357,7 +1370,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
13571370 }
13581371
13591372 // Finally, create the task.
1360- 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)
1373+ 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] + extraOutputs , action: action ?? delegate. taskActionCreationDelegate. createDeferredExecutionTaskActionIfRequested ( userPreferences: cbc. producer. userPreferences) , execDescription: resolveExecutionDescription ( cbc, delegate) , enableSandboxing: enableSandboxing, additionalTaskOrderingOptions: [ . compilationForIndexableSourceFile] , usesExecutionInputs: usesExecutionInputs, showEnvironment: true , priority: . preferred)
13611374
13621375 // 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.
13631376 if cbc. scope. evaluate ( BuiltinMacros . CLANG_ENABLE_EXPLICIT_MODULES_OBJECT_FILE_VERIFIER) && action != nil {
0 commit comments