Files
swift-mirror/test/Interop/SwiftToCxx/cross-module-refs/not-referenced-cross-module-import.swift
Alex Lorenz 4fda7f4a9a [interop][SwiftToCxx] do not expose APIs with imported declarations whose modules do not have a generated header as specified by the user
The frontend option '-clang-header-expose-module' allows the user to specify that APIs from an imported module have been exposed in another generated header, and thus APIs that depend on them can be safely exposed in the current generated header.
2023-03-10 12:34:02 -08:00

20 lines
816 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/structs.swift -module-name Structs -emit-module -emit-module-path %t/Structs.swiftmodule -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
// RUN: %target-swift-frontend %s -typecheck -module-name UsesStructs -I %t -clang-header-expose-decls=all-public -emit-clang-header-path %t/uses-structs.h -clang-header-expose-module Structs=structs.h
// RUN: %FileCheck %s < %t/uses-structs.h
// RUN: %check-interop-cxx-header-in-clang(-I %t %t/uses-structs.h)
import Structs
// CHECK-NOT: structs.h
// CHECK: doesNotUseStructAPIs
fileprivate func usesStructsAPIsButNotExposed(_ x: StructSeveralI64) -> StructSeveralI64 {
return Structs.passThroughStructSeveralI64(i: 0, x, j: 2)
}
public func doesNotUseStructAPIs() {
}