aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-03-25 16:29:33 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-03-25 16:29:33 +0000
commit2602f436bec01dc06a25ec94ac7f7e48ff376c7d (patch)
tree44c828f1a77c0b976f48a17bd7061806218185be /test
parentad9ad7c827b585c018288c89d611d8c97d8d2e7d (diff)
downloadexternal_llvm-2602f436bec01dc06a25ec94ac7f7e48ff376c7d.zip
external_llvm-2602f436bec01dc06a25ec94ac7f7e48ff376c7d.tar.gz
external_llvm-2602f436bec01dc06a25ec94ac7f7e48ff376c7d.tar.bz2
Add a __builtin_object_size test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/FrontendC/object_size.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/FrontendC/object_size.c b/test/FrontendC/object_size.c
new file mode 100644
index 0000000..0ddd66b
--- /dev/null
+++ b/test/FrontendC/object_size.c
@@ -0,0 +1,16 @@
+// RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep ret | grep {\\-1} | count 1
+// RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep ret | grep {0} | count 1
+// RUN: %llvmgcc -S -emit-llvm -O1 %s -o - | grep ret | grep {8} | count 1
+
+unsigned t1(void *d) {
+ return __builtin_object_size(d, 0);
+}
+
+unsigned t2(void *d) {
+ return __builtin_object_size(d, 2);
+}
+
+char buf[8];
+unsigned t3() {
+ return __builtin_object_size(buf, 0);
+}