blob: 115c3f73b90b854339509d52e2c185d7339c4c1d [file] [log] [blame]
Duncan Sandsbb8f5902010-11-25 21:24:35 +00001// RUN: %llvmgcc -S %s -o - | grep llvm.global.annotations
2// RUN: %llvmgcc -S %s -o - | grep llvm.var.annotation | count 3
Tanya Lattnerbedcd3b2007-06-15 20:52:47 +00003
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}