[PATCH] D77451: Accept -x cu to indicate language is CUDA, transfer CUDA language flag to header-file arguments

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 12:00:40 PDT 2020


tra added a reviewer: sammccall.
tra added a comment.

Please add some more details to the bug description. This change is to make clangd work when compilation database sees CUDA sources compiled with nvcc. NVCC uses different options that should be properly translated. This patch only deals with recognizing the sources as CUDA, but does not handle the compiler options. While not perfect, it's still a useful improvement.

It would be great to extract CUDA path from nvcc's command line and add it as `--cuda-path=...`. I believe clang-based tools are not doing as much as clang itself when it comes to guessing CUDA location. Without it it will pick up CUDA from the default location (if at all) and that may not be the CUDA used during the build.



================
Comment at: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp:119
+  case types::TY_CUDA_DEVICE:
+  case types::TY_CUDA_FATBIN:
+    return types::TY_CUDA:
----------------
I don't think you need CUDA_FATBIN for clangd.  If your input is .fatbin, the source code has been long gone.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77451/new/

https://reviews.llvm.org/D77451





More information about the cfe-commits mailing list