Files
swift-mirror/test/Interop/SwiftToCxx/functions/cdecl.swift
Alex Lorenz 6b8108bf59 [cxx-interop] use SWIFT_EXTERN for Swift function prototypes
This will allow these functions to be used from C.
2022-03-13 12:11:35 -07:00

19 lines
627 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -typecheck -module-name CdeclFunctions -emit-cxx-header-path %t/cdecl.h
// RUN: %FileCheck %s < %t/cdecl.h
// RUN: %check-interop-cxx-header-in-clang(%t/cdecl.h)
// CHECK-LABEL: namespace CdeclFunctions {
// CHECK: namespace _impl {
// CHECK: SWIFT_EXTERN int cfuncPassTwo(int x, int y) SWIFT_NOEXCEPT;
// CHECK: }
@_cdecl("cfuncPassTwo")
public func differentCDeclName(x: CInt, y: CInt) -> CInt { return x + y }
// CHECK: inline int differentCDeclName(int x, int y) noexcept SWIFT_WARN_UNUSED_RESULT {
// CHECK: return _impl::cfuncPassTwo(x, y);
// CHECK: }