Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 1 | // RUN: echo "C89 tests:" && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 2 | // RUN: clang %s -emit-llvm -S -o %t -std=c89 && |
| 3 | // RUN: grep "define available_externally i32 @ei()" %t && |
| 4 | // RUN: grep "define i32 @foo()" %t && |
| 5 | // RUN: grep "define i32 @bar()" %t && |
Chris Lattner | dbb5a37 | 2009-04-14 06:44:48 +0000 | [diff] [blame] | 6 | // RUN: grep "define void @unreferenced1()" %t && |
| 7 | // RUN: not grep unreferenced2 %t && |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 8 | // RUN: grep "define void @gnu_inline()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 9 | |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 10 | // RUN: echo "\nC99 tests:" && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 11 | // RUN: clang %s -emit-llvm -S -o %t -std=c99 && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 12 | // RUN: grep "define i32 @ei()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 13 | // RUN: grep "define available_externally i32 @foo()" %t && |
| 14 | // RUN: grep "define i32 @bar()" %t && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 15 | // RUN: not grep unreferenced1 %t && |
| 16 | // RUN: grep "define void @unreferenced2()" %t && |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 17 | // RUN: grep "define void @gnu_inline()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 18 | |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 19 | // RUN: echo "\nC++ tests:" && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 20 | // RUN: clang %s -emit-llvm -S -o %t -std=c++98 && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 21 | // RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 22 | // RUN: grep "define linkonce_odr i32 @_Z3foov()" %t && |
| 23 | // RUN: grep "define i32 @_Z3barv()" %t && |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 24 | // RUN: not grep unreferenced %t && |
| 25 | // RUN: grep "define void @_Z10gnu_inlinev()" %t |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 26 | |
| 27 | extern inline int ei() { return 123; } |
| 28 | |
| 29 | inline int foo() { |
| 30 | return ei(); |
| 31 | } |
| 32 | |
| 33 | int bar() { return foo(); } |
| 34 | |
| 35 | |
Chris Lattner | dbb5a37 | 2009-04-14 06:44:48 +0000 | [diff] [blame] | 36 | inline void unreferenced1() {} |
| 37 | extern inline void unreferenced2() {} |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 38 | |
Chris Lattner | cf2a721 | 2009-04-20 19:12:28 +0000 | [diff] [blame^] | 39 | __inline __attribute((__gnu_inline__)) void gnu_inline() {} |