[PATCH] D122766: [clang] Use forward slash as the path separator for Windows in __FILE__, __builtin_FILE(), and std::source_location

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 1 07:03:29 PDT 2022


thakis added a comment.

In D122766#3421410 <https://reviews.llvm.org/D122766#3421410>, @mstorsjo wrote:

> In D122766#3420925 <https://reviews.llvm.org/D122766#3420925>, @thakis wrote:
>
>> Windows can handle slashes, but several tools can't. I worry that if we do something different than cl, some random corner case might break (dbghelp, or some source server thing or some custom debug info processor somewhere).
>
> Yup, that's a valid concern. Especially PDB handling is pretty particular about requiring backslashes, as far as I've seen.
>
>>> Then secondly - if the source paths are relative paths, making them OS-agnostic in this way does make sense. But if they are absolute, they are pretty much by definition specific to the build host,
>>
>> We use `/pdbsourcepath:X:\fake\prefix` to write a deterministic absolute path to the output file at link time (and `-fdebug-compilation-dir .` to get deterministic compiler output – see https://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html). The motivation is to get exactly the same output when building on linux and windows hosts.
>
> Ok, nice.
>
> Do you agree that if we go down this path doing this, we should also do it whenever the host OS is windows, i.e. also for windows->linux cross compilation, for consistency?

Yes, to me it makes sense that this should depend on the target triple, not on the host system (ie always use slashes when targeting non-Windows, and jury still a bit out on what exactly to do when targeting Windows).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122766



More information about the cfe-commits mailing list