[PATCH] D110596: [CUDA] Move CUDA SDK include path further down the include search path.

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 27 15:28:36 PDT 2021


tra created this revision.
tra added reviewers: tambre, jlebar.
Herald added subscribers: bixia, yaxunl.
tra requested review of this revision.
Herald added a project: clang.

This allows clang to work on Linux distributions like Debian where
<CUDA-PATH>/include may be a symlink to /usr/include. We only need
`cuda_wrappers` to be present before the standard C++ library headers.
The CUDA SDK headers themselves do not need to be found that early.

This addresses https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995122 
mentioned in post-commit comments on D108247 <https://reviews.llvm.org/D108247>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110596

Files:
  clang/lib/Driver/ToolChains/Cuda.cpp


Index: clang/lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Cuda.cpp
+++ clang/lib/Driver/ToolChains/Cuda.cpp
@@ -299,8 +299,6 @@
     return;
   }
 
-  CC1Args.push_back("-internal-isystem");
-  CC1Args.push_back(DriverArgs.MakeArgString(getIncludePath()));
   CC1Args.push_back("-include");
   CC1Args.push_back("__clang_cuda_runtime_wrapper.h");
 }
@@ -867,6 +865,8 @@
 void CudaToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
                                               ArgStringList &CC1Args) const {
   HostTC.AddClangSystemIncludeArgs(DriverArgs, CC1Args);
+  CC1Args.append({"-internal-isystem",
+                  DriverArgs.MakeArgString(CudaInstallation.getIncludePath())});
 }
 
 void CudaToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110596.375420.patch
Type: text/x-patch
Size: 865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210927/65967702/attachment.bin>


More information about the cfe-commits mailing list