[PATCH] D57769: [PDB] Remove dots and canonicalize slashes when using /PDBSOURCEPATH

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 12:41:41 PST 2019


zturner added a comment.

In D57769#1385861 <https://reviews.llvm.org/D57769#1385861>, @thakis wrote:

> Ah, I see.
>
> It feels a bit weird to use the native path functions only to then manually replace slashes. What do you think about:
>
>   sys::path::Style guessed_style = Config->PDBSourcePath.startswith("/")
>                                       ? sys::path::Style::posix
>                                       : sys::path::Style::windows;
>   
>
> after the first return and then pass that to all the sys::path function calls in this function instead?


Well, the second return (which gets entered if user did not specify `/PDBSOURCEPATH`) handles the case where it actually *must be* on the local file system, so I think those calls should still use the native path syntax.  But it would probably be fine to use the sys::path functions everywhere else.  The reason I didn't do it is because they deal with `std::string`, and it seemed silly to have to marshal this `SmallString<>` through a separate type just to satisfy the API.  I could also have added an overload of `convert_to_slash()` that just dealt with `SmallString`, but ultimately they just boil down to a `std::replace()` anyway, so I just inlined it.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D57769





More information about the llvm-commits mailing list