summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaOpenCL/printf-format-strings.cl
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2018-11-13 22:30:35 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2018-11-13 22:30:35 +0000
commite19dc6137fadf44aac0385357e3169350a2061c0 (patch)
tree9bee21c25e6b6cf0d64b179c8bd9d99ee2ed77c2 /clang/test/SemaOpenCL/printf-format-strings.cl
parentf54aeed6f40ddea8c368f8c0661ea96b0c34f342 (diff)
downloadbcm5719-llvm-e19dc6137fadf44aac0385357e3169350a2061c0.tar.gz
bcm5719-llvm-e19dc6137fadf44aac0385357e3169350a2061c0.zip
OpenCL: Don't warn on v printf modifier
This avoids spurious warnings, but could use a lot of work. For example the number of vector elements is not verified, and the passed value type is not checked. Fixes bug 39486 llvm-svn: 346806
Diffstat (limited to 'clang/test/SemaOpenCL/printf-format-strings.cl')
-rw-r--r--clang/test/SemaOpenCL/printf-format-strings.cl34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/SemaOpenCL/printf-format-strings.cl b/clang/test/SemaOpenCL/printf-format-strings.cl
new file mode 100644
index 00000000000..d5748e18ede
--- /dev/null
+++ b/clang/test/SemaOpenCL/printf-format-strings.cl
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -cl-std=CL1.2 -fsyntax-only -verify %s
+
+typedef __attribute__((ext_vector_type(2))) float float2;
+typedef __attribute__((ext_vector_type(4))) float float4;
+typedef __attribute__((ext_vector_type(4))) int int4;
+
+int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
+
+kernel void format_v4f32(float4 arg)
+{
+ printf("%v4f\n", arg); // expected-no-diagnostics
+}
+
+kernel void format_v4f32_wrong_num_elts(float2 arg)
+{
+ printf("%v4f\n", arg); // expected-no-diagnostics
+}
+
+kernel void vector_precision_modifier_v4f32(float4 arg)
+{
+ printf("%.2v4f\n", arg); // expected-no-diagnostics
+}
+
+// FIXME: This should warn
+kernel void format_missing_num_elts(float4 arg)
+{
+ printf("%vf\n", arg); // expected-no-diagnostics
+}
+
+// FIXME: This should warn
+kernel void vector_precision_modifier_v4i32(int4 arg)
+{
+ printf("%.2v4f\n", arg); // expected-no-diagnostics
+}
OpenPOWER on IntegriCloud