xref: /llvm-project/clang/test/Headers/opencl-builtins.cl (revision c5ffc6f8bd6ae0e187de8b6a0e4300161952ba66)
1*c5ffc6f8SSven van Haastregt// RUN: clang-tblgen -gen-clang-opencl-builtin-tests %clang_src_sema_dir/OpenCLBuiltins.td -o %t.cl
2*c5ffc6f8SSven van Haastregt// RUN: %clang_cc1 -include %s %t.cl -triple spir -verify -fsyntax-only -cl-std=CL2.0 -finclude-default-header
3*c5ffc6f8SSven van Haastregt// RUN: %clang_cc1 -include %s %t.cl -triple spir -verify -fsyntax-only -cl-std=CL2.0 -fdeclare-opencl-builtins -finclude-default-header
4*c5ffc6f8SSven van Haastregt
5*c5ffc6f8SSven van Haastregt// Generate an OpenCL source file containing a call to each builtin from
6*c5ffc6f8SSven van Haastregt// OpenCLBuiltins.td and then run that generated source file through the
7*c5ffc6f8SSven van Haastregt// frontend.
8*c5ffc6f8SSven van Haastregt//
9*c5ffc6f8SSven van Haastregt// Then test that:
10*c5ffc6f8SSven van Haastregt//  - The generated file can be parsed using opencl-c.h, giving some confidence
11*c5ffc6f8SSven van Haastregt//    that OpenCLBuiltins.td does not provide more than what opencl-c.h provides
12*c5ffc6f8SSven van Haastregt//    (but not vice versa).
13*c5ffc6f8SSven van Haastregt//
14*c5ffc6f8SSven van Haastregt//  - The generated file can be parsed using -fdeclare-opencl-builtins, ensuring
15*c5ffc6f8SSven van Haastregt//    some internal consistency of declarations in OpenCLBuiltins.td.  For
16*c5ffc6f8SSven van Haastregt//    example, addition of builtin declarations that lead to ambiguity during
17*c5ffc6f8SSven van Haastregt//    overload resolution will cause this test to fail.
18*c5ffc6f8SSven van Haastregt
19*c5ffc6f8SSven van Haastregt// expected-no-diagnostics
20