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