]> granicus.if.org Git - clang/commitdiff
Fix some codegen tests to include positive checks.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 20 Nov 2009 17:23:39 +0000 (17:23 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 20 Nov 2009 17:23:39 +0000 (17:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89465 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/2008-07-17-no-emit-on-error.c
test/CodeGen/func-return-member.c
test/CodeGen/incomplete-function-type.c
test/CodeGen/static-order.c
test/CodeGen/switch.c

index fbff54149bcce8037bb4abd7750ba6c9e1493099..6266b504fd0486ffe797d55201271eb130a00c5c 100644 (file)
@@ -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
index e6fc5623904b18372226423da08634836440cc71..68a48fc1041fc26773a7b6f16631d15a6905fa02 100644 (file)
@@ -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;
 }
index a641268cf50f3d3aa18623556fb3b8f93003239b..c760e04a08f5ba6fde11b233cf930d1769796171 100644 (file)
@@ -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() {}
index 243e96bf3e650d40e8a68cec573ac9a1915785ad..58340b691302056194a6d188a1c5e19cb90b1792 100644 (file)
@@ -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;
index 3254fbf3c9389dfcbb3e79434753df26185b1a6f..96118f6e6fc3972dae970fb09d992bf6f409b0cc 100644 (file)
@@ -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();