From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Sema/builtin-object-size.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 clang/test/Sema/builtin-object-size.c (limited to 'clang/test/Sema/builtin-object-size.c') diff --git a/clang/test/Sema/builtin-object-size.c b/clang/test/Sema/builtin-object-size.c new file mode 100644 index 0000000..0abc27b --- /dev/null +++ b/clang/test/Sema/builtin-object-size.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin9 -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}} +} + + +// rdar://6252231 - cannot call vsnprintf with va_list on x86_64 +void f4(const char *fmt, ...) { + __builtin_va_list args; + __builtin___vsnprintf_chk (0, 42, 0, 11, fmt, args); +} + -- cgit v1.2.3