Skip to content

Commit bdc8aee

Browse files
authored
Merge pull request #60757 from hyp/eng/expose-stdlib
[interop][SwiftToCxx] add a test to print out empty Swift stdlib module
2 parents 543e32f + e9450cf commit bdc8aee

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/PrintAsClang/ModuleContentsWriter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,10 @@ class ModuleWriter {
281281
forwardDeclare(ED);
282282
} else if (isa<AbstractTypeParamDecl>(TD)) {
283283
llvm_unreachable("should not see type params here");
284+
} else if (isa<StructDecl>(TD) &&
285+
TD->getModuleContext()->isStdlibModule()) {
286+
// stdlib has some @_cdecl functions with structs.
287+
return;
284288
} else {
285289
assert(false && "unknown local type decl");
286290
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %empty-directory(%t)
2+
// 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
3+
// RUN: %FileCheck %s < %t/Swift.h
4+
5+
// RUN: %check-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function)
6+
7+
// CHECK: namespace Swift {
8+
// CHECK: } // namespace Swift

0 commit comments

Comments
 (0)