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