member-functions.cpp revision b4880bab7fc1b61267cfd9a0ad52188e7a828cb3
1// RUN: clang-cc -emit-llvm %s -o %t &&
2struct C {
3  void f();
4  void g(int, ...);
5};
6
7// RUN: grep "define void @_ZN1C1fEv" %t | count 1 &&
8void C::f() {
9}
10
11void test1() {
12  C c;
13
14// RUN: grep "call void @_ZN1C1fEv" %t | count 1 &&
15  c.f();
16
17// RUN: grep "call void (.struct.C\*, i32, ...)\* @_ZN1C1gEiz" %t | count 1 &&
18  c.g(1, 2, 3);
19}
20
21
22struct S {
23  // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t &&
24  inline S() { }
25  // RUN: grep "define linkonce_odr void @_ZN1SC1Ev" %t &&
26  inline ~S() { }
27
28
29  void f_inline1() { }
30  // RUN: grep "define linkonce_odr void @_ZN1S9f_inline2Ev" %t &&
31  inline void f_inline2() { }
32
33  // RUN: grep "define internal void @_ZN1S1gEv" %t
34  static void g() { }
35};
36
37void test2() {
38  S s;
39
40  s.f_inline1();
41  s.f_inline2();
42
43  S::g();
44
45}
46