This revision was automatically updated to reflect the committed changes.
Closed by commit rGfb58142e00ad: Fix temporary file name on Windows (authored 
by yaxunl).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D91421?vs=305127&id=305352#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91421/new/

https://reviews.llvm.org/D91421

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/hip-windows-filename.hip


Index: clang/test/Driver/hip-windows-filename.hip
===================================================================
--- /dev/null
+++ clang/test/Driver/hip-windows-filename.hip
@@ -0,0 +1,10 @@
+// REQUIRES: system-windows, clang-driver, amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-pc-windows-msvc \
+// RUN:   -x hip \
+// RUN:   --offload-arch=gfx908:xnack+ \
+// RUN:   -nogpuinc -nogpulib -save-temps \
+// RUN:   %s 2>&1 | FileCheck %s
+
+// CHECK: "-o" "hip-windows-filename-hip-amdgcn-amd-amdhsa-gfx908@xnack+.cui"
+// CHECK-NOT: "-o" 
"hip-windows-filename-hip-amdgcn-amd-amdhsa-gfx908:xnack+.cui"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4692,9 +4692,16 @@
 
 const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
                                        const char *BaseInput,
-                                       StringRef BoundArch, bool AtTopLevel,
+                                       StringRef OrigBoundArch, bool 
AtTopLevel,
                                        bool MultipleArchs,
                                        StringRef OffloadingPrefix) const {
+  std::string BoundArch = OrigBoundArch.str();
+#if defined(_WIN32)
+  // BoundArch may contains ':', which is invalid in file names on Windows,
+  // therefore replace it with '%'.
+  std::replace(BoundArch.begin(), BoundArch.end(), ':', '@');
+#endif
+
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
   // Output to a user requested destination?
   if (AtTopLevel && !isa<DsymutilJobAction>(JA) && !isa<VerifyJobAction>(JA)) {


Index: clang/test/Driver/hip-windows-filename.hip
===================================================================
--- /dev/null
+++ clang/test/Driver/hip-windows-filename.hip
@@ -0,0 +1,10 @@
+// REQUIRES: system-windows, clang-driver, amdgpu-registered-target
+
+// RUN: %clang -### -target x86_64-pc-windows-msvc \
+// RUN:   -x hip \
+// RUN:   --offload-arch=gfx908:xnack+ \
+// RUN:   -nogpuinc -nogpulib -save-temps \
+// RUN:   %s 2>&1 | FileCheck %s
+
+// CHECK: "-o" "hip-windows-filename-hip-amdgcn-amd-amdhsa-gfx908@xnack+.cui"
+// CHECK-NOT: "-o" "hip-windows-filename-hip-amdgcn-amd-amdhsa-gfx908:xnack+.cui"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4692,9 +4692,16 @@
 
 const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
                                        const char *BaseInput,
-                                       StringRef BoundArch, bool AtTopLevel,
+                                       StringRef OrigBoundArch, bool AtTopLevel,
                                        bool MultipleArchs,
                                        StringRef OffloadingPrefix) const {
+  std::string BoundArch = OrigBoundArch.str();
+#if defined(_WIN32)
+  // BoundArch may contains ':', which is invalid in file names on Windows,
+  // therefore replace it with '%'.
+  std::replace(BoundArch.begin(), BoundArch.end(), ':', '@');
+#endif
+
   llvm::PrettyStackTraceString CrashInfo("Computing output path");
   // Output to a user requested destination?
   if (AtTopLevel && !isa<DsymutilJobAction>(JA) && !isa<VerifyJobAction>(JA)) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to