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