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 | d55a71d | 2009-04-22 00:03:30 +0000 | [diff] [blame^] | 9 | // RUN: grep "define available_externally void @gnu_ei_inline()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 10 | |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 11 | // RUN: echo "\nC99 tests:" && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 12 | // RUN: clang %s -emit-llvm -S -o %t -std=c99 && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 13 | // RUN: grep "define i32 @ei()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 14 | // RUN: grep "define available_externally i32 @foo()" %t && |
| 15 | // RUN: grep "define i32 @bar()" %t && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 16 | // RUN: not grep unreferenced1 %t && |
| 17 | // RUN: grep "define void @unreferenced2()" %t && |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 18 | // RUN: grep "define void @gnu_inline()" %t && |
Chris Lattner | d55a71d | 2009-04-22 00:03:30 +0000 | [diff] [blame^] | 19 | // RUN: grep "define available_externally void @gnu_ei_inline()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 20 | |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 21 | // RUN: echo "\nC++ tests:" && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 22 | // RUN: clang %s -emit-llvm -S -o %t -std=c++98 && |
Chris Lattner | cbb8fc1 | 2009-04-14 20:25:53 +0000 | [diff] [blame] | 23 | // RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t && |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 24 | // RUN: grep "define linkonce_odr i32 @_Z3foov()" %t && |
| 25 | // RUN: grep "define i32 @_Z3barv()" %t && |
Chris Lattner | 86daeee | 2009-04-14 16:44:36 +0000 | [diff] [blame] | 26 | // RUN: not grep unreferenced %t && |
Chris Lattner | d55a71d | 2009-04-22 00:03:30 +0000 | [diff] [blame^] | 27 | // RUN: grep "define void @_Z10gnu_inlinev()" %t && |
| 28 | // RUN: grep "define available_externally void @_Z13gnu_ei_inlinev()" %t |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 29 | |
| 30 | extern inline int ei() { return 123; } |
| 31 | |
| 32 | inline int foo() { |
| 33 | return ei(); |
| 34 | } |
| 35 | |
| 36 | int bar() { return foo(); } |
| 37 | |
| 38 | |
Chris Lattner | dbb5a37 | 2009-04-14 06:44:48 +0000 | [diff] [blame] | 39 | inline void unreferenced1() {} |
| 40 | extern inline void unreferenced2() {} |
Chris Lattner | d9d049a | 2009-04-14 06:27:57 +0000 | [diff] [blame] | 41 | |
Chris Lattner | cf2a721 | 2009-04-20 19:12:28 +0000 | [diff] [blame] | 42 | __inline __attribute((__gnu_inline__)) void gnu_inline() {} |
Chris Lattner | d55a71d | 2009-04-22 00:03:30 +0000 | [diff] [blame^] | 43 | |
| 44 | // PR3988 |
| 45 | extern inline __attribute__((gnu_inline)) void gnu_ei_inline() {} |
| 46 | void (*P)() = gnu_ei_inline; |
| 47 | |