[PATCH] D93701: [clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 7 05:01:51 PST 2021


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1400-1402
 bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
-                                DiagnosticsEngine *Diags,
+                                DiagnosticsEngine &Diags,
                                 bool DefaultDiagColor) {
----------------
dexonsmith wrote:
> Instead of this change (and updating callers), I suggest adding:
> ```
>   Optional<DiagnosticsEngine> IgnoredDiags;
>   if (!Diags) {
>     IgnoredDiags.emplace(new DiagnosticIDs(), new DiagnosticOptions(),
>                          new IgnoringDiagConsumer());
>     Diags = &*IgnoredDiags;
>   }
> ```
> 
That's a nice way to keep the signature intact. Thanks!


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