aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/LangOptions.cpp
diff options
context:
space:
mode:
authorAlan Zhao <ayzhao@google.com>2022-05-11 22:54:09 +0200
committerHans Wennborg <hans@chromium.org>2022-05-11 23:04:36 +0200
commit6398f3f2e9045cb38c73425fcc4dddbfb8933a57 (patch)
treec8ce32d2b82f39c5e33e9918df9d3f985669b430 /clang/lib/Basic/LangOptions.cpp
parent772b0c44a4296a34cbc072c2a7cf294410d07a1a (diff)
downloadllvm-6398f3f2e9045cb38c73425fcc4dddbfb8933a57.zip
llvm-6398f3f2e9045cb38c73425fcc4dddbfb8933a57.tar.gz
llvm-6398f3f2e9045cb38c73425fcc4dddbfb8933a57.tar.bz2
[clang] Add the flag -ffile-reproducible
When Clang generates the path prefix (i.e. the path of the directory where the file is) when generating FILE, __builtin_FILE(), and std::source_location, Clang uses the platform-specific path separator character of the build environment where Clang _itself_ is built. This leads to inconsistencies in Chrome builds where Clang running on non-Windows environments uses the forward slash (/) path separator while Clang running on Windows builds uses the backslash (\) path separator. To fix this, we add a flag -ffile-reproducible (and its inverse, -fno-file-reproducible) to have Clang use the target's platform-specific file separator character. Additionally, the existing flags -fmacro-prefix-map and -ffile-prefix-map now both imply -ffile-reproducible. This can be overriden by setting -fno-file-reproducible. [0]: https://crbug.com/1310767 Differential revision: https://reviews.llvm.org/D122766
Diffstat (limited to 'clang/lib/Basic/LangOptions.cpp')
-rw-r--r--clang/lib/Basic/LangOptions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp
index 2bc791c..7791bff 100644
--- a/clang/lib/Basic/LangOptions.cpp
+++ b/clang/lib/Basic/LangOptions.cpp
@@ -62,7 +62,7 @@ unsigned LangOptions::getOpenCLCompatibleVersion() const {
llvm_unreachable("Unknown OpenCL version");
}
-void LangOptions::remapPathPrefix(SmallString<256> &Path) const {
+void LangOptions::remapPathPrefix(SmallVectorImpl<char> &Path) const {
for (const auto &Entry : MacroPrefixMap)
if (llvm::sys::path::replace_path_prefix(Path, Entry.first, Entry.second))
break;