[PATCH] D108918: [clang] NFC: Extract DiagnosticOptions parsing

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 2 05:40:21 PDT 2021


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:2270-2274
+  if (UseNewCC1Process)
+    *UseNewCC1Process =
+        Args.hasFlag(clang::driver::options::OPT_fno_integrated_cc1,
+                     clang::driver::options::OPT_fintegrated_cc1,
+                     /*Default=*/CLANG_SPAWN_CC1);
----------------
dexonsmith wrote:
> I don't think `-fintegrated-cc1` is related to diagnostic options. I suggest leaving it behind in the driver code and using:
> ```
> lang=c++
> std::unique_ptr<DiagnosticOptions>
> clang::createAndPopulateDiagOpts(ArrayRef<const char *> Argv) {
>   return createAndPopulateDiagOptsImpl(Argv);
> }
> ```
I left the `-fintegrated-cc1`-related code in the function, since it works on the parsed `InputArgList`. The whole point of this function is to free its clients of parsing the command-line options into `InputArgList`. If we leave `-fintegrated-cc1`-related code in the driver, we'll need to parse the arguments into `InputArgList` twice (not a big fan of that), or iterate over the raw command-line manually (not a big fan of that either, but should be more efficient). I decided to leave the code in the driver and go with the second option. Let me know it that doesn't seem reasonable to you and I can revisit this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108918



More information about the cfe-commits mailing list