Add two test cases for builtins (mostly related to object size
builtins).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/builtin-object-size.c b/test/Sema/builtin-object-size.c
new file mode 100644
index 0000000..abc25da
--- /dev/null
+++ b/test/Sema/builtin-object-size.c
@@ -0,0 +1,19 @@
+// RUN: clang -fsyntax-only -verify %s
+
+int a[10];
+
+int f0() {
+ return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
+}
+int f1() {
+ return (__builtin_object_size(&a, 0) +
+ __builtin_object_size(&a, 1) +
+ __builtin_object_size(&a, 2) +
+ __builtin_object_size(&a, 3));
+}
+int f2() {
+ return __builtin_object_size(&a, -1); // expected-error {{argument should be a value from 0 to 3}}
+}
+int f3() {
+ return __builtin_object_size(&a, 4); // expected-error {{argument should be a value from 0 to 3}}
+}