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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to