forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattributes.swift
36 lines (30 loc) · 1.38 KB
/
attributes.swift
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
// RUN: %swift -target x86_64-apple-darwin10 %s -emit-ir -g -o - | FileCheck %s
// CHECK-DAG: {{.*}}i32 30,{{.*}}null, metadata ![[TY0:.*]]} ; [ DW_TAG_structure_type ] [{{.*}}ObjCClass{{.*}}] [line [[@LINE+1]]
@objc class ObjCClass {
@IBAction func click(_: AnyObject?) -> () {}
}
// DW_LANG_Swift = 0xa000 [FIXME: this number will change!]
// CHECK-DAG: ![[TY1:[0-9]+]] = {{.*}}i32 30,{{.*}} [ DW_TAG_structure_type ] [{{.*}}SwiftClass{{.*}}] [line [[@LINE+1]]
class SwiftClass {
@objc func objcmethod() -> () {}
func swiftmethod() -> () {}
// Block attribute
func f(someBlock: @objc_block (Int) -> Int) {
}
}
// FIXME: This is currently elided, but should reappear eventually as
// an artificial variable.
// DISABLED: [ DW_TAG_variable ] [OBJC_METACLASS_$__TtC10attributes9ObjCClass]
// CHECK-DAG: i32 [[@LINE+1]], metadata ![[TY0]],{{.*}}[ DW_TAG_variable ] [{{.*}}strongRef0{{.*}}]
var strongRef0 : ObjCClass
var strongRef1 : SwiftClass = SwiftClass()
// CHECK-DAG: [ DW_TAG_typedef ] [_TtXwGSqC10attributes10SwiftClass_] [line [[@LINE+1]]
weak var weakRef1 : SwiftClass? = strongRef1
// CHECK-DAG: [ DW_TAG_typedef ] [_TtXoC10attributes10SwiftClass] [line [[@LINE+1]]
unowned var unownedRef1 : SwiftClass
@class_protocol protocol Protocol1 {
func foo(x: Float) -> Float
}
class Implementation : Protocol1 {
func foo(x: Float) -> Float { return 2*x }
}