Skip to content

Commit 1336277

Browse files
authored
Merge pull request #61331 from hyp/eng/stdlib-one-header-dep
[interop][SwiftToCxx] add support for emitting Swift stdlib dependenc…
2 parents 410a4ee + 3a9b6dc commit 1336277

File tree

108 files changed

+203
-165
lines changed

Some content is hidden

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

108 files changed

+203
-165
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "swift/Frontend/FrontendInputsAndOutputs.h"
2020
#include "swift/Frontend/InputFile.h"
2121
#include "llvm/ADT/Hashing.h"
22+
#include "llvm/ADT/Optional.h"
2223
#include "llvm/ADT/StringMap.h"
2324

2425
#include <string>
@@ -388,9 +389,16 @@ class FrontendOptions {
388389
/// '.../lib/swift', otherwise '.../lib/swift_static'.
389390
bool UseSharedResourceFolder = true;
390391

391-
/// Indicates whether to expose all public declarations in the generated clang
392+
enum class ClangHeaderExposeBehavior {
393+
/// Expose all public declarations in the generated header.
394+
AllPublic,
395+
/// Expose declarations only when they have expose attribute.
396+
HasExposeAttr
397+
};
398+
399+
/// Indicates which declarations should be exposed in the generated clang
392400
/// header.
393-
bool ExposePublicDeclsInClangHeader = false;
401+
llvm::Optional<ClangHeaderExposeBehavior> ClangHeaderExposedDecls;
394402

395403
/// Emit C++ bindings for the exposed Swift declarations in the generated
396404
/// clang header.

include/swift/Option/FrontendOptions.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,11 +1081,12 @@ def skip_import_in_public_interface:
10811081
HelpText<"Skip the import statement corresponding to a module name "
10821082
"when printing the public interface.">;
10831083

1084-
def clang_header_expose_public_decls:
1085-
Flag<["-"], "clang-header-expose-public-decls">,
1086-
HelpText<"Expose all public declarations in the generated clang header">,
1087-
Flags<[FrontendOption, HelpHidden]>;
1088-
1084+
def clang_header_expose_decls:
1085+
Joined<["-"], "clang-header-expose-decls=">,
1086+
HelpText<"Which declarations should be exposed in the generated clang header.">,
1087+
Flags<[FrontendOption, HelpHidden]>,
1088+
MetaVarName<"all-public|has-expose-attr">;
1089+
10891090
def weak_link_at_target :
10901091
Flag<["-"], "weak-link-at-target">,
10911092
HelpText<"Weakly link symbols for declarations that were introduced at the "

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,13 @@ bool ArgsToFrontendOptionsConverter::convert(
284284
Opts.EnableIncrementalDependencyVerifier |= Args.hasArg(OPT_verify_incremental_dependencies);
285285
Opts.UseSharedResourceFolder = !Args.hasArg(OPT_use_static_resource_dir);
286286
Opts.DisableBuildingInterface = Args.hasArg(OPT_disable_building_interface);
287-
Opts.ExposePublicDeclsInClangHeader =
288-
Args.hasArg(OPT_clang_header_expose_public_decls);
287+
if (const Arg *A = Args.getLastArg(options::OPT_clang_header_expose_decls)) {
288+
Opts.ClangHeaderExposedDecls =
289+
llvm::StringSwitch<llvm::Optional<FrontendOptions::ClangHeaderExposeBehavior>>(A->getValue())
290+
.Case("all-public", FrontendOptions::ClangHeaderExposeBehavior::AllPublic)
291+
.Case("has-expose-attr", FrontendOptions::ClangHeaderExposeBehavior::HasExposeAttr)
292+
.Default(llvm::None);
293+
}
289294
Opts.EnableExperimentalCxxInteropInClangHeader =
290295
Args.hasArg(OPT_enable_experimental_cxx_interop_in_clang_header);
291296

lib/PrintAsClang/ModuleContentsWriter.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class ModuleWriter {
134134
llvm::raw_string_ostream outOfLineDefinitionsOS;
135135
DeclAndTypePrinter printer;
136136
OutputLanguageMode outputLangMode;
137+
bool dependsOnStdlib = false;
137138

138139
public:
139140
ModuleWriter(raw_ostream &os, raw_ostream &prologueOS,
@@ -149,6 +150,11 @@ class ModuleWriter {
149150

150151
PrimitiveTypeMapping &getTypeMapping() { return typeMapping; }
151152

153+
/// Returns true if a Stdlib dependency was seen during the emission of this module.
154+
bool isStdlibRequired() const {
155+
return dependsOnStdlib;
156+
}
157+
152158
/// Returns true if we added the decl's module to the import set, false if
153159
/// the decl is a local decl.
154160
///
@@ -159,8 +165,10 @@ class ModuleWriter {
159165

160166
if (otherModule == &M)
161167
return false;
162-
if (otherModule->isStdlibModule() ||
163-
otherModule->isBuiltinModule())
168+
if (otherModule->isStdlibModule()) {
169+
dependsOnStdlib = true;
170+
return true;
171+
} else if (otherModule->isBuiltinModule())
164172
return true;
165173
// Don't need a module for SIMD types in C.
166174
if (otherModule->getName() == M.getASTContext().Id_simd)
@@ -734,20 +742,22 @@ void swift::printModuleContentsAsObjC(
734742
.write();
735743
}
736744

737-
void swift::printModuleContentsAsCxx(
738-
raw_ostream &os, llvm::SmallPtrSetImpl<ImportModuleTy> &imports,
745+
EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx(
746+
raw_ostream &os,
739747
ModuleDecl &M, SwiftToClangInteropContext &interopContext,
740748
bool requiresExposedAttribute) {
741749
std::string moduleContentsBuf;
742750
llvm::raw_string_ostream moduleOS{moduleContentsBuf};
743751
std::string modulePrologueBuf;
744752
llvm::raw_string_ostream prologueOS{modulePrologueBuf};
753+
EmittedClangHeaderDependencyInfo info;
745754

746755
// FIXME: Use getRequiredAccess once @expose is supported.
747-
ModuleWriter writer(moduleOS, prologueOS, imports, M, interopContext,
756+
ModuleWriter writer(moduleOS, prologueOS, info.imports, M, interopContext,
748757
AccessLevel::Public, requiresExposedAttribute,
749758
OutputLanguageMode::Cxx);
750759
writer.write();
760+
info.dependsOnStandardLibrary = writer.isStdlibRequired();
751761

752762
os << "#ifndef SWIFT_PRINTED_CORE\n";
753763
os << "#define SWIFT_PRINTED_CORE\n";
@@ -778,4 +788,5 @@ void swift::printModuleContentsAsCxx(
778788
ClangSyntaxPrinter(os).printNamespace(
779789
[&](raw_ostream &os) { M.ValueDecl::getName().print(os); },
780790
[&](raw_ostream &os) { os << moduleOS.str(); });
791+
return info;
781792
}

lib/PrintAsClang/ModuleContentsWriter.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,17 @@ void printModuleContentsAsObjC(raw_ostream &os,
3636
ModuleDecl &M,
3737
SwiftToClangInteropContext &interopContext);
3838

39-
/// Prints the declarations of \p M to \p os in C++ language mode and collects
40-
/// imports in \p imports along the way.
41-
void printModuleContentsAsCxx(raw_ostream &os,
42-
llvm::SmallPtrSetImpl<ImportModuleTy> &imports,
39+
struct EmittedClangHeaderDependencyInfo {
40+
/// The set of imported modules used by this module.
41+
SmallPtrSet<ImportModuleTy, 8> imports;
42+
/// True if the printed module depends on types from the Stdlib module.
43+
bool dependsOnStandardLibrary = false;
44+
};
45+
46+
/// Prints the declarations of \p M to \p os in C++ language mode.
47+
///
48+
/// \returns Dependencies required by this module.
49+
EmittedClangHeaderDependencyInfo printModuleContentsAsCxx(raw_ostream &os,
4350
ModuleDecl &M,
4451
SwiftToClangInteropContext &interopContext,
4552
bool requiresExposedAttribute);

lib/PrintAsClang/PrintAsClang.cpp

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,6 @@ static std::string computeMacroGuard(const ModuleDecl *M) {
495495
return (llvm::Twine(M->getNameStr().upper()) + "_SWIFT_H").str();
496496
}
497497

498-
static std::string getModuleContentsCxxString(
499-
ModuleDecl &M, SmallPtrSet<ImportModuleTy, 8> &imports,
500-
SwiftToClangInteropContext &interopContext, bool requiresExposedAttribute) {
501-
std::string moduleContentsBuf;
502-
llvm::raw_string_ostream moduleContents{moduleContentsBuf};
503-
printModuleContentsAsCxx(moduleContents, imports, M, interopContext,
504-
requiresExposedAttribute);
505-
return std::move(moduleContents.str());
506-
}
507-
508498
bool swift::printAsClangHeader(raw_ostream &os, ModuleDecl *M,
509499
StringRef bridgingHeader,
510500
const FrontendOptions &frontendOpts,
@@ -524,18 +514,30 @@ bool swift::printAsClangHeader(raw_ostream &os, ModuleDecl *M,
524514
emitObjCConditional(os, [&] { os << objcModuleContents.str(); });
525515
emitCxxConditional(os, [&] {
526516
// FIXME: Expose Swift with @expose by default.
527-
bool enableCxx = frontendOpts.ExposePublicDeclsInClangHeader ||
517+
bool enableCxx = frontendOpts.ClangHeaderExposedDecls.hasValue() ||
528518
frontendOpts.EnableExperimentalCxxInteropInClangHeader ||
529519
M->DeclContext::getASTContext().LangOpts.EnableCXXInterop;
530520
if (enableCxx) {
531-
SmallPtrSet<ImportModuleTy, 8> imports;
532-
auto contents = getModuleContentsCxxString(
533-
*M, imports, interopContext,
534-
/*requiresExposedAttribute=*/
535-
!frontendOpts.ExposePublicDeclsInClangHeader);
521+
bool requiresExplicitExpose = !frontendOpts.ClangHeaderExposedDecls.hasValue() ||
522+
*frontendOpts.ClangHeaderExposedDecls == FrontendOptions::ClangHeaderExposeBehavior::HasExposeAttr;
523+
// Default dependency behavior is used when the -clang-header-expose-decls flag is not specified.
524+
bool defaultDependencyBehavior = !frontendOpts.ClangHeaderExposedDecls.hasValue();
525+
526+
std::string moduleContentsBuf;
527+
llvm::raw_string_ostream moduleContents{moduleContentsBuf};
528+
auto deps = printModuleContentsAsCxx(moduleContents, *M, interopContext,
529+
/*requiresExposedAttribute=*/requiresExplicitExpose);
536530
// FIXME: In ObjC++ mode, we do not need to reimport duplicate modules.
537-
writeImports(os, imports, *M, bridgingHeader, /*useCxxImport=*/true);
538-
os << contents;
531+
writeImports(os, deps.imports, *M, bridgingHeader, /*useCxxImport=*/true);
532+
533+
// Embed the standard library directly.
534+
if (defaultDependencyBehavior && deps.dependsOnStandardLibrary) {
535+
assert(!M->isStdlibModule());
536+
SwiftToClangInteropContext interopContext(*M->getASTContext().getStdlibModule(), irGenOpts);
537+
printModuleContentsAsCxx(os, *M->getASTContext().getStdlibModule(), interopContext, /*requiresExposedAttribute=*/true);
538+
}
539+
540+
os << moduleContents.str();
539541
}
540542
});
541543
writeEpilogue(os);

test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx-execution.cpp

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

44
// RUN: %target-swift-frontend -parse-as-library %platform-module-dir/Swift.swiftmodule/%module-target-triple.swiftinterface -enable-library-evolution -disable-objc-attr-requires-foundation-module -typecheck -module-name Swift -parse-stdlib -enable-experimental-cxx-interop -emit-clang-header-path %t/Swift.h -experimental-skip-all-function-bodies
55

6-
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxx -emit-clang-header-path %t/UseCxx.h -I %t -enable-experimental-cxx-interop -clang-header-expose-public-decls
6+
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxx -emit-clang-header-path %t/UseCxx.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=all-public
77

88
// RUN: %target-interop-build-clangxx -std=c++20 -c %t/use-swift-cxx-types.cpp -I %t -o %t/swift-cxx-execution.o -g
99
// RUN: %target-interop-build-swift %t/use-cxx-types.swift -o %t/swift-cxx-execution -Xlinker %t/swift-cxx-execution.o -module-name UseCxx -Xfrontend -entry-point-function-name -Xfrontend swiftMain -I %t -g

test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxxTy -emit-clang-header-path %t/UseCxxTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-public-decls
4+
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxxTy -emit-clang-header-path %t/UseCxxTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=all-public
55

66
// RUN: %FileCheck %s < %t/UseCxxTy.h
77

8-
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxxTy -emit-clang-header-path %t/UseCxxTyExposeOnly.h -I %t -enable-experimental-cxx-interop
8+
// RUN: %target-swift-frontend -typecheck %t/use-cxx-types.swift -typecheck -module-name UseCxxTy -emit-clang-header-path %t/UseCxxTyExposeOnly.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr
99

1010
// RUN: %FileCheck %s < %t/UseCxxTyExposeOnly.h
1111

test/Interop/ObjCToSwiftToObjCxx/bridge-objc-types-back-to-objcxx-execution.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-public-decls
4+
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=all-public
55

66
// RUN: %target-interop-build-clangxx -std=c++20 -fobjc-arc -c %t/use-swift-objc-types.mm -I %t -o %t/swift-objc-execution.o
77
// RUN: %target-interop-build-swift %t/use-objc-types.swift -o %t/swift-objc-execution -Xlinker %t/swift-objc-execution.o -module-name UseObjCTy -Xfrontend -entry-point-function-name -Xfrontend swiftMain -I %t

test/Interop/ObjCToSwiftToObjCxx/bridge-objc-types-back-to-objcxx.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-public-decls
4+
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTy.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=all-public
55

66
// RUN: %FileCheck %s < %t/UseObjCTy.h
77

8-
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTyExposeOnly.h -I %t -enable-experimental-cxx-interop
8+
// RUN: %target-swift-frontend -typecheck %t/use-objc-types.swift -typecheck -module-name UseObjCTy -emit-clang-header-path %t/UseObjCTyExposeOnly.h -I %t -enable-experimental-cxx-interop -clang-header-expose-decls=has-expose-attr
99

1010
// RUN: %FileCheck %s < %t/UseObjCTyExposeOnly.h
1111

test/Interop/SwiftToC/functions/swift-function-argument-keyword-in-c.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
33
// RUN: %FileCheck %s < %t/functions.h
44

55
// CHECK: SWIFT_EXTERN void $s9Functions19testKeywordArgument8registerySi_tF(ptrdiff_t register_) SWIFT_NOEXCEPT SWIFT_CALL;

test/Interop/SwiftToC/functions/swift-primitive-functions-c-bridging-long-lp64.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
33
// RUN: %FileCheck %s < %t/functions.h
44

55
// RUN: %check-interop-c-header-in-clang(%t/functions.h)

test/Interop/SwiftToC/functions/swift-primitive-functions-c-bridging.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
33
// RUN: %FileCheck %s < %t/functions.h
44

55
// RUN: %check-interop-c-header-in-clang(%t/functions.h)

test/Interop/SwiftToC/functions/swift-primitive-functions-execution-long-lp64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend %S/swift-primitive-functions-c-bridging-long-lp64.swift -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
3+
// RUN: %target-swift-frontend %S/swift-primitive-functions-c-bridging-long-lp64.swift -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
44

55
// RUN: %target-interop-build-clang -c %s -I %t -o %t/swift-functions-execution.o
66
// RUN: %target-interop-build-swift %S/swift-primitive-functions-c-bridging-long-lp64.swift -o %t/swift-functions-execution -Xlinker %t/swift-functions-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain

test/Interop/SwiftToC/functions/swift-primitive-functions-execution.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend %S/swift-primitive-functions-c-bridging.swift -typecheck -module-name Functions -clang-header-expose-public-decls -emit-clang-header-path %t/functions.h
3+
// RUN: %target-swift-frontend %S/swift-primitive-functions-c-bridging.swift -typecheck -module-name Functions -clang-header-expose-decls=all-public -emit-clang-header-path %t/functions.h
44

55
// RUN: %target-interop-build-clang -c %s -I %t -o %t/swift-functions-execution.o
66
// RUN: %target-interop-build-swift %S/swift-primitive-functions-c-bridging.swift -o %t/swift-functions-execution -Xlinker %t/swift-functions-execution.o -module-name Functions -Xfrontend -entry-point-function-name -Xfrontend swiftMain

test/Interop/SwiftToC/structs/large-structs-pass-return-indirect-in-c-execution.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend %S/large-structs-pass-return-indirect-in-c.swift -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
3+
// RUN: %target-swift-frontend %S/large-structs-pass-return-indirect-in-c.swift -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
44

55
// RUN: %target-interop-build-clang -c %s -I %t -o %t/swift-structs-execution.o
66
// RUN: %target-interop-build-swift %S/large-structs-pass-return-indirect-in-c.swift -o %t/swift-structs-execution -Xlinker %t/swift-structs-execution.o -module-name Structs -Xfrontend -entry-point-function-name -Xfrontend swiftMain

test/Interop/SwiftToC/structs/large-structs-pass-return-indirect-in-c.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
33
// RUN: %FileCheck %s < %t/structs.h
44

55
// RUN: %check-interop-c-header-in-clang(%t/structs.h)

test/Interop/SwiftToC/structs/small-structs-64-bit-pass-return-direct-in-c.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
33
// RUN: %FileCheck %s < %t/structs.h
44

55
// RUN: %check-interop-c-header-in-clang(%t/structs.h -Wno-unused-function)

test/Interop/SwiftToC/structs/small-structs-pass-return-direct-in-c-execution.c

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

33
// RUN: cat %S/small-structs-pass-return-direct-in-c.swift %S/small-structs-64-bit-pass-return-direct-in-c.swift > %t/full-small-structs-pass-return-direct-in-c.swift
44

5-
// RUN: %target-swift-frontend %t/full-small-structs-pass-return-direct-in-c.swift -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
5+
// RUN: %target-swift-frontend %t/full-small-structs-pass-return-direct-in-c.swift -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
66

77
// RUN: %target-interop-build-clang -c %s -I %t -o %t/swift-structs-execution.o -Wno-incompatible-pointer-types
88
// RUN: %target-interop-build-swift %t/full-small-structs-pass-return-direct-in-c.swift -o %t/swift-structs-execution -Xlinker %t/swift-structs-execution.o -module-name Structs -Xfrontend -entry-point-function-name -Xfrontend swiftMain

test/Interop/SwiftToC/structs/small-structs-pass-return-direct-in-c.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-public-decls -emit-clang-header-path %t/structs.h
2+
// RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h
33
// RUN: %FileCheck %s < %t/structs.h
44

55
// RUN: %check-interop-c-header-in-clang(%t/structs.h -Wno-unused-function)

test/Interop/SwiftToCxx/class/class-api-prohibited.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend %S/swift-class-in-cxx.swift -typecheck -module-name Class -clang-header-expose-public-decls -emit-clang-header-path %t/class.h
3+
// RUN: %target-swift-frontend %S/swift-class-in-cxx.swift -typecheck -module-name Class -clang-header-expose-decls=all-public -emit-clang-header-path %t/class.h
44

55
// RUN: not %target-interop-build-clangxx -c %s -I %t -o %t/swift-class-execution.o
66

0 commit comments

Comments
 (0)