Skip to content

Commit

Permalink
clang: Don't use grep in a test
Browse files Browse the repository at this point in the history
Issue #10894 seems to claim this wasn't working. The test does seem to
work as intended, except the CHECKs added in
3ac4299 aren't doing anything since
it wasn't really using FileCheck.
  • Loading branch information
arsenm committed Aug 14, 2023
1 parent 42c6e42 commit d7fcb5b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions clang/test/CodeGen/2007-06-15-AnnotateAttribute.c
Original file line number Diff line number Diff line change
@@ -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")));
Expand All @@ -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")));
Expand Down

0 comments on commit d7fcb5b

Please sign in to comment.