File: ownership_specifier_mangling.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 (90 lines) | stat: -rw-r--r-- 6,575 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// RUN: %target-swift-emit-silgen %s | %FileCheck %s

// The internal `__shared` and `__owned` modifiers would always affect
// symbol mangling, even if they don't have a concrete impact on ABI. The
// The public `borrowing` and `consuming` modifiers are only supposed to
// affect symbol mangling when they would change the default ABI behavior.

// CHECK-LABEL: @$s28ownership_specifier_mangling17officialModifiersyySS_SStF
func officialModifiers(_: String, _: String) {}
// CHECK-LABEL: @$s28ownership_specifier_mangling17officialModifiersyySS_SSntF
func officialModifiers(_: borrowing String, _: consuming String) {}
// CHECK-LABEL: @$s28ownership_specifier_mangling17officialModifiersyySSn_SStF
func officialModifiers(_: consuming String, _: borrowing String) {}

// CHECK-LABEL: @$s28ownership_specifier_mangling15legacyModifiersyySS_SStF
func legacyModifiers(_: String, _: String) {}
// CHECK-LABEL: @$s28ownership_specifier_mangling15legacyModifiersyySSh_SSntF
func legacyModifiers(_: __shared String, _: __owned String) {}
// CHECK-LABEL: @$s28ownership_specifier_mangling15legacyModifiersyySSn_SShtF
func legacyModifiers(_: __owned String, _: __shared String) {}

class Foo {
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC17officialModifiers_ACSS_SStcfc
    init(officialModifiers: String, _: String) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC17officialModifiers_ACSSh_SStcfc
    init(officialModifiers: borrowing String, _: consuming String) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC17officialModifiers_ACSS_SShtcfc
    init(officialModifiers: consuming String, _: borrowing String) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC15legacyModifiers_ACSS_SStcfc
    init(legacyModifiers: String, _: String) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC15legacyModifiers_ACSSh_SSntcfc
    init(legacyModifiers: __shared String, _: __owned String) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC15legacyModifiers_ACSSn_SShtcfc
    init(legacyModifiers: __owned String, _: __shared String) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosureyyySS_SStXEF
    func officialModifiersInClosure(_: (String, String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosure2bcyySS_SSntXE_tF
    func officialModifiersInClosure(bc: (borrowing String, consuming String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosure2cbyySSn_SStXE_tF
    func officialModifiersInClosure(cb: (consuming String, borrowing String) -> ()) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosureyyySS_SStXEF
    func legacyModifiersInClosure(_: (String, String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosure2bcyySSh_SSntXE_tF
    func legacyModifiersInClosure(bc: (__shared String, __owned String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosure2cbyySSn_SShtXE_tF
    func legacyModifiersInClosure(cb: (__owned String, __shared String) -> ()) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosureACySS_SStXE_tcfc
    init(officialModifiersInClosure: (String, String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_bcACySS_SSntXE_tcfc
    init(officialModifiersInClosure_bc: (borrowing String, consuming String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_cbACySSn_SStXE_tcfc
    init(officialModifiersInClosure_cb: (consuming String, borrowing String) -> ()) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosureACySS_SStXE_tcfc
    init(legacyModifiersInClosure: (String, String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_bcACySSh_SSntXE_tcfc
    init(legacyModifiersInClosure_bc: (__shared String, __owned String) -> ()) {}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_cbACySSn_SShtXE_tcfc
    init(legacyModifiersInClosure_cb: (__owned String, __shared String) -> ()) {}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosureyySS_SStcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosureyySS_SStcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC26officialModifiersInClosureyySS_SStcvM
    var officialModifiersInClosure: (String, String) -> () = {_,_ in}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_bcyySS_SSntcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_bcyySS_SSntcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_bcyySS_SSntcvM
    var officialModifiersInClosure_bc: (borrowing String, consuming String) -> () = {_,_ in}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_cbyySSn_SStcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_cbyySSn_SStcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC29officialModifiersInClosure_cbyySSn_SStcvM
    var officialModifiersInClosure_cb: (consuming String, borrowing String) -> () = {_,_ in}

    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosureyySS_SStcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosureyySS_SStcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC24legacyModifiersInClosureyySS_SStcvM
    var legacyModifiersInClosure: (String, String) -> () = {_,_ in}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_bcyySSh_SSntcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_bcyySSh_SSntcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_bcyySSh_SSntcvM
    var legacyModifiersInClosure_bc: (__shared String, __owned String) -> () = {_,_ in}
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_cbyySSn_SShtcvg
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_cbyySSn_SShtcvs
    // CHECK-LABEL: @$s28ownership_specifier_mangling3FooC27legacyModifiersInClosure_cbyySSn_SShtcvM
    var legacyModifiersInClosure_cb: (__owned String, __shared String) -> () = {_,_ in}
}