Home | History | Annotate | Download | only in CodeGenCXX
      1 // RUN: %clang_cc1 -emit-llvm %s -triple x86_64-apple-darwin9 -o %t
      2 struct C {
      3   void f();
      4   void g(int, ...);
      5 };
      6 
      7 // RUN: grep "define void @_ZN1C1fEv" %t | count 1
      8 void C::f() {
      9 }
     10 
     11 void 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 
     22 struct S {
     23   // RUN: grep "define linkonce_odr void @_ZN1SC1Ev.*unnamed_addr" %t
     24   inline S() { }
     25   // RUN: grep "define linkonce_odr void @_ZN1SC1Ev.*unnamed_addr" %t
     26   inline ~S() { }
     27 
     28 
     29   // RUN: grep "define linkonce_odr void @_ZN1S9f_inline1Ev" %t
     30   void f_inline1() { }
     31   // RUN: grep "define linkonce_odr void @_ZN1S9f_inline2Ev" %t
     32   inline void f_inline2() { }
     33 
     34   // RUN: grep "define linkonce_odr void @_ZN1S1gEv" %t
     35   static void g() { }
     36 
     37   static void f();
     38 };
     39 
     40 // RUN: grep "define void @_ZN1S1fEv" %t
     41 void S::f() {
     42 }
     43 
     44 void test2() {
     45   S s;
     46 
     47   s.f_inline1();
     48   s.f_inline2();
     49 
     50   S::g();
     51 
     52 }
     53 
     54 struct T {
     55   T operator+(const T&);
     56 };
     57 
     58 void test3() {
     59   T t1, t2;
     60 
     61   // RUN: grep "call void @_ZN1TplERKS_" %t
     62   T result = t1 + t2;
     63 }
     64