HomePhabricator

[clang][tooling] Create SourceManager for DiagnosticsEngine before command-line…

Authored by jansvoboda11 on Apr 6 2021, 1:38 AM.

Description

[clang][tooling] Create SourceManager for DiagnosticsEngine before command-line parsing

In D84673, we started using DiagnosticsEngine during command-line parsing in more contexts.

When using ToolInvocation, a custom DiagnosticsConsumer can be specified and it might expect SourceManager to be present on the emitted diagnostics.

This patch ensures the SourceManager is set up in such scenarios.

Test authored by Jordan Rupprecht.

Reviewed By: rupprecht

Differential Revision: https://reviews.llvm.org/D99414