blob: de34866783bab6e8ee011cf0e9f50016a2e3661d [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
Eric Christopher3883e662011-07-26 22:17:02 +00004/* Global variable with attribute */
5int X __attribute__((annotate("GlobalValAnnotation")));
6
7/* Function with attribute */
8int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
9 __attribute__((noinline));
10
11int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
12 int x __attribute__((annotate("LocalValAnnotation")));
13 x = 34;
14 return y + x;
15}
16
17int main() {
18 static int a __attribute__((annotate("GlobalValAnnotation")));
19 a = foo(2);
Eric Christopher3883e662011-07-26 22:17:02 +000020 return 0;
21}