Bug 426335 - kdevelop symantic analysis opencl only partially working
Summary: kdevelop symantic analysis opencl only partially working
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: 5.6.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-09 09:25 UTC by jpsollie
Modified: 2020-09-26 22:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
image of error (111.10 KB, image/png)
2020-09-09 09:25 UTC, jpsollie
Details
cl code described in bug (mimal) (239 bytes, text/plain)
2020-09-09 09:32 UTC, jpsollie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jpsollie 2020-09-09 09:25:41 UTC
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
Comment 1 jpsollie 2020-09-09 09:32:04 UTC
Created attachment 131508 [details]
cl code described in bug (mimal)
Comment 2 Francis Herne 2020-09-09 14:06:57 UTC
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.
Comment 3 Aaron Puchert 2020-09-26 22:00:49 UTC
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.
Comment 4 Aaron Puchert 2020-09-26 22:08:04 UTC
(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)