[clang] d7fcb5b - clang: Don't use grep in a test

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 08:28:47 PDT 2023


Author: Matt Arsenault
Date: 2023-08-14T11:28:41-04:00
New Revision: d7fcb5b6b5280dc61d5afe0920bb78a82cfe2f27

URL: https://github.com/llvm/llvm-project/commit/d7fcb5b6b5280dc61d5afe0920bb78a82cfe2f27
DIFF: https://github.com/llvm/llvm-project/commit/d7fcb5b6b5280dc61d5afe0920bb78a82cfe2f27.diff

LOG: clang: Don't use grep in a test

Issue #10894 seems to claim this wasn't working. The test does seem to
work as intended, except the CHECKs added in
3ac4299d3798eb7078905d5fc8f23781556c90a1 aren't doing anything since
it wasn't really using FileCheck.

Added: 
    

Modified: 
    clang/test/CodeGen/2007-06-15-AnnotateAttribute.c

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGen/2007-06-15-AnnotateAttribute.c b/clang/test/CodeGen/2007-06-15-AnnotateAttribute.c
index 05a9e6d7dc3941..7482fad190a4c3 100644
--- a/clang/test/CodeGen/2007-06-15-AnnotateAttribute.c
+++ b/clang/test/CodeGen/2007-06-15-AnnotateAttribute.c
@@ -1,5 +1,13 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.global.annotations
-// RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.var.annotation | count 3
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// CHECK: @.str.3 = private unnamed_addr constant [28 x i8] c"GlobalValAnnotationWithArgs\00", section "llvm.metadata"
+// CHECK-NEXT: @.args = private unnamed_addr constant { i32, %struct.TestStruct } { i32 42, %struct.TestStruct { i32 1, i32 2 } }, section "llvm.metadata"
+
+// CHECK: llvm.global.annotations
+
+// CHECK: llvm.var.annotation
+// CHECK: llvm.var.annotation
+// CHECK: llvm.var.annotation
 
 /* Global variable with attribute */
 int X __attribute__((annotate("GlobalValAnnotation")));
@@ -20,13 +28,11 @@ struct TestStruct {
   int b;
 };
 int Y __attribute__((annotate(
-  "GlobalValAnnotationWithArgs", 
+  "GlobalValAnnotationWithArgs",
   42,
   (struct TestStruct) { .a = 1, .b = 2 }
 )));
 
-// CHECK: @.str.3 = private unnamed_addr constant [28 x i8] c"GlobalValAnnotationWithArgs\00", section "llvm.metadata"
-// CHECK-NEXT: @.args = private unnamed_addr constant { i32, %struct.TestStruct } { i32 42, %struct.TestStruct { i32 1, i32 2 } }, section "llvm.metadata"
 
 int main(void) {
   static int a __attribute__((annotate("GlobalValAnnotation")));


        


More information about the cfe-commits mailing list