D17909: Clang plugin: Handle CUDA files better

Thomas Schöps noreply at phabricator.kde.org
Tue Jan 1 23:26:38 GMT 2019


thomassc created this revision.
thomassc added a reviewer: KDevelop.
thomassc added a project: KDevelop.
Herald added a subscriber: kdevelop-devel.
thomassc requested review of this revision.

REVISION SUMMARY
  This fixes two issues in how KDevelop's clang plugin handles CUDA files (.cu source files and .cuh headers):
  
  1. Those file types were not treated as source files, therefore if such a file was modified, it was not passed among the list of modified source files to clang for re-parsing. The re-parsing thus incorrectly used the unmodified file on disk instead. This is addressed by the change to documentfinderhelpers.cpp and kdevclang.xml.
  2. The patch passes the general code parser settings also to CUDA files (change in parsesession.cpp). This is for example important to get flags such as -std=c++11 that are required for correct parsing. However, it is not correct: the build system may use separate options for CUDA files (e.g., CMake's CUDA_NVCC_FLAGS). But it might still be better than the previous behavior of not passing any options except -xcuda, since it might be somewhat likely that it is a reasonable guess.
  
  Additional comments:
  a) I am not sure whether the change in clanghelpers.cpp is required, but it seems coherent.
  b) I changed the CUDA mime types in kdevclang.xml to inherit from text/x-c++src/hdr instead of text/x-csrc/hdr since the CUDA files can contain C++ code.
  c) This patch is not sufficient to enable proper CUDA support. I'll post to the kdevelop-devel mailing list for that.

TEST PLAN
  Tested manually.

REPOSITORY
  R32 KDevelop

REVISION DETAIL
  https://phabricator.kde.org/D17909

AFFECTED FILES
  plugins/clang/duchain/clanghelpers.cpp
  plugins/clang/duchain/documentfinderhelpers.cpp
  plugins/clang/duchain/parsesession.cpp
  plugins/clang/kdevclang.xml
  plugins/clang/kdevclangsupport.json

To: thomassc, #kdevelop
Cc: kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20190101/5f49884f/attachment.html>


More information about the KDevelop-devel mailing list