Skip to content

Commit 3ee8272

Browse files
authored
Merge pull request swiftlang#74942 from swiftlang/gaborh/emit-implicit-std-dependencies-all-public
[cxx-interop] Emit Swift StdLib dependencies when all public decls emitted
2 parents 2d3d670 + c3a02cd commit 3ee8272

File tree

45 files changed

+61
-62
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+61
-62
lines changed

lib/PrintAsClang/PrintAsClang.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,9 @@ bool swift::printAsClangHeader(raw_ostream &os, ModuleDecl *M,
624624
!frontendOpts.ClangHeaderExposedDecls.has_value() ||
625625
*frontendOpts.ClangHeaderExposedDecls ==
626626
FrontendOptions::ClangHeaderExposeBehavior::
627-
HasExposeAttrOrImplicitDeps;
627+
HasExposeAttrOrImplicitDeps ||
628+
*frontendOpts.ClangHeaderExposedDecls ==
629+
FrontendOptions::ClangHeaderExposeBehavior::AllPublic;
628630

629631
std::string moduleContentsBuf;
630632
llvm::raw_string_ostream moduleContents{moduleContentsBuf};

test/Interop/SwiftToCxx/class/swift-class-virtual-method-dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Class -clang-header-expose-decls=all-public -emit-clang-header-path %t/class.h
33
// RUN: %FileCheck %s < %t/class.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/class.h)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/class.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
66

77
// UNSUPPORTED: CPU=arm64e
88

test/Interop/SwiftToCxx/class/swift-resilient-class-virtual-method-dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %S/swift-class-virtual-method-dispatch.swift -typecheck -module-name Class -clang-header-expose-decls=all-public -emit-clang-header-path %t/class.h -enable-library-evolution
33
// RUN: %FileCheck %s < %t/class.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/class.h)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/class.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
66

77
// note: implemented in swift-class-virtual-method-dispatch.swift
88

test/Interop/SwiftToCxx/class/swift-subclass-of-resilient-class-virtual-method-dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// RUN: echo '#include "class.h"' > %t/fixed-useclass.h
1010
// RUN: cat %t/useclass.h >> %t/fixed-useclass.h
1111

12-
// RUN: %check-interop-cxx-header-in-clang(%t/fixed-useclass.h)
12+
// RUN: %check-interop-cxx-header-in-clang(%t/fixed-useclass.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
1313

1414
// rdar://105396625
1515
// UNSUPPORTED: CPU=arm64e

test/Interop/SwiftToCxx/cross-module-refs/do-not-expose-imported-api-by-default.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// 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
55

6-
// RUN: %check-interop-cxx-header-in-clang(%t/uses-structs.h)
6+
// RUN: %check-interop-cxx-header-in-clang(%t/uses-structs.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
77
// RUN: %FileCheck %s < %t/uses-structs.h
88

99
import Structs

test/Interop/SwiftToCxx/cross-module-refs/imported-struct-refs-in-cxx.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// 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
55

66
// RUN: %FileCheck %s < %t/uses-structs.h
7-
// RUN: %check-interop-cxx-header-in-clang(-I %t %t/uses-structs.h)
7+
// RUN: %check-interop-cxx-header-in-clang(-I %t %t/uses-structs.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
88

99
// RUN: %target-swift-frontend %s -typecheck -module-name UsesStructs -I %t -cxx-interoperability-mode=default -emit-clang-header-path %t/uses-structs-default.h -clang-header-expose-module Structs=structs.h
10-
// RUN: %check-interop-cxx-header-in-clang(-I %t %t/uses-structs-default.h)
10+
// RUN: %check-interop-cxx-header-in-clang(-I %t %t/uses-structs-default.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
1111

1212
import Structs
1313

test/Interop/SwiftToCxx/enums/enum-associated-value-class-type-cxx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Enums -clang-header-expose-decls=all-public -emit-clang-header-path %t/enums.h
33
// RUN: %FileCheck %s < %t/enums.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
66

77
// rdar://124466216
88
// UNSUPPORTED: OS=watchos

test/Interop/SwiftToCxx/enums/enum-element-method-name-clash.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extension Foo {
2525

2626
// CHECK-NOT: Foo bar(swift::Int version)
2727

28+
// CHECK: class SWIFT_SYMBOL("s:5Enums3FooO") Foo final {
2829
// CHECK: switch (_getEnumTag()) {
2930
// CHECK-NEXT: case 0: return cases::bar;
3031
// CHECK-NEXT: default: abort();

test/Interop/SwiftToCxx/enums/enum-member-param-no-shadow-case.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Enums -clang-header-expose-decls=all-public -emit-clang-header-path %t/enums.h
33
// RUN: %FileCheck %s < %t/enums.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
66

77
public enum E {
88
case a

test/Interop/SwiftToCxx/enums/large-enums-pass-return-in-cxx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: %target-swift-frontend %s -typecheck -module-name Enums -clang-header-expose-decls=all-public -emit-clang-header-path %t/enums.h
33
// RUN: %FileCheck %s < %t/enums.h
44

5-
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function)
5+
// RUN: %check-interop-cxx-header-in-clang(%t/enums.h -Wno-unused-private-field -Wno-unused-function -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY)
66

77
public struct IntTuple {
88
let values: (Int64, Int64, Int64, Int64, Int64, Int64)

0 commit comments

Comments
 (0)