summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/inline.c14
-rw-r--r--clang/test/CodeGen/inline2.c62
2 files changed, 68 insertions, 8 deletions
diff --git a/clang/test/CodeGen/inline.c b/clang/test/CodeGen/inline.c
index 2df00db2211..bf17fd7c22b 100644
--- a/clang/test/CodeGen/inline.c
+++ b/clang/test/CodeGen/inline.c
@@ -1,5 +1,5 @@
-// RUN: echo "C89 tests:" &&
-// RUN: clang %s -emit-llvm -S -o %t -std=c89 &&
+// RUN: echo "GNU89 tests:" &&
+// RUN: clang %s -emit-llvm -S -o %t -std=gnu89 &&
// RUN: grep "define available_externally i32 @ei()" %t &&
// RUN: grep "define i32 @foo()" %t &&
// RUN: grep "define i32 @bar()" %t &&
@@ -24,9 +24,9 @@
// 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 available_externally void @test3" %t &&
+// RUN: grep "define void @test3" %t &&
// RUN: grep "define available_externally i32 @test4" %t &&
-// RUN: grep "define i32 @test5" %t &&
+// RUN: grep "define available_externally i32 @test5" %t &&
// RUN: echo "\nC++ tests:" &&
// RUN: clang %s -emit-llvm -S -o %t -std=c++98 &&
@@ -67,9 +67,7 @@ void test_test2() { test2(); }
// PR3989
extern __inline void test3() __attribute__((gnu_inline));
-__inline void test3() {}
-
-void test_test3() { test3(); }
+__inline void __attribute__((gnu_inline)) test3() {}
extern int test4(void);
extern __inline __attribute__ ((__gnu_inline__)) int test4(void)
@@ -79,7 +77,7 @@ extern __inline __attribute__ ((__gnu_inline__)) int test4(void)
void test_test4() { test4(); }
-extern __inline int test5(void);
+extern __inline int test5(void) __attribute__ ((__gnu_inline__));
extern __inline int __attribute__ ((__gnu_inline__)) test5(void)
{
return 0;
diff --git a/clang/test/CodeGen/inline2.c b/clang/test/CodeGen/inline2.c
new file mode 100644
index 00000000000..6f165f50f8b
--- /dev/null
+++ b/clang/test/CodeGen/inline2.c
@@ -0,0 +1,62 @@
+// RUN: clang-cc -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s &&
+// RUN: clang-cc -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
+
+// CHECK-GNU89: define i32 @f0()
+// CHECK-C99: define i32 @f0()
+int f0(void);
+int f0(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f1()
+// CHECK-C99: define i32 @f1()
+inline int f1(void);
+int f1(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f2()
+// CHECK-C99: define i32 @f2()
+int f2(void);
+inline int f2(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f3()
+// CHECK-C99: define i32 @f3()
+extern inline int f3(void);
+int f3(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f5()
+// CHECK-C99: define i32 @f5()
+extern inline int f5(void);
+inline int f5(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f6()
+// CHECK-C99: define i32 @f6()
+inline int f6(void);
+extern inline int f6(void) { return 0; }
+
+// CHECK-GNU89: define i32 @f7()
+// CHECK-C99: define i32 @f7()
+extern inline int f7(void);
+extern int f7(void) { return 0; }
+
+// CHECK-GNU89: define i32 @fA()
+inline int fA(void) { return 0; }
+
+// CHECK-GNU89: define available_externally i32 @f4()
+// CHECK-C99: define i32 @f4()
+int f4(void);
+extern inline int f4(void) { return 0; }
+
+// CHECK-GNU89: define available_externally i32 @f8()
+// CHECK-C99: define i32 @f8()
+extern int f8(void);
+extern inline int f8(void) { return 0; }
+
+// CHECK-GNU89: define available_externally i32 @f9()
+// CHECK-C99: define i32 @f9()
+extern inline int f9(void);
+extern inline int f9(void) { return 0; }
+
+// CHECK-C99: define available_externally i32 @fA()
+
+int test_all() {
+ return f0() + f1() + f2() + f3() + f4() + f5() + f6() + f7() + f8() + f9()
+ + fA();
+}
OpenPOWER on IntegriCloud