r350885 - [HIP] Use nul instead of /dev/null when running on windows

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 10 12:09:52 PST 2019


Author: yaxunl
Date: Thu Jan 10 12:09:52 2019
New Revision: 350885

URL: http://llvm.org/viewvc/llvm-project?rev=350885&view=rev
Log:
[HIP] Use nul instead of /dev/null when running on windows

When clang is running on windows, /dev/null is not available. Use nul as empty input file instead.

Differential Revision: https://reviews.llvm.org/D56225

Modified:
    cfe/trunk/lib/Driver/ToolChains/HIP.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/HIP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/HIP.cpp?rev=350885&r1=350884&r2=350885&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/HIP.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/HIP.cpp Thu Jan 10 12:09:52 2019
@@ -24,6 +24,12 @@ using namespace clang::driver::tools;
 using namespace clang;
 using namespace llvm::opt;
 
+#if _WIN32 || _WIN64
+#define NULL_FILE "nul"
+#else
+#define NULL_FILE "/dev/null"
+#endif
+
 namespace {
 
 static void addBCLib(Compilation &C, const ArgList &Args,
@@ -197,7 +203,7 @@ void AMDGCN::constructHIPFatbinCommand(C
   // ToDo: Remove the dummy host binary entry which is required by
   // clang-offload-bundler.
   std::string BundlerTargetArg = "-targets=host-x86_64-unknown-linux";
-  std::string BundlerInputArg = "-inputs=/dev/null";
+  std::string BundlerInputArg = "-inputs=" NULL_FILE;
 
   for (const auto &II : Inputs) {
     const auto* A = II.getAction();




More information about the cfe-commits mailing list