From 9fa8c9984c78dccf82cbfda8d261f0c43f9018c5 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Sat, 24 Jan 2015 17:39:36 +0000 Subject: [PATCH] test: Convert some tests to FileCheck These were all doing trivial greps. It's better to use FileCheck. llvm-svn: 227007 --- clang/test/CodeGen/align-local.c | 4 +++- clang/test/CodeGen/cleanup-stack.c | 4 ++-- clang/test/CodeGen/enum.c | 7 ++++--- clang/test/CodeGen/kr-func-promote.c | 3 ++- clang/test/CodeGen/private-extern.c | 7 ++++--- clang/test/CodeGen/vla-2.c | 3 ++- clang/test/CodeGen/vla-3.c | 3 ++- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/clang/test/CodeGen/align-local.c b/clang/test/CodeGen/align-local.c index b839ee14a10b..c8b27a83c3ff 100644 --- a/clang/test/CodeGen/align-local.c +++ b/clang/test/CodeGen/align-local.c @@ -1,7 +1,9 @@ -// RUN: %clang_cc1 -emit-llvm < %s | grep "align 16" | count 2 +// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s typedef struct __attribute((aligned(16))) {int x[4];} ff; +// CHECK: alloca %struct.ff, align 16 +// CHECK: alloca %struct.anon, align 16 int a() { ff a; struct {int x[4];} b __attribute((aligned(16))); diff --git a/clang/test/CodeGen/cleanup-stack.c b/clang/test/CodeGen/cleanup-stack.c index 72a1a6c751a9..6448aac2384a 100644 --- a/clang/test/CodeGen/cleanup-stack.c +++ b/clang/test/CodeGen/cleanup-stack.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm %s -o %t -// RUN: grep "ret i32 9" %t +// RUN: %clang_cc1 -triple i386-unknown-unknown -O3 -emit-llvm %s -o - | FileCheck %s +// CHECK: ret i32 9 struct s0 { int *var; diff --git a/clang/test/CodeGen/enum.c b/clang/test/CodeGen/enum.c index 0e239f1a8ee3..ef50f9eead64 100644 --- a/clang/test/CodeGen/enum.c +++ b/clang/test/CodeGen/enum.c @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6' -// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7' +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | FileCheck -check-prefix=CHECK-C %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | FileCheck -check-prefix=CHECK-CXX %s +// CHECK-C: ret i32 6 +// CHECK-CXX: ret i32 7 // This test case illustrates a peculiarity of the promotion of // enumeration types in C and C++. In particular, the enumeration type @@ -19,4 +21,3 @@ int main (void) return r; } - diff --git a/clang/test/CodeGen/kr-func-promote.c b/clang/test/CodeGen/kr-func-promote.c index fcdbac3ee424..8e55dc91edf4 100644 --- a/clang/test/CodeGen/kr-func-promote.c +++ b/clang/test/CodeGen/kr-func-promote.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 @a(i32)" +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s +// CHECK: i32 @a(i32) int a(); int a(x) short x; {return x;} diff --git a/clang/test/CodeGen/private-extern.c b/clang/test/CodeGen/private-extern.c index 2d34d543213d..26b3fcede5ab 100644 --- a/clang/test/CodeGen/private-extern.c +++ b/clang/test/CodeGen/private-extern.c @@ -1,6 +1,7 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s -// RUN: grep '@g0 = external hidden constant i32' %t -// RUN: grep '@g1 = hidden constant i32 1' %t +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s + +// CHECK-DAG: @g0 = external hidden constant i32 +// CHECK-DAG: @g1 = hidden constant i32 1 __private_extern__ const int g0; __private_extern__ const int g1 = 1; diff --git a/clang/test/CodeGen/vla-2.c b/clang/test/CodeGen/vla-2.c index 0a74907f7b2d..894913da3ec7 100644 --- a/clang/test/CodeGen/vla-2.c +++ b/clang/test/CodeGen/vla-2.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | grep ".*alloca.*align 16" +// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | FileCheck %s +// CHECK: alloca {{.*}}, align 16 extern void bar(int[]); diff --git a/clang/test/CodeGen/vla-3.c b/clang/test/CodeGen/vla-3.c index 4927b464231f..66acf58c1feb 100644 --- a/clang/test/CodeGen/vla-3.c +++ b/clang/test/CodeGen/vla-3.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | grep ".*alloca.*align 16" +// RUN: %clang_cc1 -std=gnu99 %s -emit-llvm -o - | FileCheck %s +// CHECK: alloca {{.*}}, align 16 void adr(char *);