[PATCH] [clang][Driver] Nativize paths when emitting crash diagnostics.

Chad Rosier mcrosier at apple.com
Wed Mar 13 14:02:37 PDT 2013


Test case?

On Mar 13, 2013, at 1:50 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:

> 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;
> <D540.1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130313/647c2d74/attachment.html>


More information about the cfe-commits mailing list