Skip to content

Commit

Permalink
Merge pull request #1371 from hyp/eng/clang-header-path-driver
Browse files Browse the repository at this point in the history
[cxx-interop] make -emit-clang-header-path a driver flag
  • Loading branch information
hyp committed Jun 8, 2023
2 parents c24fe5f + 444bd83 commit 79a9365
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/SwiftOptions/Options.swift
Expand Up @@ -267,7 +267,7 @@ extension Option {
public static let emitAst: Option = Option("-emit-ast", .flag, alias: Option.dumpAst, attributes: [.frontend, .noInteractive, .doesNotAffectIncrementalBuild])
public static let emitBc: Option = Option("-emit-bc", .flag, attributes: [.frontend, .noInteractive, .doesNotAffectIncrementalBuild], helpText: "Emit LLVM BC file(s)", group: .modes)
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")
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>")
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>")
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>")
public static let emitConstValues: Option = Option("-emit-const-values", .flag, attributes: [.noInteractive, .supplementaryOutput])
public static let emitDependenciesPath: Option = Option("-emit-dependencies-path", .separate, attributes: [.frontend, .noDriver], metaVar: "<path>", helpText: "Output basic Make-compatible dependencies file to <path>")
Expand Down
12 changes: 12 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Expand Up @@ -6773,6 +6773,18 @@ final class SwiftDriverTests: XCTestCase {
#endif
}

func testEmitClangHeaderPath() throws {
VirtualPath.resetTemporaryFileStore()
var driver = try Driver(args: [
"swiftc", "-emit-clang-header-path", "path/to/header", "-typecheck", "test.swift"
])
let jobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(jobs.count, 2)
let job = jobs.first!
XCTAssertTrue(job.commandLine.contains(.flag("-emit-objc-header-path")))
XCTAssertTrue(job.commandLine.contains(.path(.relative(RelativePath("path/to/header")))))
}

func testGccToolchainFlags() throws {
VirtualPath.resetTemporaryFileStore()
var driver = try Driver(args: [
Expand Down

0 comments on commit 79a9365

Please sign in to comment.