aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2007-06-15 20:52:47 +0000
committerTanya Lattner <tonic@nondot.org>2007-06-15 20:52:47 +0000
commitbedcd3bb9da90fe2c7334eeca334cf78eceff15a (patch)
tree3b1244cfd89b569b8c1165429ae6e05e7d187397
parent6d806e93cee502459fc15d039a16b9dc7e9cc30e (diff)
test case for annotate attribute
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37604 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CFrontend/2007-06-15-AnnotateAttribute.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CFrontend/2007-06-15-AnnotateAttribute.c b/test/CFrontend/2007-06-15-AnnotateAttribute.c
new file mode 100644
index 0000000000..18ce69389d
--- /dev/null
+++ b/test/CFrontend/2007-06-15-AnnotateAttribute.c
@@ -0,0 +1,25 @@
+// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep llvm.global.annotations | grep foo \
+// RUN: | grep @X | grep @a
+// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep -c llvm.var.annotation | grep 3
+
+#include <stdio.h>
+
+/* Global variable with attribute */
+int X __attribute__((annotate("GlobalValAnnotation")));
+
+/* Function with attribute */
+int foo(int y) __attribute__((annotate("GlobalValAnnotation")))
+ __attribute__((noinline));
+
+int foo(int y __attribute__((annotate("LocalValAnnotation")))) {
+ int x __attribute__((annotate("LocalValAnnotation")));
+ x = 34;
+ return y + x;
+}
+
+int main() {
+ static int a __attribute__((annotate("GlobalValAnnotation")));
+ a = foo(2);
+ printf("hello world%d\n", a);
+ return 0;
+}