Skip to content

Commit 1bdefa1

Browse files
authored
Merge pull request #78219 from swiftlang/gaborh/cxx-to-objc
[cxx-interop] Fix assert failure exporting C++ types to Obj-C
2 parents b6def6e + e340773 commit 1bdefa1

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

lib/PrintAsClang/PrintClangFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ ClangRepresentation DeclAndTypeClangFunctionPrinter::printFunctionSignature(
918918
interopContext, CFunctionSignatureTypePrinterModifierDelegate(),
919919
emittedModule, declPrinter);
920920
auto s = typePrinter.visit(ty, optionalKind, param.isInOut());
921-
assert(!s.isUnsupported());
921+
resultingRepresentation.merge(s);
922922
};
923923
signature.visitParameterList(
924924
[&](const LoweredFunctionSignature::IndirectResultValue
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
struct Foo {
4+
void *foo;
5+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module CxxModule [system] {
2+
header "cxxmodule.h"
3+
requires cplusplus
4+
export *
5+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %empty-directory(%t)
2+
3+
// RUN: %target-swift-frontend -typecheck %s -module-name UseCxxModule -emit-objc-header -emit-objc-header-path %t/UseCxxTy.h -I %t -I %S/Inputs -clang-header-expose-decls=all-public -cxx-interoperability-mode=default
4+
// RUN: %FileCheck %s < %t/UseCxxTy.h
5+
6+
import CxxModule
7+
8+
public func bar(x: Foo, y: UnsafeMutablePointer<UnsafeMutableRawPointer?>) {}
9+
10+
// CHECK: // Unavailable in C++: Swift global function 'bar(x:y:)'.
11+
// TODO: the message above is not correct, this is actually unavailable in Obj-C.

0 commit comments

Comments
 (0)