File: full-convention.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (55 lines) | stat: -rw-r--r-- 2,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// 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
) {}