Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Qt Creator 10.0.0
-
None
Description
clang supports compiling cuda-C++, yet when a cuda source file is opened in Qt Creator, clangd is not run on the file and thus one is unable to follow symbols, find usages, etc.
In plugins/cppeditor/cppeditorconstants.h, mimetypes are specified for C/C++/Objc/Cuda:
const char C_SOURCE_MIMETYPE[] = "text/x-csrc"; const char CUDA_SOURCE_MIMETYPE[] = "text/vnd.nvidia.cuda.csrc"; const char C_HEADER_MIMETYPE[] = "text/x-chdr"; const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src"; const char OBJECTIVE_C_SOURCE_MIMETYPE[] = "text/x-objcsrc"; const char OBJECTIVE_CPP_SOURCE_MIMETYPE[] = "text/x-objc++src"; const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
However in plugins/clangcodemodel/clangdclient.cpp cuda is missing from mimeTypes:
ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir) : Client(clientInterface(project, jsonDbDir)), d(new Private(this, project)) { setName(tr("clangd")); LanguageFilter langFilter; langFilter.mimeTypes = QStringList{"text/x-chdr", "text/x-csrc", "text/x-c++hdr", "text/x-c++src", "text/x-objc++src", "text/x-objcsrc"};
Adding "text/vnd.nvidia.cuda.csrc" to langFilter.mimeTypes fixes the issue for us and qtcreator regains the ability to use a code model for cuda sources, as it had before switching to clangd.