Skip to content

Commit e384676

Browse files
committed
Revert unnecessary changes
1 parent 721145b commit e384676

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Sources/SWBCore/SpecImplementations/Tools/CCompiler.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,10 +591,10 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
591591

592592
required init() { }
593593

594-
func getStandardFlags(_ spec: ClangCompilerSpec, cbc: CommandBuildContext, optionContext: (any BuildOptionGenerationContext)?, delegate: any TaskGenerationDelegate, inputFileType: FileTypeSpec) -> ConstantFlags {
594+
func getStandardFlags(_ spec: ClangCompilerSpec, producer: any CommandProducer, scope: MacroEvaluationScope, optionContext: (any BuildOptionGenerationContext)?, delegate: any TaskGenerationDelegate, inputFileType: FileTypeSpec) -> ConstantFlags {
595595
// This cache is per-producer, so it is guaranteed to be invariant based on that.
596-
constantFlagsCache.getOrInsert(ConstantFlagsKey(scope: cbc.scope, inputFileType: inputFileType)) {
597-
return spec.standardFlags(cbc, optionContext: optionContext, delegate: delegate, inputFileType: inputFileType)
596+
constantFlagsCache.getOrInsert(ConstantFlagsKey(scope: scope, inputFileType: inputFileType)) {
597+
return spec.standardFlags(producer, scope: scope, optionContext: optionContext, delegate: delegate, inputFileType: inputFileType)
598598
}
599599
}
600600
}
@@ -646,9 +646,8 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
646646
super.init(parser, basedOnSpec, isGeneric: false)
647647
}
648648

649-
private func standardFlags(_ cbc: CommandBuildContext, optionContext: (any BuildOptionGenerationContext)?, delegate: any TaskGenerationDelegate, inputFileType: FileTypeSpec) -> ConstantFlags {
649+
private func standardFlags(_ producer: any CommandProducer, scope: MacroEvaluationScope, optionContext: (any BuildOptionGenerationContext)?, delegate: any TaskGenerationDelegate, inputFileType: FileTypeSpec) -> ConstantFlags {
650650
var commandLine = Array<String>()
651-
let producer = cbc.producer, scope = cbc.scope
652651

653652
// Add the arguments from the specification.
654653
commandLine += self.commandLineFromOptions(producer, scope: scope, inputFileType: inputFileType, optionContext: optionContext, buildOptionsFilter: .specOnly, lookup: { declaration in
@@ -658,7 +657,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
658657
return BuiltinMacros.namespace.parseString("NO")
659658
}
660659
}
661-
return self.lookup(declaration, cbc, delegate)
660+
return nil
662661
}).map(\.asString)
663662

664663
// Add the common header search paths.
@@ -1138,8 +1137,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
11381137
//
11391138
// FIXME: Eventually we should just apply this optimization to all generic specs, and then find a way to piggy back on that.
11401139
let dataCache = cbc.producer.getSpecDataCache(self, cacheType: DataCache.self)
1141-
let cbcWithOutput = cbc.outputs.isEmpty ? cbc.appendingOutputs([outputNode.path]) : cbc
1142-
let constantFlags = dataCache.getStandardFlags(self, cbc: cbcWithOutput, optionContext: clangInfo, delegate: delegate, inputFileType: resolvedInputFileType)
1140+
let constantFlags = dataCache.getStandardFlags(self, producer: cbc.producer, scope: cbc.scope, optionContext: clangInfo, delegate: delegate, inputFileType: resolvedInputFileType)
11431141
commandLine += constantFlags.flags
11441142
let responseFileAdditionalOutput = constantFlags.responseFileMapping.keys.sorted().map({"Using response file: \($0.str)"})
11451143
additionalOutput.append(contentsOf: responseFileAdditionalOutput)
@@ -1160,6 +1158,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
11601158
inputDeps.append(contentsOf: constantFlags.headerSearchPaths.inputPaths)
11611159
#endif
11621160

1161+
let cbcWithOutput = cbc.outputs.isEmpty ? cbc.appendingOutputs([outputNode.path]) : cbc
11631162
commandLine += self.commandLineFromOptions(cbc.producer, scope: cbc.scope, inputFileType: resolvedInputFileType, optionContext: clangInfo, buildOptionsFilter: .extendedOnly, lookup: {
11641163
self.lookup($0, cbcWithOutput, delegate)
11651164
}).map(\.asString)
@@ -1701,7 +1700,7 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
17011700

17021701
// Add “standard flags”, which are ones that depend only on the variant, architecture, and language (in addition to the identifier, of course).
17031702
let dataCache = cbc.producer.getSpecDataCache(self, cacheType: DataCache.self)
1704-
let constantFlags = dataCache.getStandardFlags(self, cbc: cbc, optionContext: clangInfo, delegate: delegate, inputFileType: inputFileType)
1703+
let constantFlags = dataCache.getStandardFlags(self, producer: cbc.producer, scope: cbc.scope, optionContext: clangInfo, delegate: delegate, inputFileType: inputFileType)
17051704
let responseFileAdditionalOutput = constantFlags.responseFileMapping.keys.sorted().map({"Using response file: \($0.str)"})
17061705
commandLine += constantFlags.flags
17071706

0 commit comments

Comments
 (0)