This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add the flag -ffile-reproducible
AbandonedPublic

Authored by ayzhao on May 6 2022, 3:27 PM.

Details

Reviewers
None
Summary

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

Diff Detail

Event Timeline

ayzhao created this revision.May 6 2022, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 3:27 PM
ayzhao requested review of this revision.May 6 2022, 3:27 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 6 2022, 3:27 PM
ayzhao abandoned this revision.May 6 2022, 3:28 PM

Duplicate of D122766