forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmangling.swift
42 lines (37 loc) · 1.95 KB
/
mangling.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
37
38
39
40
41
42
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
// Type:
// Swift.Dictionary<Swift.Int64, Swift.String>
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Dictionary",{{.*}} identifier: [[DT:[^,)]+]])
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "_TtT4NameSS2IdVs5Int64_",{{.*}} identifier: [[TT1:[^,)]+]])
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "_TtTSS2IdVs5Int64_",{{.*}} identifier: [[TT2:[^,)]+]])
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "_TtTSSVs5Int64_",{{.*}} identifier: [[TT3:[^,)]+]])
func markUsed<T>(t: T) {}
// Variable:
// mangling.myDict : Swift.Dictionary<Swift.Int64, Swift.String>
// CHECK: !DIGlobalVariable(name: "myDict",
// CHECK-SAME: linkageName: "_Tv8mangling6myDictGVs10DictionaryVs5Int64SS_",
// CHECK-SAME: line: [[@LINE+2]]
// CHECK-SAME: type: ![[DT]]
var myDict = Dictionary<Int64, String>()
myDict[12] = "Hello!"
// mangling.myTuple1 : (Name : Swift.String, Id : Swift.Int64)
// CHECK: !DIGlobalVariable(name: "myTuple1",
// CHECK-SAME: linkageName: "_Tv8mangling8myTuple1T4NameSS2IdVs5Int64_",
// CHECK-SAME: line: [[@LINE+2]]
// CHECK-SAME: type: ![[TT1]]
var myTuple1 : (Name: String, Id: Int64) = ("A", 1)
// mangling.myTuple2 : (Swift.String, Id : Swift.Int64)
// CHECK: !DIGlobalVariable(name: "myTuple2",
// CHECK-SAME: linkageName: "_Tv8mangling8myTuple2TSS2IdVs5Int64_",
// CHECK-SAME: line: [[@LINE+2]]
// CHECK-SAME: type: ![[TT2]]
var myTuple2 : ( String, Id: Int64) = ("B", 2)
// mangling.myTuple3 : (Swift.String, Swift.Int64)
// CHECK: !DIGlobalVariable(name: "myTuple3",
// CHECK-SAME: linkageName: "_Tv8mangling8myTuple3TSSVs5Int64_",
// CHECK-SAME: line: [[@LINE+2]]
// CHECK-SAME: type: ![[TT3]]
var myTuple3 : ( String, Int64) = ("C", 3)
markUsed(myTuple1.Id)
markUsed(myTuple2.Id)
markUsed({ $0.1 }(myTuple3))