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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 13:04:44 PDT 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

> NVCC uses different options that should be properly translated

Interested to see how this will work. Is clang itself going to support these args (act compatibly with nvcc, or is the idea that just tools will be?



================
Comment at: clang/lib/Driver/Types.cpp:298
   }
-
+  // accept -x cu to indicate CUDA
+  if (strcmp(Name, "cu") == 0) {
----------------
I think this could be clearer: "Accept "cu" as an alias for "cuda" for NVCC compatibility"


================
Comment at: clang/lib/Tooling/InterpolatingCompilationDatabase.cpp:119
+  case types::TY_CUDA_DEVICE:
+  case types::TY_CUDA_FATBIN:
+    return types::TY_CUDA:
----------------
tra wrote:
> I don't think you need CUDA_FATBIN for clangd.  If your input is .fatbin, the source code has been long gone.
This establishes equivalence classes within which it makes sense to transfer command-line flags. So if you might have compile_commands.json entries building .fatbin inputs, and those flags are a sensible template for building *.cu.cc files, then you want fatbin here, otherwise not.


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