xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2007-06-15-AnnotateAttribute.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1 // RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.global.annotations
2 // RUN: %clang_cc1 -emit-llvm %s -o - | grep llvm.var.annotation | count 3
3 
4 /* Global variable with attribute */
5 int X __attribute__((annotate("GlobalValAnnotation")));
6 
7 /* Function with attribute */
8 int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
9                __attribute__((noinline));
10 
foo(int y)11 int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
12   int x __attribute__((annotate("LocalValAnnotation")));
13   x = 34;
14   return y + x;
15 }
16 
main()17 int main() {
18   static int a __attribute__((annotate("GlobalValAnnotation")));
19   a = foo(2);
20   return 0;
21 }
22