xref: /llvm-project/clang/test/CodeGen/annotations-decl-use-define.c (revision c6d70722b49db01914d5f64cc86ea5ed609ad9fd)
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2 
3 // Test annotation attributes are still emitted when the function is used before
4 // it is defined with annotations.
5 
6 void foo(void);
7 void *xxx = (void*)foo;
foo()8 void __attribute__((annotate("bar"))) foo() {}
9 
10 // CHECK: target triple
11 // CHECK-DAG: private unnamed_addr constant [4 x i8] c"bar\00", section "llvm.metadata"
12 
13 // CHECK: @llvm.global.annotations = appending global [1 x { ptr, ptr, ptr, i32, ptr }] [{
14 // CHECK-SAME: { ptr @foo,
15 // CHECK-SAME: }], section "llvm.metadata"
16 
17