2009-11-08 09:45:36 +08:00
|
|
|
// RUN: echo "GNU89 tests:"
|
2009-12-16 06:01:24 +08:00
|
|
|
// RUN: %clang %s -emit-llvm -S -o %t -std=gnu89
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep "define available_externally i32 @ei()" %t
|
|
|
|
// RUN: grep "define i32 @foo()" %t
|
|
|
|
// RUN: grep "define i32 @bar()" %t
|
|
|
|
// RUN: grep "define void @unreferenced1()" %t
|
|
|
|
// RUN: not grep unreferenced2 %t
|
|
|
|
// RUN: grep "define void @gnu_inline()" %t
|
|
|
|
// RUN: grep "define available_externally void @gnu_ei_inline()" %t
|
|
|
|
// RUN: grep "define i32 @test1" %t
|
|
|
|
// RUN: grep "define i32 @test2" %t
|
|
|
|
// RUN: grep "define void @test3()" %t
|
|
|
|
// RUN: grep "define available_externally i32 @test4" %t
|
|
|
|
// RUN: grep "define available_externally i32 @test5" %t
|
2009-04-14 14:27:57 +08:00
|
|
|
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: echo "\nC99 tests:"
|
2009-12-16 06:01:24 +08:00
|
|
|
// RUN: %clang %s -emit-llvm -S -o %t -std=c99
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep "define i32 @ei()" %t
|
|
|
|
// RUN: grep "define available_externally i32 @foo()" %t
|
|
|
|
// RUN: grep "define i32 @bar()" %t
|
|
|
|
// RUN: not grep unreferenced1 %t
|
|
|
|
// RUN: grep "define void @unreferenced2()" %t
|
|
|
|
// RUN: grep "define void @gnu_inline()" %t
|
|
|
|
// RUN: grep "define available_externally void @gnu_ei_inline()" %t
|
|
|
|
// RUN: grep "define i32 @test1" %t
|
|
|
|
// RUN: grep "define i32 @test2" %t
|
|
|
|
// RUN: grep "define void @test3" %t
|
|
|
|
// RUN: grep "define available_externally i32 @test4" %t
|
|
|
|
// RUN: grep "define available_externally i32 @test5" %t
|
2009-04-14 14:27:57 +08:00
|
|
|
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: echo "\nC++ tests:"
|
2009-12-16 06:01:24 +08:00
|
|
|
// RUN: %clang %s -emit-llvm -S -o %t -std=c++98
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t
|
|
|
|
// RUN: grep "define linkonce_odr i32 @_Z3foov()" %t
|
|
|
|
// RUN: grep "define i32 @_Z3barv()" %t
|
|
|
|
// RUN: not grep unreferenced %t
|
|
|
|
// RUN: grep "define void @_Z10gnu_inlinev()" %t
|
2009-04-22 08:03:30 +08:00
|
|
|
// RUN: grep "define available_externally void @_Z13gnu_ei_inlinev()" %t
|
2009-04-14 14:27:57 +08:00
|
|
|
|
2009-04-28 11:13:54 +08:00
|
|
|
extern __inline int ei() { return 123; }
|
2009-04-14 14:27:57 +08:00
|
|
|
|
2009-04-28 11:13:54 +08:00
|
|
|
__inline int foo() {
|
2009-04-14 14:27:57 +08:00
|
|
|
return ei();
|
|
|
|
}
|
|
|
|
|
|
|
|
int bar() { return foo(); }
|
|
|
|
|
|
|
|
|
2009-04-28 11:13:54 +08:00
|
|
|
__inline void unreferenced1() {}
|
|
|
|
extern __inline void unreferenced2() {}
|
2009-04-14 14:27:57 +08:00
|
|
|
|
2009-04-21 03:12:28 +08:00
|
|
|
__inline __attribute((__gnu_inline__)) void gnu_inline() {}
|
2009-04-22 08:03:30 +08:00
|
|
|
|
|
|
|
// PR3988
|
2009-04-28 11:13:54 +08:00
|
|
|
extern __inline __attribute__((gnu_inline)) void gnu_ei_inline() {}
|
2009-04-22 08:03:30 +08:00
|
|
|
void (*P)() = gnu_ei_inline;
|
|
|
|
|
2009-04-24 02:22:55 +08:00
|
|
|
// <rdar://problem/6818429>
|
|
|
|
int test1();
|
2009-04-28 11:13:54 +08:00
|
|
|
__inline int test1() { return 4; }
|
|
|
|
__inline int test2() { return 5; }
|
|
|
|
__inline int test2();
|
2009-04-24 02:22:55 +08:00
|
|
|
int test2();
|
|
|
|
|
|
|
|
void test_test1() { test1(); }
|
|
|
|
void test_test2() { test2(); }
|
|
|
|
|
|
|
|
// PR3989
|
2009-04-28 11:13:54 +08:00
|
|
|
extern __inline void test3() __attribute__((gnu_inline));
|
2009-09-13 15:46:26 +08:00
|
|
|
__inline void __attribute__((gnu_inline)) test3() {}
|
2009-04-28 14:37:30 +08:00
|
|
|
|
|
|
|
extern int test4(void);
|
|
|
|
extern __inline __attribute__ ((__gnu_inline__)) int test4(void)
|
|
|
|
{
|
2009-07-22 04:52:43 +08:00
|
|
|
return 0;
|
2009-04-28 14:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_test4() { test4(); }
|
|
|
|
|
2009-09-13 15:46:26 +08:00
|
|
|
extern __inline int test5(void) __attribute__ ((__gnu_inline__));
|
2009-04-28 14:37:30 +08:00
|
|
|
extern __inline int __attribute__ ((__gnu_inline__)) test5(void)
|
|
|
|
{
|
2009-07-22 04:52:43 +08:00
|
|
|
return 0;
|
2009-04-28 14:37:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_test5() { test5(); }
|