blob: 6fe09c2e33e17e34b95dd9eddb3799d3886e79ea [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep llvm.global.annotations
2// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep -c llvm.var.annotation | grep 3
3
4#include <stdio.h>
5
6/* Global variable with attribute */
7int X __attribute__((annotate("GlobalValAnnotation")));
8
9/* Function with attribute */
10int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
11 __attribute__((noinline));
12
13int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
14 int x __attribute__((annotate("LocalValAnnotation")));
15 x = 34;
16 return y + x;
17}
18
19int main() {
20 static int a __attribute__((annotate("GlobalValAnnotation")));
21 a = foo(2);
22 printf("hello world%d\n", a);
23 return 0;
24}