Skip to content

Commit 4632dd5

Browse files
authored
Do not pass -framework to compiler tasks (#3304)
This fixes warnings of the form > clang: warning: -framework XCTest: 'linker' input unused [-Wunused-command-line-argument] when using `linkedFramework` for C-family and Swift targets. rdar://74548652
1 parent 54dbfbd commit 4632dd5

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,6 @@ public final class ClangTargetBuildDescription {
380380
"-I\(target.sources.root.appending(RelativePath($0)).pathString)"
381381
})
382382

383-
// Frameworks.
384-
let frameworks = scope.evaluate(.LINK_FRAMEWORKS)
385-
flags += frameworks.flatMap({ ["-framework", $0] })
386-
387383
// Other C flags.
388384
flags += scope.evaluate(.OTHER_CFLAGS)
389385

@@ -932,10 +928,6 @@ public final class SwiftTargetBuildDescription {
932928
let swiftDefines = scope.evaluate(.SWIFT_ACTIVE_COMPILATION_CONDITIONS)
933929
flags += swiftDefines.map({ "-D" + $0 })
934930

935-
// Frameworks.
936-
let frameworks = scope.evaluate(.LINK_FRAMEWORKS)
937-
flags += frameworks.flatMap({ ["-framework", $0] })
938-
939931
// Other Swift flags.
940932
flags += scope.evaluate(.OTHER_SWIFT_FLAGS)
941933

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,6 +1916,8 @@ final class BuildPlanTests: XCTestCase {
19161916
.init(tool: .c, name: .define, value: ["CCC=2"]),
19171917
.init(tool: .cxx, name: .define, value: ["RCXX"], condition: .init(config: "release")),
19181918

1919+
.init(tool: .linker, name: .linkedFramework, value: ["best"]),
1920+
19191921
.init(tool: .c, name: .unsafeFlags, value: ["-Icfoo", "-L", "cbar"]),
19201922
.init(tool: .cxx, name: .unsafeFlags, value: ["-Icxxfoo", "-L", "cxxbar"]),
19211923
]
@@ -1997,7 +1999,7 @@ final class BuildPlanTests: XCTestCase {
19971999
XCTAssertMatch(exe, [.anySequence, "-DFOO", .end])
19982000

19992001
let linkExe = try result.buildProduct(for: "exe").linkArguments()
2000-
XCTAssertMatch(linkExe, [.anySequence, "-lsqlite3", "-llibz", "-Ilfoo", "-L", "lbar", .end])
2002+
XCTAssertMatch(linkExe, [.anySequence, "-lsqlite3", "-llibz", "-framework", "best", "-Ilfoo", "-L", "lbar", .end])
20012003
}
20022004

20032005
do {
@@ -2010,10 +2012,10 @@ final class BuildPlanTests: XCTestCase {
20102012
XCTAssertMatch(bar, [.anySequence, "-DDMACOS", "-Isfoo", "-L", "sbar", .end])
20112013

20122014
let exe = try result.target(for: "exe").swiftTarget().compileArguments()
2013-
XCTAssertMatch(exe, [.anySequence, "-DFOO", "-framework", "CoreData", .end])
2015+
XCTAssertMatch(exe, [.anySequence, "-DFOO", .end])
20142016

20152017
let linkExe = try result.buildProduct(for: "exe").linkArguments()
2016-
XCTAssertMatch(linkExe, [.anySequence, "-lsqlite3", "-llibz", "-framework", "CoreData", "-Ilfoo", "-L", "lbar", .anySequence])
2018+
XCTAssertMatch(linkExe, [.anySequence, "-lsqlite3", "-llibz", "-framework", "CoreData", "-framework", "best", "-Ilfoo", "-L", "lbar", .anySequence])
20172019
}
20182020
}
20192021

0 commit comments

Comments
 (0)