[PATCH] D56225: [HIP] Use nul instead of /dev/null when running on windows

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 2 14:12:36 PST 2019


yaxunl created this revision.
yaxunl added a reviewer: tra.

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


https://reviews.llvm.org/D56225

Files:
  lib/Driver/ToolChains/HIP.cpp


Index: lib/Driver/ToolChains/HIP.cpp
===================================================================
--- lib/Driver/ToolChains/HIP.cpp
+++ lib/Driver/ToolChains/HIP.cpp
@@ -24,6 +24,12 @@
 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,
@@ -201,7 +207,7 @@
   // 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();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56225.179941.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190102/f187e8bb/attachment.bin>


More information about the cfe-commits mailing list