<table><tr><td style="">thomassc created this revision.<br />thomassc added a reviewer: KDevelop.<br />thomassc added a project: KDevelop.<br />Herald added a subscriber: kdevelop-devel.<br />thomassc requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D17909">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This fixes two issues in how KDevelop's clang plugin handles CUDA files (.cu source files and .cuh headers):</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">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.</li>
<li class="remarkup-list-item">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.</li>
</ol>
<p>Additional comments:<br />
a) I am not sure whether the change in clanghelpers.cpp is required, but it seems coherent.<br />
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.<br />
c) This patch is not sufficient to enable proper CUDA support. I'll post to the kdevelop-devel mailing list for that.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tested manually.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D17909">https://phabricator.kde.org/D17909</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>plugins/clang/duchain/clanghelpers.cpp<br />
plugins/clang/duchain/documentfinderhelpers.cpp<br />
plugins/clang/duchain/parsesession.cpp<br />
plugins/clang/kdevclang.xml<br />
plugins/clang/kdevclangsupport.json</div></div></div><br /><div><strong>To: </strong>thomassc, KDevelop<br /><strong>Cc: </strong>kdevelop-devel, glebaccon, hase, antismap, iodelay, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>