[llvm-commits] [llvm] r67688 - /llvm/trunk/test/FrontendC/object_size.c
Evan Cheng
evan.cheng at apple.com
Wed Mar 25 09:29:38 PDT 2009
Author: evancheng
Date: Wed Mar 25 11:29:33 2009
New Revision: 67688
URL: http://llvm.org/viewvc/llvm-project?rev=67688&view=rev
Log:
Add a __builtin_object_size test.
Added:
llvm/trunk/test/FrontendC/object_size.c
Added: llvm/trunk/test/FrontendC/object_size.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/object_size.c?rev=67688&view=auto
==============================================================================
--- llvm/trunk/test/FrontendC/object_size.c (added)
+++ llvm/trunk/test/FrontendC/object_size.c Wed Mar 25 11:29:33 2009
@@ -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);
+}
More information about the llvm-commits
mailing list