Skip to content

Commit 79a9365

Browse files
authored
Merge pull request #1371 from hyp/eng/clang-header-path-driver
[cxx-interop] make -emit-clang-header-path a driver flag
2 parents c24fe5f + 444bd83 commit 79a9365

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Sources/SwiftOptions/Options.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ extension Option {
267267
public static let emitAst: Option = Option("-emit-ast", .flag, alias: Option.dumpAst, attributes: [.frontend, .noInteractive, .doesNotAffectIncrementalBuild])
268268
public static let emitBc: Option = Option("-emit-bc", .flag, attributes: [.frontend, .noInteractive, .doesNotAffectIncrementalBuild], helpText: "Emit LLVM BC file(s)", group: .modes)
269269
public static let emitClangHeaderNonmodularIncludes: Option = Option("-emit-clang-header-nonmodular-includes", .flag, attributes: [.frontend, .noInteractive, .supplementaryOutput], helpText: "Augment emitted Objective-C header with textual imports for every included modular import")
270-
public static let emitClangHeaderPath: Option = Option("-emit-clang-header-path", .separate, alias: Option.emitObjcHeaderPath, attributes: [.frontend, .noDriver, .noInteractive, .argumentIsPath, .supplementaryOutput], helpText: "Emit an Objective-C and C++ header file to <path>")
270+
public static let emitClangHeaderPath: Option = Option("-emit-clang-header-path", .separate, alias: Option.emitObjcHeaderPath, attributes: [.frontend, .noInteractive, .argumentIsPath, .supplementaryOutput], helpText: "Emit an Objective-C and C++ header file to <path>")
271271
public static let emitConstValuesPath: Option = Option("-emit-const-values-path", .separate, attributes: [.frontend, .noInteractive, .argumentIsPath, .supplementaryOutput], metaVar: "<path>", helpText: "Emit the extracted compile-time known values to <path>")
272272
public static let emitConstValues: Option = Option("-emit-const-values", .flag, attributes: [.noInteractive, .supplementaryOutput])
273273
public static let emitDependenciesPath: Option = Option("-emit-dependencies-path", .separate, attributes: [.frontend, .noDriver], metaVar: "<path>", helpText: "Output basic Make-compatible dependencies file to <path>")

Tests/SwiftDriverTests/SwiftDriverTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -6773,6 +6773,18 @@ final class SwiftDriverTests: XCTestCase {
67736773
#endif
67746774
}
67756775

6776+
func testEmitClangHeaderPath() throws {
6777+
VirtualPath.resetTemporaryFileStore()
6778+
var driver = try Driver(args: [
6779+
"swiftc", "-emit-clang-header-path", "path/to/header", "-typecheck", "test.swift"
6780+
])
6781+
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
6782+
XCTAssertEqual(jobs.count, 2)
6783+
let job = jobs.first!
6784+
XCTAssertTrue(job.commandLine.contains(.flag("-emit-objc-header-path")))
6785+
XCTAssertTrue(job.commandLine.contains(.path(.relative(RelativePath("path/to/header")))))
6786+
}
6787+
67766788
func testGccToolchainFlags() throws {
67776789
VirtualPath.resetTemporaryFileStore()
67786790
var driver = try Driver(args: [

0 commit comments

Comments
 (0)