[cfe-commits] r89465 - in /cfe/trunk/test/CodeGen: 2008-07-17-no-emit-on-error.c func-return-member.c incomplete-function-type.c static-order.c switch.c

Daniel Dunbar daniel at zuster.org
Fri Nov 20 09:23:39 PST 2009


Author: ddunbar
Date: Fri Nov 20 11:23:39 2009
New Revision: 89465

URL: http://llvm.org/viewvc/llvm-project?rev=89465&view=rev
Log:
Fix some codegen tests to include positive checks.

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

Modified: cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c?rev=89465&r1=89464&r2=89465&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c (original)
+++ cfe/trunk/test/CodeGen/2008-07-17-no-emit-on-error.c Fri Nov 20 11:23:39 2009
@@ -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

Modified: cfe/trunk/test/CodeGen/func-return-member.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/func-return-member.c?rev=89465&r1=89464&r2=89465&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/func-return-member.c (original)
+++ cfe/trunk/test/CodeGen/func-return-member.c Fri Nov 20 11:23:39 2009
@@ -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 @@
 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;
 }

Modified: cfe/trunk/test/CodeGen/incomplete-function-type.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/incomplete-function-type.c?rev=89465&r1=89464&r2=89465&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/incomplete-function-type.c (original)
+++ cfe/trunk/test/CodeGen/incomplete-function-type.c Fri Nov 20 11:23:39 2009
@@ -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 @@
 struct tests2 { int x,y,z,a,b,c,d,e,f,g; };
 struct tests3 { float x; };
 
+void f0() {}

Modified: cfe/trunk/test/CodeGen/static-order.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/static-order.c?rev=89465&r1=89464&r2=89465&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/static-order.c (original)
+++ cfe/trunk/test/CodeGen/static-order.c Fri Nov 20 11:23:39 2009
@@ -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;

Modified: cfe/trunk/test/CodeGen/switch.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/switch.c?rev=89465&r1=89464&r2=89465&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/switch.c (original)
+++ cfe/trunk/test/CodeGen/switch.c Fri Nov 20 11:23:39 2009
@@ -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 @@
   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 @@
   return j;
 }
 
-    
 int foo3(int i) {
   int j = 0;
   switch (i) {
@@ -48,7 +46,7 @@
 }
 
 
-int foo4(int i) {
+static int foo4(int i) {
   int j = 0;
   switch (i) {
   case 111:
@@ -65,6 +63,17 @@
   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 @@
     }
 }
 
+// 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();





More information about the cfe-commits mailing list