[PATCH] D94472: [WIP][clang][cli] Command line round-trip for HeaderSearch options

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 09:53:30 PST 2021


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1839
+    OptName = Dash + OptTable.getOptionName(OPT_stdlib_EQ);
+    Args.emplace_back(SA(OptName + "libc++"));
+  }
----------------
I plan to move the prefixing of the option name and serialization of the value into a separate function, so we don't have to duplicate the logic here.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3110
+template <typename ParseFn, typename GenerateFn, typename ResetFn>
+void RoundTrip(ParseFn &&Parse, GenerateFn &&Generate, ResetFn &&Reset,
+               CompilerInvocation &Res, InputArgList &OriginalArgs) {
----------------
I'd like to rename this function to something like `MaybeRoundTrip` and avoid the round-trip in release builds with `#ifndef NDEBUG`.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3216
+
+  RoundTrip(ParseHS, GenerateHS, ResetHS, Res, Args);
   if (DashX.getFormat() == InputKind::Precompiled ||
----------------
I plan to extract this into `ParseHeaderSearchArgsMaybeRoundtrip`.


================
Comment at: llvm/include/llvm/Option/ArgList.h:141
+  /// The OptSpecifiers that were queried from this argument list.
+  mutable DenseSet<unsigned> QueriedOpts;
+
----------------
These will be removed once we're able to generate all command line arguments. (We won't need to check which options to copy from the original command line and which to generate.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94472/new/

https://reviews.llvm.org/D94472



More information about the cfe-commits mailing list