[PATCH] D93701: [clang][cli] NFC: Make Diags optional in normalizer

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 4 05:32:46 PST 2021


jansvoboda11 added a comment.

This will make more sense after looking at D84673 <https://reviews.llvm.org/D84673>. In short: parsing of diagnostic options can happen outside of `CompilerInvocation::createFromArgs`, that's why `ParseDiagnosticArgs` is a free function. Ideally, we'd like to reuse the existing marshalling infrastructure here as well.

`ParseDiagnosticArgs` is usually called with `DiagnosticEngine *Diags = nullptr`. That's because the call happens early on during compiler execution, where we don't have a diagnostic engine yet. This call needs to happen first, to obtain the diagnostic options that are necessary for the engine instantiation.

This patch accommodates this free function by turning all `DiagnosticEngine` references to pointers. Another solution would be to create a "dummy" `DiagnosticsEngine` for the `ParseDiagnosticArgs` calls, but I didn't find a way to do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93701



More information about the cfe-commits mailing list