Skip to content

Commit edc7420

Browse files
authored
[cxx-interop] Make experimental flag ImportNonPublicCxxMembers (#79728)
ClangImporter can now import non-public members as of be73254 and 66c2e2c, but doing so triggers some latent ClangImporter bugs in projects that don't use or need those non-public members. This patch introduces a new experimental feature flag, ImportNonPublicCxxMembers, that guards against the importation of non-public members while we iron out those latent issues. Adopters of the SWIFT_PRIVATE_FILEID feature introduced in bdf2294 can enable this flag to opt into importing private members they wish to access from Swift. rdar://145569473
1 parent 157e71a commit edc7420

27 files changed

+111
-118
lines changed

Diff for: include/swift/Basic/Features.def

+3
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ EXPERIMENTAL_FEATURE(SafeInteropWrappers, false)
423423
/// Ignore resilience errors due to C++ types.
424424
EXPERIMENTAL_FEATURE(AssumeResilientCxxTypes, true)
425425

426+
/// Import inherited non-public members when importing C++ classes.
427+
EXPERIMENTAL_FEATURE(ImportNonPublicCxxMembers, true)
428+
426429
// Isolated deinit
427430
SUPPRESSIBLE_LANGUAGE_FEATURE(IsolatedDeinit, 371, "isolated deinit")
428431

Diff for: lib/AST/FeatureSet.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ static bool usesFeatureMemorySafetyAttributes(Decl *decl) {
386386
UNINTERESTING_FEATURE(StrictMemorySafety)
387387
UNINTERESTING_FEATURE(SafeInteropWrappers)
388388
UNINTERESTING_FEATURE(AssumeResilientCxxTypes)
389+
UNINTERESTING_FEATURE(ImportNonPublicCxxMembers)
389390
UNINTERESTING_FEATURE(CoroutineAccessorsUnwindOnCallerError)
390391
UNINTERESTING_FEATURE(CoroutineAccessorsAllocateInCallee)
391392

Diff for: lib/ClangImporter/ClangImporter.cpp

+15-15
Original file line numberDiff line numberDiff line change
@@ -6193,21 +6193,6 @@ TinyPtrVector<ValueDecl *> ClangRecordMemberLookup::evaluate(
61936193
DeclName name = desc.name;
61946194
ClangInheritanceInfo inheritance = desc.inheritance;
61956195

6196-
// HACK: the inherited, synthesized, private 'pointee' property used in MSVC's
6197-
// std::optional implementation causes problems when conforming it to
6198-
// CxxOptional (see conformToCxxOptionalIfNeeded()), since it clashes with the
6199-
// public 'pointee' property synthesized from using _Mybase::operator* (where
6200-
// _Mybase is _Optional_construct_base). The root cause seems to be the
6201-
// cloned member cache's inability to manage special decls synthesized from
6202-
// operators.
6203-
if (auto *decl =
6204-
dyn_cast_or_null<clang::CXXRecordDecl>(recordDecl->getClangDecl())) {
6205-
if (decl->isInStdNamespace() && decl->getIdentifier() &&
6206-
decl->getName() == "_Optional_construct_base" &&
6207-
desc.name.getBaseName() == "pointee")
6208-
return {};
6209-
}
6210-
62116196
auto &ctx = recordDecl->getASTContext();
62126197
auto directResults = evaluateOrDefault(
62136198
ctx.evaluator,
@@ -6223,6 +6208,17 @@ TinyPtrVector<ValueDecl *> ClangRecordMemberLookup::evaluate(
62236208
recordDecl->getClangDecl())
62246209
continue;
62256210

6211+
if (!ctx.LangOpts.hasFeature(Feature::ImportNonPublicCxxMembers)) {
6212+
auto access = found->getAccess();
6213+
if ((access == clang::AS_private || access == clang::AS_protected) &&
6214+
(inheritance || !isa<clang::FieldDecl>(found)))
6215+
// 'found' is a non-public member and ImportNonPublicCxxMembers is not
6216+
// enabled. Don't import it unless it is a non-inherited field, which
6217+
// we must import because it may affect implicit conformances that
6218+
// iterate through all of a struct's fields, e.g., Sendable (#76892).
6219+
continue;
6220+
}
6221+
62266222
// Don't import constructors on foreign reference types.
62276223
if (isa<clang::CXXConstructorDecl>(found) && isa<ClassDecl>(recordDecl))
62286224
continue;
@@ -6275,6 +6271,10 @@ TinyPtrVector<ValueDecl *> ClangRecordMemberLookup::evaluate(
62756271
foundNameArities.insert(getArity(valueDecl));
62766272

62776273
for (auto base : cxxRecord->bases()) {
6274+
if (!ctx.LangOpts.hasFeature(Feature::ImportNonPublicCxxMembers) &&
6275+
base.getAccessSpecifier() != clang::AS_public)
6276+
continue;
6277+
62786278
clang::QualType baseType = base.getType();
62796279
if (auto spectType = dyn_cast<clang::TemplateSpecializationType>(baseType))
62806280
baseType = spectType->desugar();

Diff for: lib/ClangImporter/ImportDecl.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -9963,6 +9963,18 @@ void ClangImporter::Implementation::loadAllMembersOfRecordDecl(
99639963
if (!nd)
99649964
continue;
99659965

9966+
if (!swiftDecl->getASTContext().LangOpts.hasFeature(
9967+
Feature::ImportNonPublicCxxMembers)) {
9968+
auto access = nd->getAccess();
9969+
if ((access == clang::AS_private || access == clang::AS_protected) &&
9970+
(inheritance || !isa<clang::FieldDecl>(nd)))
9971+
// 'nd' is a non-public member and ImportNonPublicCxxMembers is not
9972+
// enabled. Don't import it unless it is a non-inherited field, which
9973+
// we must import because it may affect implicit conformances that
9974+
// iterate through all of a struct's fields, e.g., Sendable (#76892).
9975+
continue;
9976+
}
9977+
99669978
// Currently, we don't import unnamed bitfields.
99679979
if (isa<clang::FieldDecl>(m) &&
99689980
cast<clang::FieldDecl>(m)->isUnnamedBitField())
@@ -10030,6 +10042,11 @@ void ClangImporter::Implementation::loadAllMembersOfRecordDecl(
1003010042
// If this is a C++ record, look through the base classes too.
1003110043
if (auto cxxRecord = dyn_cast<clang::CXXRecordDecl>(clangRecord)) {
1003210044
for (auto base : cxxRecord->bases()) {
10045+
if (!swiftDecl->getASTContext().LangOpts.hasFeature(
10046+
Feature::ImportNonPublicCxxMembers) &&
10047+
base.getAccessSpecifier() != clang::AS_public)
10048+
continue;
10049+
1003310050
clang::QualType baseType = base.getType();
1003410051
if (auto spectType = dyn_cast<clang::TemplateSpecializationType>(baseType))
1003510052
baseType = spectType->desugar();

Diff for: test/Interop/Cxx/class/access/access-inversion-module-interface.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-ide-test -print-module -print-access -module-to-print=AccessInversion -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default | %FileCheck %s
1+
// RUN: %target-swift-ide-test -print-module -print-access -module-to-print=AccessInversion -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers | %FileCheck %s
2+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
23

34
// CHECK: public struct Leaky {
45

Diff for: test/Interop/Cxx/class/access/access-inversion-typechecker.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// but does not necessarily specify it (in the deliberate sense). In other words,
55
// there may be behaviors captured in these tests that deserve amending.
66

7-
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default
7+
// RUN: %target-typecheck-verify-swift -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers
8+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
89

910
import AccessInversion
1011

Diff for: test/Interop/Cxx/class/access/access-specifiers-module-interface.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Public C++ members should be imported with Swift-public access, and
33
// private C++ members should be imported with Swift-private access.
44

5-
// RUN: %target-swift-ide-test -print-module -module-to-print=AccessSpecifiers -print-access -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
5+
// RUN: %target-swift-ide-test -print-module -module-to-print=AccessSpecifiers -print-access -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-experimental-feature ImportNonPublicCxxMembers | %FileCheck %s
6+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
67

78
// CHECK: public struct PublicPrivate {
89
// CHECK-NEXT: public init()

Diff for: test/Interop/Cxx/class/access/access-specifiers-typechecker.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Test that C++ access specifiers are honored.
22

3-
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -enable-experimental-cxx-interop
3+
// RUN: %target-typecheck-verify-swift -verify-ignore-unknown -I %S/Inputs -enable-experimental-cxx-interop -enable-experimental-feature ImportNonPublicCxxMembers
4+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
45

56
import AccessSpecifiers
67

Diff for: test/Interop/Cxx/class/access/non-public-inheritance-executable.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
// Test that all accessible inherited methods can be called.
33
//
44
// RUN: split-file %s %t
5-
// RUN: %target-build-swift -module-name main %t/blessed.swift -I %S/Inputs -o %t/out -Xfrontend -cxx-interoperability-mode=default
5+
// RUN: %target-build-swift -module-name main %t/blessed.swift -I %S/Inputs -o %t/out -Xfrontend -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers
66
// RUN: %target-codesign %t/out
77
// RUN: %target-run %t/out
88
//
99
// REQUIRES: executable_test
10+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
1011

1112
import StdlibUnittest
1213
import NonPublicInheritance

Diff for: test/Interop/Cxx/class/access/non-public-inheritance-module-interface.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
// against message wording changes), but it does require the message to mention
88
// something about "private".
99
//
10-
// RUN: %target-swift-ide-test -print-module -module-to-print=NonPublicInheritance -print-access -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
10+
// RUN: %target-swift-ide-test -print-module -module-to-print=NonPublicInheritance -print-access -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -enable-experimental-feature ImportNonPublicCxxMembers | %FileCheck %s
11+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
1112

1213
// CHECK: public struct Base {
1314
// CHECK-NEXT: public init()

Diff for: test/Interop/Cxx/class/access/non-public-inheritance-typecheck.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//--- blessed.swift
22
// RUN: split-file %s %t
3-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift
4-
3+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift -enable-experimental-feature ImportNonPublicCxxMembers
4+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
55
import NonPublicInheritance
66

77
// Extensions of each class test whether we correctly modeled *which* members

Diff for: test/Interop/Cxx/class/access/non-public-shadow-executable.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Check that we are resolving the correct member for all unambiguous members
22
// in the Shadow struct.
33

4-
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default)
4+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers)
55
// REQUIRES: executable_test
6+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
67

78
import StdlibUnittest
89
import NonPublicShadow

Diff for: test/Interop/Cxx/class/access/non-public-shadow-module-interface.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-ide-test -print-module -module-to-print=NonPublicShadow -print-access -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default | %FileCheck %s
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=NonPublicShadow -print-access -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers | %FileCheck %s
2+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
23

34
// We only check the module interface of Shadow to keep this test concise
45

Diff for: test/Interop/Cxx/class/access/non-public-shadow-typecheck.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default %s
1+
// RUN: %target-swift-frontend %s -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers
2+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
23
import NonPublicShadow
34

45
func f(s: Shadow) {

Diff for: test/Interop/Cxx/class/access/private-fileid-diagnostics.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: split-file %s %t
2-
// RUN: %target-swift-frontend -typecheck -verify %t/some/subdir/file1.swift -verify-additional-file %t/Cxx/include/cxx-header.h -I %t/Cxx/include -cxx-interoperability-mode=default -module-name main -suppress-remarks
2+
// RUN: %target-swift-frontend -typecheck -verify -suppress-remarks %t/some/subdir/file1.swift -verify-additional-file %t/Cxx/include/cxx-header.h -I %t/Cxx/include -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main
3+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
34

45
// This test uses -verify-additional-file, which do not work well on Windows:
56
// UNSUPPORTED: OS=windows-msvc

Diff for: test/Interop/Cxx/class/access/private-fileid-nested-typecheck.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// works as expected.
33
//
44
// RUN: split-file %s %t
5-
// RUN: %target-swift-frontend -typecheck -verify %t/file1.swift -I %t/include -cxx-interoperability-mode=default -module-name main
6-
// RUN: %target-swift-frontend -typecheck -verify %t/file2.swift -I %t/include -cxx-interoperability-mode=default -module-name main
5+
// RUN: %target-swift-frontend -typecheck -verify %t/file1.swift -I %t/include -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main
6+
// RUN: %target-swift-frontend -typecheck -verify %t/file2.swift -I %t/include -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main
7+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
78

89
//--- include/module.modulemap
910
module CxxModule {

Diff for: test/Interop/Cxx/class/access/private-fileid-template-typecheck.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// non-public in different contexts, and variations in module and file names.
1616
//
1717
// RUN: split-file %s %t
18-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift
18+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/blessed.swift
19+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
1920

2021
//--- blessed.swift
2122

Diff for: test/Interop/Cxx/class/access/private-fileid-typecheck.swift

+19-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// in the contexts where they should be accessible (i.e., the files blessed by
44
// the SWIFT_PRIVATE_FILEID annotation).
55
//
6+
// For now, it requires the following feature to import private members:
7+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
8+
//
69
// The private_fileid mechanism relies on fileIDs, so we need some control over
710
// file names:
811
//
@@ -16,37 +19,37 @@
1619
// members are private (default) or protected. The result should be the same
1720
// no matter the configuration.
1821
//
19-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift
20-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift -Xcc -DTEST_CLASS=struct
21-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift -Xcc -DTEST_PRIVATE=protected
22-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
22+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/blessed.swift
23+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/blessed.swift -Xcc -DTEST_CLASS=struct
24+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/blessed.swift -Xcc -DTEST_PRIVATE=protected
25+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
2326
//
2427
// This test also includes a "cursed.swift", which expects to not have access to
2528
// non-public members:
2629
//
27-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/cursed.swift
28-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/cursed.swift -Xcc -DTEST_CLASS=struct
29-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/cursed.swift -Xcc -DTEST_PRIVATE=protected
30-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/cursed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
30+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/cursed.swift
31+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/cursed.swift -Xcc -DTEST_CLASS=struct
32+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/cursed.swift -Xcc -DTEST_PRIVATE=protected
33+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/cursed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
3134
//
3235
// To check that fileID is agnostic about directory structure within a module,
3336
// we move blessed.swift into a subdirectory (but keep its filename).
3437
//
3538
// RUN: mkdir -p %t/subdir/subsubdir
3639
// RUN: mv %t/blessed.swift %t/subdir/subsubdir/blessed.swift
37-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/subdir/subsubdir/blessed.swift
38-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_CLASS=struct
39-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_PRIVATE=protected
40-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
40+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/subdir/subsubdir/blessed.swift
41+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_CLASS=struct
42+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_PRIVATE=protected
43+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name main %t/subdir/subsubdir/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
4144
//
4245
// To check that fileID is sensitive to module names, rename cursed.swift to
4346
// "blessed.swift", but typecheck in a module not called "main".
4447
//
4548
// RUN: mv %t/cursed.swift %t/blessed.swift
46-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name brain %t/blessed.swift
47-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name brain %t/blessed.swift -Xcc -DTEST_CLASS=struct
48-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name brain %t/blessed.swift -Xcc -DTEST_PRIVATE=protected
49-
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -module-name brain %t/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
49+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name brain %t/blessed.swift
50+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name brain %t/blessed.swift -Xcc -DTEST_CLASS=struct
51+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name brain %t/blessed.swift -Xcc -DTEST_PRIVATE=protected
52+
// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers -module-name brain %t/blessed.swift -Xcc -DTEST_CLASS=struct -Xcc -DTEST_PRIVATE=protected
5053

5154
//--- blessed.swift
5255

Diff for: test/Interop/Cxx/class/access/using-non-public-executable.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default)
1+
// RUN: %target-run-simple-swift(-I %S/Inputs/ -Xfrontend -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers)
22
// REQUIRES: executable_test
3+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
34

45
import StdlibUnittest
56
import UsingNonPublic

Diff for: test/Interop/Cxx/class/access/using-non-public-module-interface.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-swift-ide-test -print-module -module-to-print=UsingNonPublic -print-access -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default | %FileCheck %s
1+
// RUN: %target-swift-ide-test -print-module -module-to-print=UsingNonPublic -print-access -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default -enable-experimental-feature ImportNonPublicCxxMembers | %FileCheck %s
2+
// REQUIRES: swift_feature_ImportNonPublicCxxMembers
23

34
// CHECK: public struct PublUser {
45
// CHECK-NEXT: public init()

0 commit comments

Comments
 (0)