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