Created attachment 131507 [details] image of error SUMMARY the opencl semantic analysis of kdevelop is only partially working: while it "warns" about a #pragma OPENCL EXTENSION all : enable statement (which is not allowed) it errors on uchar and int4 with "undefined type" view attachment as example STEPS TO REPRODUCE 1. create opencl file 2. write code 3. OBSERVED RESULT Opencl semantic analysis errors EXPECTED RESULT no errors SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: Gentoo Linux 5.6 (available in About System) KDE Plasma Version: 5.19.4 KDE Frameworks Version: 5.72.0 Qt Version: 5.15 ADDITIONAL INFORMATION view attachment image
Created attachment 131508 [details] cl code described in bug (mimal)
The same errors are reported when calling `clang -cl-std=CL1.2 file.cl`. Adding `-include /usr/lib/clang/10.0.1/include/opencl-c.h` to the command resolves them, and jpsollie reports that adding this same header to 'Custom Defines/Includes' makes KDevelop work. We should probably include this automatically when parsing CL files in KDevelop.
Or we use -fdeclare-opencl-builtins. (https://reviews.llvm.org/D60763) Supposedly the header takes very long to parse and this flag uses builtin declarations instead. Apparently one still has to include opencl-c-base.h though.
(In reply to Aaron Puchert from comment #3) > Or we use -fdeclare-opencl-builtins. (https://reviews.llvm.org/D60763) Maybe not for now though, the flag is still considered experimental (you have to prefix it with -Xclang). It worked for me, but maybe it's not production-ready. There was a proposal to include the builtin header by default, but it got stalled because of this apparently. (https://reviews.llvm.org/D78979)