aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-11-20 17:23:39 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-11-20 17:23:39 +0000
commit600d47e8d5edc93a08ada8086db23d1d434ce583 (patch)
tree2ce7069156fbc21fd527faa4937cccfb98afe04c
parent50a4487683a7e09fb93e8b506181e034241a0ffe (diff)
Fix some codegen tests to include positive checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89465 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGen/2008-07-17-no-emit-on-error.c4
-rw-r--r--test/CodeGen/func-return-member.c5
-rw-r--r--test/CodeGen/incomplete-function-type.c6
-rw-r--r--test/CodeGen/static-order.c5
-rw-r--r--test/CodeGen/switch.c27
5 files changed, 38 insertions, 9 deletions
diff --git a/test/CodeGen/2008-07-17-no-emit-on-error.c b/test/CodeGen/2008-07-17-no-emit-on-error.c
index fbff54149b..6266b504fd 100644
--- a/test/CodeGen/2008-07-17-no-emit-on-error.c
+++ b/test/CodeGen/2008-07-17-no-emit-on-error.c
@@ -1,10 +1,14 @@
// RUN: rm -f %t1.bc
+// RUN: clang-cc -DPASS %s -emit-llvm-bc -o %t1.bc
+// RUN: test -f %t1.bc
// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc
// RUN: not test -f %t1.bc
void f() {
}
+#ifndef PASS
void g() {
*10;
}
+#endif
diff --git a/test/CodeGen/func-return-member.c b/test/CodeGen/func-return-member.c
index e6fc562390..68a48fc104 100644
--- a/test/CodeGen/func-return-member.c
+++ b/test/CodeGen/func-return-member.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s 2>&1 | not grep 'cannot codegen this l-value expression yet'
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
struct frk { float _Complex c; int x; };
struct faz { struct frk f; };
@@ -10,14 +10,17 @@ int X;
struct frk F;
float _Complex C;
+// CHECK: define void @bar
void bar(void) {
X = foo().f.f.x;
}
+// CHECK: define void @bun
void bun(void) {
F = foo().f.f;
}
+// CHECK: define void @ban
void ban(void) {
C = foo().f.f.c;
}
diff --git a/test/CodeGen/incomplete-function-type.c b/test/CodeGen/incomplete-function-type.c
index a641268cf5..c760e04a08 100644
--- a/test/CodeGen/incomplete-function-type.c
+++ b/test/CodeGen/incomplete-function-type.c
@@ -1,4 +1,7 @@
-// RUN: clang-cc -emit-llvm %s -o - | not grep opaque
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// CHECK: ModuleID
+// CHECK-NOT: opaque
+// CHECK: define void @f0
enum teste1 test1f(void), (*test1)(void) = test1f;
struct tests2 test2f(), (*test2)() = test2f;
@@ -8,3 +11,4 @@ enum teste1 { TEST1 };
struct tests2 { int x,y,z,a,b,c,d,e,f,g; };
struct tests3 { float x; };
+void f0() {}
diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c
index 243e96bf3e..58340b6913 100644
--- a/test/CodeGen/static-order.c
+++ b/test/CodeGen/static-order.c
@@ -1,4 +1,7 @@
-// RUN: clang-cc -emit-llvm -o - %s | not grep "zeroinitializer"
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// CHECK: ModuleID
+// CHECK-NOT: zeroinitializer
+// CHECK: define i8* @f
struct s {
int a;
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index 3254fbf3c9..96118f6e6f 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -1,11 +1,11 @@
-// RUN: clang-cc %s -emit-llvm-bc -o - | opt -std-compile-opts -disable-output
+// RUN: clang-cc -triple i386-unknown-unknown -O3 %s -emit-llvm -o - | FileCheck %s
int foo(int i) {
int j = 0;
switch (i) {
case -1:
j = 1; break;
- case 1 :
+ case 1 :
j = 2; break;
case 2:
j = 3; break;
@@ -16,11 +16,10 @@ int foo(int i) {
return j;
}
-
int foo2(int i) {
int j = 0;
switch (i) {
- case 1 :
+ case 1 :
j = 2; break;
case 2 ... 10:
j = 3; break;
@@ -31,7 +30,6 @@ int foo2(int i) {
return j;
}
-
int foo3(int i) {
int j = 0;
switch (i) {
@@ -48,7 +46,7 @@ int foo3(int i) {
}
-int foo4(int i) {
+static int foo4(int i) {
int j = 0;
switch (i) {
case 111:
@@ -65,6 +63,17 @@ int foo4(int i) {
return j;
}
+// CHECK: define i32 @foo4t()
+// CHECK: ret i32 376
+// CHECK: }
+int foo4t() {
+ // 111 + 1 + 222 + 42 = 376
+ return foo4(111) + foo4(99) + foo4(222) + foo4(601);
+}
+
+// CHECK: define void @foo5()
+// CHECK-NOT: switch
+// CHECK: }
void foo5(){
switch(0){
default:
@@ -74,11 +83,17 @@ void foo5(){
}
}
+// CHECK: define void @foo6()
+// CHECK-NOT: switch
+// CHECK: }
void foo6(){
switch(0){
}
}
+// CHECK: define void @foo7()
+// CHECK-NOT: switch
+// CHECK: }
void foo7(){
switch(0){
foo7();