Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / 2007-06-15-AnnotateAttribute.c
blob7482fad190a4c3ef56c2b10f2b575f569af5e68b
1 // RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
3 // CHECK: @.str.3 = private unnamed_addr constant [28 x i8] c"GlobalValAnnotationWithArgs\00", section "llvm.metadata"
4 // CHECK-NEXT: @.args = private unnamed_addr constant { i32, %struct.TestStruct } { i32 42, %struct.TestStruct { i32 1, i32 2 } }, section "llvm.metadata"
6 // CHECK: llvm.global.annotations
8 // CHECK: llvm.var.annotation
9 // CHECK: llvm.var.annotation
10 // CHECK: llvm.var.annotation
12 /* Global variable with attribute */
13 int X __attribute__((annotate("GlobalValAnnotation")));
15 /* Function with attribute */
16 int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
17 __attribute__((noinline));
19 int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
20 int x __attribute__((annotate("LocalValAnnotation")));
21 x = 34;
22 return y + x;
25 /* Attribute with struct argument. */
26 struct TestStruct {
27 int a;
28 int b;
30 int Y __attribute__((annotate(
31 "GlobalValAnnotationWithArgs",
32 42,
33 (struct TestStruct) { .a = 1, .b = 2 }
34 )));
37 int main(void) {
38 static int a __attribute__((annotate("GlobalValAnnotation")));
39 a = foo(2);
40 return 0;