Files
swift-mirror/test/ModuleInterface/full-convention.swift
Allan Shortlidge d3dbe75419 ModuleInterface: Introduce the %target-swift-emit-module-interface and %target-swift-typecheck-module-from-interface lit substitutions and adopt them in some tests that involve emitting a swiftinterface. The substitutions specify the additional flags -swift-version 5 -enable-library-evolution. There are a few motivations for adding these substitutions:
- Tests that depend on emitted interfaces should generally use flags that are typical for modules that have textual interfaces (e.g. `-enable-library-evolution`).
- If a test is intended to produce a valid `swiftinterface` then it should verify that interface. This will help prevent interface printing regressions caused by compiler changes.
- Having commonly used substitutions for tests that emit interfaces makes it easy to experiment with compiler flags that might effect interface printing.

Resolves rdar://91634358
2022-04-14 15:09:36 -07:00

56 lines
2.5 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -swift-version 5 -emit-module-interface-path %t/full-convention.swiftinterface -enable-library-evolution %s -experimental-print-full-convention -use-clang-function-types
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck-module-from-interface %t/full-convention.swiftinterface
// RUN: %FileCheck %s < %t/full-convention.swiftinterface
import ctypes
public func f(
// CHECK: g: @convention(c)
g: @convention(c) () -> (),
// CHECK: h0: @convention(c)
h0: @convention(c) (Int64) -> Int32,
// CHECK: h1: @convention(c)
h1: @convention(c, cType: "int (*)(long long)") (Int64) -> Int32,
// CHECK: h1c: @convention(c, cType: "intptr_t (*)(size_t)")
h1c: @convention(c, cType: "intptr_t (*)(size_t)") (Int) -> Int,
// CHECK: i0: @convention(c)
i0: @convention(c) (Int64, Int32) -> Optional<UnsafeMutablePointer<Int32>>,
// CHECK: i1: @convention(c)
i1: @convention(c, cType: "int *(*)(long long, int)") (Int64, Int32) -> Optional<UnsafeMutablePointer<Int32>>,
// CHECK: i1c: @convention(c, cType: "size_t *(*)(intptr_t, ptrdiff_t)")
i1c: @convention(c, cType: "size_t *(*)(intptr_t, ptrdiff_t)") (Int, Int) -> Optional<UnsafeMutablePointer<Int>>,
// CHECK: p0: @convention(c)
// CHECK: @convention(c)
p0: @convention(c) (@convention(c) (Int32) -> Void) -> Void,
// CHECK: p1: @convention(c)
// CHECK: @convention(c)
p1: @convention(c, cType: "void (*)(void (*)(int))") (@convention(c) (Int32) -> Void) -> Void,
// CHECK: p1c: @convention(c, cType: "void (*)(void (*)(size_t))")
// CHECK: @convention(c)
p1c: @convention(c, cType: "void (*)(void (*)(size_t))") (@convention(c) (Int) -> Void) -> Void,
// CHECK: p2: @convention(c)
// CHECK: @convention(c)
p2: @convention(c) (@convention(c, cType: "void (*)(int)") (Int32) -> Void) -> Void,
// CHECK: p2c: @convention(c)
// CHECK: @convention(c, cType: "void (*)(size_t)")
p2c: @convention(c) (@convention(c, cType: "void (*)(size_t)") (Int) -> Void) -> Void,
// CHECK: p3: @convention(c)
// CHECK: @convention(c)
p3: @convention(c, cType: "void (*)(void (*)(int))") (@convention(c, cType: "void (*)(int)") (Int32) -> Void) -> Void,
// CHECK: p3c: @convention(c)
// CHECK: @convention(c, cType: "void (*)(size_t)")
p3c: @convention(c, cType: "void (*)(void (*)(size_t))") (@convention(c, cType: "void (*)(size_t)") (Int) -> Void) -> Void
) {}