Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/PrintAsClang/PrintClangFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@ class CFunctionSignatureTypePrinter
return ClangRepresentation::representable;
}

ClangRepresentation
visitDynamicSelfType(DynamicSelfType *ds,
Optional<OptionalTypeKind> optionalKind,
bool isInOutParam) {
return visitPart(ds->getSelfType(), optionalKind, isInOutParam);
}

ClangRepresentation visitPart(Type Ty,
Optional<OptionalTypeKind> optionalKind,
bool isInOutParam) {
Expand Down
8 changes: 8 additions & 0 deletions test/Interop/SwiftToCxx/initializers/init-in-cxx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

// RUN: %check-interop-cxx-header-in-clang(%t/inits.h -Wno-unused-function)

// RUN: %target-swift-frontend %s -typecheck -module-name Init -clang-header-expose-decls=all-public -swift-version 5 -emit-clang-header-path %t/inits2.h
// RUN: %FileCheck %s < %t/inits2.h


// CHECK: SWIFT_EXTERN void * _Nonnull $s4Init9BaseClassCyACSi_SitcfC(ptrdiff_t x, ptrdiff_t y, SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // init(_:_:)
// CHECK-NEXT: SWIFT_EXTERN void * _Nonnull $s4Init9BaseClassCyACSicfC(ptrdiff_t x, SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // init(_:)
// CHECK-NEXT: SWIFT_EXTERN void * _Nonnull $s4Init12DerivedClassCyACSi_SitcfC(ptrdiff_t x, ptrdiff_t y, SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // init(_:_:)

// CHECK: SWIFT_EXTERN struct swift_interop_returnStub_Init_uint32_t_0_4 $s4Init16FirstSmallStructVACycfC(void) SWIFT_NOEXCEPT SWIFT_CALL; // init()
Expand Down Expand Up @@ -107,6 +111,10 @@ public class BaseClass {
public var x: Int

public init(_ x: Int, _ y: Int) { self.x = x + y }

public convenience init(_ x: Int) {
self.init(x, x * 2)
}
}

public class DerivedClass: BaseClass {
Expand Down