Anders Carlsson | 7a039eb | 2009-08-15 22:30:50 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm %s -o %t -triple=x86_64-apple-darwin9 && |
| 2 | struct A { |
| 3 | A(); |
| 4 | ~A(); |
| 5 | void f(); |
| 6 | }; |
| 7 | |
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 8 | // RUN: grep "call void @_ZN1AC1Ev" %t | count 2 && |
| 9 | // RUN: grep "call void @_ZN1AD1Ev" %t | count 2 && |
| 10 | void f1() { |
| 11 | (void)A(); |
Anders Carlsson | 7a039eb | 2009-08-15 22:30:50 +0000 | [diff] [blame] | 12 | A().f(); |
| 13 | } |
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 14 | |
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame^] | 15 | // Function calls |
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 16 | struct B { |
| 17 | B(); |
| 18 | ~B(); |
| 19 | }; |
| 20 | |
| 21 | B g(); |
| 22 | |
| 23 | // RUN: grep "call void @_ZN1BC1Ev" %t | count 0 && |
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame^] | 24 | // RUN: grep "call void @_ZN1BD1Ev" %t | count 1 && |
Anders Carlsson | ec74c59 | 2009-08-16 03:06:32 +0000 | [diff] [blame] | 25 | void f2() { |
| 26 | (void)g(); |
| 27 | } |
| 28 | |
Anders Carlsson | 6f68027 | 2009-08-16 03:42:12 +0000 | [diff] [blame^] | 29 | // Member function calls |
| 30 | struct C { |
| 31 | C(); |
| 32 | ~C(); |
| 33 | |
| 34 | C f(); |
| 35 | }; |
| 36 | |
| 37 | // RUN: grep "call void @_ZN1CC1Ev" %t | count 1 && |
| 38 | // RUN: grep "call void @_ZN1CD1Ev" %t | count 2 |
| 39 | void f3() { |
| 40 | C().f(); |
| 41 | } |
| 42 | |
| 43 | |
| 44 | |