blob: 324b975575535a6a67c38e581a95970e633b181b [file] [log] [blame]
Eric Christopher3883e662011-07-26 22:17:02 +00001// 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// XFAIL: *
5#include <stdio.h>
6
7/* Global variable with attribute */
8int X __attribute__((annotate("GlobalValAnnotation")));
9
10/* Function with attribute */
11int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
12 __attribute__((noinline));
13
14int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
15 int x __attribute__((annotate("LocalValAnnotation")));
16 x = 34;
17 return y + x;
18}
19
20int main() {
21 static int a __attribute__((annotate("GlobalValAnnotation")));
22 a = foo(2);
23 printf("hello world%d\n", a);
24 return 0;
25}