Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s |
Anders Carlsson | 7a039eb | 2009-08-15 22:30:50 +0000 | [diff] [blame] | 2 | struct A { |
3 | A(); | ||||
4 | ~A(); | ||||
5 | void f(); | ||||
6 | }; | ||||
7 | |||||
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 8 | void f1() { |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 9 | // CHECK: call void @_ZN1AC1Ev |
10 | // CHECK: call void @_ZN1AD1Ev | ||||
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 11 | (void)A(); |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 12 | |
13 | // CHECK: call void @_ZN1AC1Ev | ||||
14 | // CHECK: call void @_ZN1AD1Ev | ||||
Anders Carlsson | 7a039eb | 2009-08-15 22:30:50 +0000 | [diff] [blame] | 15 | A().f(); |
16 | } | ||||
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 17 | |
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 18 | // Function calls |
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 19 | struct B { |
20 | B(); | ||||
21 | ~B(); | ||||
22 | }; | ||||
23 | |||||
24 | B g(); | ||||
25 | |||||
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 26 | void f2() { |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 27 | // CHECK-NOT: call void @_ZN1BC1Ev |
28 | // CHECK: call void @_ZN1BD1Ev | ||||
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 29 | (void)g(); |
30 | } | ||||
31 | |||||
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 32 | // Member function calls |
33 | struct C { | ||||
34 | C(); | ||||
35 | ~C(); | ||||
36 | |||||
37 | C f(); | ||||
38 | }; | ||||
39 | |||||
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 40 | void f3() { |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 41 | // CHECK: call void @_ZN1CC1Ev |
42 | // CHECK: call void @_ZN1CD1Ev | ||||
43 | // CHECK: call void @_ZN1CD1Ev | ||||
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 44 | C().f(); |
45 | } | ||||
46 | |||||
Anders Carlsson | a303f9e | 2009-08-16 03:53:54 +0000 | [diff] [blame] | 47 | // Function call operator |
48 | struct D { | ||||
49 | D(); | ||||
50 | ~D(); | ||||
51 | |||||
52 | D operator()(); | ||||
53 | }; | ||||
54 | |||||
Anders Carlsson | a303f9e | 2009-08-16 03:53:54 +0000 | [diff] [blame] | 55 | void f4() { |
Benjamin Kramer | 3114af3 | 2009-10-31 20:42:26 +0000 | [diff] [blame] | 56 | // CHECK: call void @_ZN1DC1Ev |
57 | // CHECK: call void @_ZN1DD1Ev | ||||
58 | // CHECK: call void @_ZN1DD1Ev | ||||
Anders Carlsson | a303f9e | 2009-08-16 03:53:54 +0000 | [diff] [blame] | 59 | D()(); |
60 | } | ||||
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 61 | |
Anders Carlsson | 2d46eb2 | 2009-08-16 04:11:06 +0000 | [diff] [blame] | 62 | // Overloaded operators |
63 | struct E { | ||||
64 | E(); | ||||
65 | ~E(); | ||||
66 | E operator+(const E&); | ||||
67 | E operator!(); | ||||
68 | }; | ||||
69 | |||||
Anders Carlsson | 2d46eb2 | 2009-08-16 04:11:06 +0000 | [diff] [blame] | 70 | void f5() { |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 71 | // CHECK: call void @_ZN1EC1Ev |
72 | // CHECK: call void @_ZN1EC1Ev | ||||
73 | // CHECK: call void @_ZN1ED1Ev | ||||
74 | // CHECK: call void @_ZN1ED1Ev | ||||
75 | // CHECK: call void @_ZN1ED1Ev | ||||
Anders Carlsson | 2d46eb2 | 2009-08-16 04:11:06 +0000 | [diff] [blame] | 76 | E() + E(); |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 77 | |
78 | // CHECK: call void @_ZN1EC1Ev | ||||
79 | // CHECK: call void @_ZN1ED1Ev | ||||
80 | // CHECK: call void @_ZN1ED1Ev | ||||
Anders Carlsson | 2d46eb2 | 2009-08-16 04:11:06 +0000 | [diff] [blame] | 81 | !E(); |
82 | } | ||||
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame] | 83 | |
Anders Carlsson | 283e4d5 | 2009-09-14 01:30:44 +0000 | [diff] [blame] | 84 | struct F { |
85 | F(); | ||||
86 | ~F(); | ||||
87 | F& f(); | ||||
88 | }; | ||||
89 | |||||
Anders Carlsson | 283e4d5 | 2009-09-14 01:30:44 +0000 | [diff] [blame] | 90 | void f6() { |
Anders Carlsson | fa4f550 | 2009-10-18 21:11:11 +0000 | [diff] [blame] | 91 | // CHECK: call void @_ZN1FC1Ev |
92 | // CHECK: call void @_ZN1FD1Ev | ||||
Anders Carlsson | 283e4d5 | 2009-09-14 01:30:44 +0000 | [diff] [blame] | 93 | F().f(); |
94 | } | ||||
95 | |||||
Anders Carlsson | 4fa2684 | 2009-10-18 21:20:14 +0000 | [diff] [blame] | 96 | struct G { |
97 | G(); | ||||
98 | G(A); | ||||
99 | ~G(); | ||||
100 | operator A(); | ||||
101 | }; | ||||
102 | |||||
103 | void a(const A&); | ||||
104 | |||||
105 | void f7() { | ||||
106 | // CHECK: call void @_ZN1AC1Ev | ||||
107 | // CHECK: call void @_Z1aRK1A | ||||
108 | // CHECK: call void @_ZN1AD1Ev | ||||
109 | a(A()); | ||||
110 | |||||
111 | // CHECK: call void @_ZN1GC1Ev | ||||
112 | // CHECK: call void @_ZN1Gcv1AEv | ||||
113 | // CHECK: call void @_Z1aRK1A | ||||
114 | // CHECK: call void @_ZN1AD1Ev | ||||
115 | // CHECK: call void @_ZN1GD1Ev | ||||
116 | a(G()); | ||||
117 | } | ||||
Anders Carlsson | 1faf674 | 2009-11-06 04:11:09 +0000 | [diff] [blame^] | 118 | |
119 | namespace PR5077 { | ||||
120 | |||||
121 | struct A { | ||||
122 | A(); | ||||
123 | ~A(); | ||||
124 | int f(); | ||||
125 | }; | ||||
126 | |||||
127 | void f(); | ||||
128 | int g(const A&); | ||||
129 | |||||
130 | struct B { | ||||
131 | int a1; | ||||
132 | int a2; | ||||
133 | B(); | ||||
134 | }; | ||||
135 | |||||
136 | B::B() | ||||
137 | // CHECK: call void @_ZN6PR50771AC1Ev | ||||
138 | // CHECK: call i32 @_ZN6PR50771A1fEv | ||||
139 | // CHECK: call void @_ZN6PR50771AD1Ev | ||||
140 | : a1(A().f()) | ||||
141 | // CHECK: call void @_ZN6PR50771AC1Ev | ||||
142 | // CHECK: call i32 @_ZN6PR50771gERKNS_1AE | ||||
143 | // CHECK: call void @_ZN6PR50771AD1Ev | ||||
144 | , a2(g(A())) | ||||
145 | { | ||||
146 | // CHECK: call void @_ZN6PR50771fEv | ||||
147 | f(); | ||||
148 | } | ||||
149 | |||||
150 | } |