Replaces / with \ on Windows. nop on other platforms.

http://llvm-reviews.chandlerc.com/D540

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -456,10 +456,12 @@
     ArgStringList Files = C.getTempFiles();
     for (ArgStringList::const_iterator it = Files.begin(), ie = Files.end();
          it != ie; ++it) {
-      Diag(clang::diag::note_drv_command_failed_diag_msg) << *it;
+      SmallString<128> NativePath;
+      llvm::sys::path::native(*it, NativePath);
+      Diag(clang::diag::note_drv_command_failed_diag_msg) << NativePath;
 
       std::string Err;
-      std::string Script = StringRef(*it).rsplit('.').first;
+      std::string Script = StringRef(NativePath).rsplit('.').first;
       Script += ".sh";
       llvm::raw_fd_ostream ScriptOS(Script.c_str(), Err,
                                     llvm::raw_fd_ostream::F_Excl |
@@ -476,7 +478,7 @@
         E = Cmd.find(" ", I);
         assert (E != std::string::npos && "-main-file-name missing argument?");
         StringRef OldFilename = StringRef(Cmd).slice(I, E);
-        StringRef NewFilename = llvm::sys::path::filename(*it);
+        StringRef NewFilename = llvm::sys::path::filename(NativePath);
         I = StringRef(Cmd).rfind(OldFilename);
         E = I + OldFilename.size();
         I = Cmd.rfind(" ", I) + 1;
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -456,10 +456,12 @@
     ArgStringList Files = C.getTempFiles();
     for (ArgStringList::const_iterator it = Files.begin(), ie = Files.end();
          it != ie; ++it) {
-      Diag(clang::diag::note_drv_command_failed_diag_msg) << *it;
+      SmallString<128> NativePath;
+      llvm::sys::path::native(*it, NativePath);
+      Diag(clang::diag::note_drv_command_failed_diag_msg) << NativePath;
 
       std::string Err;
-      std::string Script = StringRef(*it).rsplit('.').first;
+      std::string Script = StringRef(NativePath).rsplit('.').first;
       Script += ".sh";
       llvm::raw_fd_ostream ScriptOS(Script.c_str(), Err,
                                     llvm::raw_fd_ostream::F_Excl |
@@ -476,7 +478,7 @@
         E = Cmd.find(" ", I);
         assert (E != std::string::npos && "-main-file-name missing argument?");
         StringRef OldFilename = StringRef(Cmd).slice(I, E);
-        StringRef NewFilename = llvm::sys::path::filename(*it);
+        StringRef NewFilename = llvm::sys::path::filename(NativePath);
         I = StringRef(Cmd).rfind(OldFilename);
         E = I + OldFilename.size();
         I = Cmd.rfind(" ", I) + 1;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to