member-functions.cpp revision 0c337ed63ff0f04fd8315afabb2d7a51969fdc97
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  S() { }
24  ~S() { }
25
26
27  void f_inline1() { }
28  // RUN: grep "define linkonce_odr void @_ZN1S9f_inline2Ev" %t &&
29  inline void f_inline2() { }
30
31  // RUN: grep "define internal void @_ZN1S1gEv" %t
32  static void g() { }
33};
34
35void test2() {
36  S s;
37
38  s.f_inline1();
39  s.f_inline2();
40
41  S::g();
42
43}
44