[PATCH] D94337: Add cuda header type for cuh files

Ryan Greenblatt via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 8 13:15:25 PST 2021


rgreenblatt created this revision.
Herald added a subscriber: yaxunl.
rgreenblatt requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This adds a cuda header type with file extension "cuh". The output type file
extension is "cuhi" - not sure if this is a good choice. This allows
language servers to properly handle cuh files without additional arguments.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94337

Files:
  clang/include/clang/Driver/Types.def
  clang/lib/Driver/Types.cpp


Index: clang/lib/Driver/Types.cpp
===================================================================
--- clang/lib/Driver/Types.cpp
+++ clang/lib/Driver/Types.cpp
@@ -198,6 +198,8 @@
 
   case TY_CUDA:
   case TY_PP_CUDA:
+  case TY_CUDAHeader:
+  case TY_PP_CUDAHeader:
   case TY_CUDA_DEVICE:
     return true;
   }
Index: clang/include/clang/Driver/Types.def
===================================================================
--- clang/include/clang/Driver/Types.def
+++ clang/include/clang/Driver/Types.def
@@ -64,6 +64,8 @@
 TYPE("c++-header",               CXXHeader,    PP_CXXHeader,    "hh",     phases::Preprocess, phases::Precompile)
 TYPE("objective-c++-header-cpp-output", PP_ObjCXXHeader, INVALID, "mii",  phases::Precompile)
 TYPE("objective-c++-header",     ObjCXXHeader, PP_ObjCXXHeader, "h",      phases::Preprocess, phases::Precompile)
+TYPE("cuda-header-cpp-output",   PP_CUDAHeader, INVALID,        "cuhi",   phases::Precompile)
+TYPE("cuda-header",              CUDAHeader,   PP_CUDAHeader,   "cuh",    phases::Preprocess, phases::Precompile)
 TYPE("c++-module",               CXXModule,    PP_CXXModule,    "cppm",   phases::Preprocess, phases::Precompile, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 TYPE("c++-module-cpp-output",    PP_CXXModule, INVALID,         "iim",    phases::Precompile, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94337.315499.patch
Type: text/x-patch
Size: 1410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210108/9e23ab79/attachment.bin>


More information about the cfe-commits mailing list