'How to use OpenCL 2.0 kernel language in Qt Creator?

Several days ago, when I started to learn OpenCL, I needed a good IDE to write OpenCL C kernel language, which provides some basic functions like syntax highlighting and static analysis. I was surprised to find out that Qt Creator is able to do the job.

Everything was fine until today I started to use some feature in OpenCL 2.0:

enter image description here

It looks like Qt Creator use libclang to do the parsing and libclang treats my source files as OpenCL 1.0. But My machine supports OpenCL 3.0 and the code was ok to compile and run. So I doubt it only supports OpenCL 1.0.

My questions are:

  1. How to make Qt Creator (or the libclang plugin in it) support OpenCL 2.0?
  2. How do you guys write OpenCL 2.0? Is there any better IDEs or editors?

Thank you guys, I am really a newbie here.



Solution 1:[1]

QtCreator uses KDE syntax highlighting engine. The definitions are simple XML files. You can find them here, but opencl.xml doesn't look updated for 2.0/3.0 language. You can try to change it, and then put it into $HOME/.config/QtProject/qtcreator/generic-highlighter/syntax and it should pick it up.

In QtCreator, you can download newer definitions by going to Tools -> Options, select "Text editor" in left, then "Generic highlighter" tab. This will put the updated files in $HOME.local/share/org.kde.syntax-highlighting/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mogu