blob: 737bf65b47345ca65be665d7515219126a9513b9 [file] [log] [blame]
Anders Carlsson7a039eb2009-08-15 22:30:50 +00001// RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 &&
2struct A {
3 A();
4 ~A();
5 void f();
6};
7
Anders Carlssonec74c592009-08-16 03:06:32 +00008// RUN: grep "call void @_ZN1AC1Ev" %t | count 2 &&
9// RUN: grep "call void @_ZN1AD1Ev" %t | count 2 &&
10void f1() {
11 (void)A();
Anders Carlsson7a039eb2009-08-15 22:30:50 +000012 A().f();
13}
Anders Carlssonec74c592009-08-16 03:06:32 +000014
Anders Carlsson6f680272009-08-16 03:42:12 +000015// Function calls
Anders Carlssonec74c592009-08-16 03:06:32 +000016struct B {
17 B();
18 ~B();
19};
20
21B g();
22
23// RUN: grep "call void @_ZN1BC1Ev" %t | count 0 &&
Anders Carlsson6f680272009-08-16 03:42:12 +000024// RUN: grep "call void @_ZN1BD1Ev" %t | count 1 &&
Anders Carlssonec74c592009-08-16 03:06:32 +000025void f2() {
26 (void)g();
27}
28
Anders Carlsson6f680272009-08-16 03:42:12 +000029// Member function calls
30struct C {
31 C();
32 ~C();
33
34 C f();
35};
36
37// RUN: grep "call void @_ZN1CC1Ev" %t | count 1 &&
Anders Carlssona303f9e2009-08-16 03:53:54 +000038// RUN: grep "call void @_ZN1CD1Ev" %t | count 2 &&
Anders Carlsson6f680272009-08-16 03:42:12 +000039void f3() {
40 C().f();
41}
42
Anders Carlssona303f9e2009-08-16 03:53:54 +000043// Function call operator
44struct D {
45 D();
46 ~D();
47
48 D operator()();
49};
50
51// RUN: grep "call void @_ZN1DC1Ev" %t | count 1 &&
52// RUN: grep "call void @_ZN1DD1Ev" %t | count 2
53void f4() {
54 D()();
55}
Anders Carlsson6f680272009-08-16 03:42:12 +000056
57