[PATCH] D122766: [clang] Add the flag -ffile-reproducible

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 08:57:35 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:3020-3023
+    HelpText<"remap file source paths in debug info, predefined preprocessor macros and __builtin_FILE(). Implies -ffile-reproducible.">;
 def fmacro_prefix_map_EQ
   : Joined<["-"], "fmacro-prefix-map=">, Group<f_Group>, Flags<[CC1Option]>,
+    HelpText<"remap file source paths in predefined preprocessor macros and __builtin_FILE(). Implies -ffile-reproducible.">;
----------------
These are both getting a bit long, can you wrap to 80 col?


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:1489-1490
+
+  Args.AddLastArg(CmdArgs, options::OPT_ffile_reproducible);
+  Args.AddLastArg(CmdArgs, options::OPT_fno_file_reproducible);
 }
----------------
I'm reasonably sure this does the same thing (but you should check to be sure).


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:4102-4105
+      !Args.getLastArg(options::OPT_fno_file_reproducible) &&
+      (Args.getLastArg(options::OPT_ffile_compilation_dir_EQ) ||
+       Args.getLastArg(options::OPT_fmacro_prefix_map_EQ) ||
+       Args.getLastArg(options::OPT_ffile_reproducible));
----------------
I was hoping there was a clean way to do this using `hasFlag()` but I wasn't really excited by what I was getting from that; I think this is okay, but no need to qualify the option names.


================
Comment at: clang/lib/Lex/PPMacroExpansion.cpp:1895-1900
+    if (TI.getTriple().isOSWindows()) {
+      llvm::sys::path::make_preferred(
+          Path, llvm::sys::path::Style::windows_backslash);
+    } else {
+      llvm::sys::path::make_preferred(Path, llvm::sys::path::Style::posix);
+    }
----------------
LLVM style nit for single-line if/else clauses (the diff view makes it look more scary than it is).


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