[PATCH] D122766: [clang] Use forward slash as the path separator for Windows in __FILE__, __builtin_FILE(), and std::source_location
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 20:08:15 PDT 2022
dexonsmith added a comment.
In D122766#3429552 <https://reviews.llvm.org/D122766#3429552>, @hans wrote:
>> My feeling is that the default behavior on Windows needs to be to use backslashes and not forward slashes.
>
> Okay, how would folks feel about always canonicalizing `__FILE__` etc. to use //backslashes// when targeting Windows?
FWIW (I have little Windows experience and no stake in this!), defaulting to backslashes more sense to me. Also seems easy enough to add a preprocessor option to configure this.
I'm curious though, if you're building on POSIX (so the file starts out as POSIX) and targeting Windows, does calling `make_preferred()` actually give you something reasonable in the general case? Or should it be used *only* when there's a hit in `LangOpts.remapPathPrefix()`? Sorry if this has been discussed and rejected; I haven't followed the full thread; feel free to ignore if it's not relevant; but it seems to me that when `-ffile-prefix-map` is NOT being used, then `__FILE__` ought to correspond to the build environment (if anything, it should use `Style::native`).
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