[all-commits] [llvm/llvm-project] 6398f3: [clang] Add the flag -ffile-reproducible

Alan Zhao via All-commits all-commits at lists.llvm.org
Wed May 11 14:05:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6398f3f2e9045cb38c73425fcc4dddbfb8933a57
      https://github.com/llvm/llvm-project/commit/6398f3f2e9045cb38c73425fcc4dddbfb8933a57
  Author: Alan Zhao <ayzhao at google.com>
  Date:   2022-05-11 (Wed, 11 May 2022)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Lex/Preprocessor.h
    M clang/lib/AST/Expr.cpp
    M clang/lib/Basic/LangOptions.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Lex/PPMacroExpansion.cpp
    M clang/test/CodeGenCXX/builtin-source-location.cpp
    M clang/test/Preprocessor/file_test.c
    M clang/test/Preprocessor/file_test_windows.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list