forked from OSchip/llvm-project
118 lines
1.7 KiB
C++
118 lines
1.7 KiB
C++
// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
|
|
struct A {
|
|
A();
|
|
~A();
|
|
void f();
|
|
};
|
|
|
|
void f1() {
|
|
// CHECK: call void @_ZN1AC1Ev
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
(void)A();
|
|
|
|
// CHECK: call void @_ZN1AC1Ev
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
A().f();
|
|
}
|
|
|
|
// Function calls
|
|
struct B {
|
|
B();
|
|
~B();
|
|
};
|
|
|
|
B g();
|
|
|
|
void f2() {
|
|
// CHECK-NOT: call void @_ZN1BC1Ev
|
|
// CHECK: call void @_ZN1BD1Ev
|
|
(void)g();
|
|
}
|
|
|
|
// Member function calls
|
|
struct C {
|
|
C();
|
|
~C();
|
|
|
|
C f();
|
|
};
|
|
|
|
void f3() {
|
|
// CHECK: call void @_ZN1CC1Ev
|
|
// CHECK: call void @_ZN1CD1Ev
|
|
// CHECK: call void @_ZN1CD1Ev
|
|
C().f();
|
|
}
|
|
|
|
// Function call operator
|
|
struct D {
|
|
D();
|
|
~D();
|
|
|
|
D operator()();
|
|
};
|
|
|
|
void f4() {
|
|
// CHECK call void @_ZN1DC1Ev
|
|
// CHECK call void @_ZN1DD1Ev
|
|
// CHECK call void @_ZN1DD1Ev
|
|
D()();
|
|
}
|
|
|
|
// Overloaded operators
|
|
struct E {
|
|
E();
|
|
~E();
|
|
E operator+(const E&);
|
|
E operator!();
|
|
};
|
|
|
|
void f5() {
|
|
// CHECK: call void @_ZN1EC1Ev
|
|
// CHECK: call void @_ZN1EC1Ev
|
|
// CHECK: call void @_ZN1ED1Ev
|
|
// CHECK: call void @_ZN1ED1Ev
|
|
// CHECK: call void @_ZN1ED1Ev
|
|
E() + E();
|
|
|
|
// CHECK: call void @_ZN1EC1Ev
|
|
// CHECK: call void @_ZN1ED1Ev
|
|
// CHECK: call void @_ZN1ED1Ev
|
|
!E();
|
|
}
|
|
|
|
struct F {
|
|
F();
|
|
~F();
|
|
F& f();
|
|
};
|
|
|
|
void f6() {
|
|
// CHECK: call void @_ZN1FC1Ev
|
|
// CHECK: call void @_ZN1FD1Ev
|
|
F().f();
|
|
}
|
|
|
|
struct G {
|
|
G();
|
|
G(A);
|
|
~G();
|
|
operator A();
|
|
};
|
|
|
|
void a(const A&);
|
|
|
|
void f7() {
|
|
// CHECK: call void @_ZN1AC1Ev
|
|
// CHECK: call void @_Z1aRK1A
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
a(A());
|
|
|
|
// CHECK: call void @_ZN1GC1Ev
|
|
// CHECK: call void @_ZN1Gcv1AEv
|
|
// CHECK: call void @_Z1aRK1A
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
// CHECK: call void @_ZN1GD1Ev
|
|
a(G());
|
|
}
|