[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 llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 18:37:46 PDT 2022


thakis added a comment.

Do you know what cl.exe does to paths in pdb files? Does it write mixed-slashiness for foo/bar.h includes, or does it write backslashes throughout?

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).

> 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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122766



More information about the llvm-commits mailing list