Page MenuHomePhabricator

[clang-tidy] Untangle layering in ClangTidyDiagnosticConsumer somewhat. NFC
ClosedPublic

Authored by sammccall on Nov 2 2018, 4:56 AM.

Details

Summary

Clang's hierarchy is CompilerInstance -> DiagnosticsEngine -> DiagnosticConsumer.
(Ownership is optional/shared, but this structure is fairly clear).

Currently ClangTidyDiagnosticConsumer *owns* the DiagnosticsEngine:

  • this inverts the hierarchy, which is confusing
  • this means ClangTidyDiagnosticConsumer() mutates the passed-in context, which is both surprising and limits flexibility
  • it's not possible to use a different DiagnosticsEngine with ClangTidy

This means a little bit more code in the places ClangTidy is used standalone,
but more flexibility in using ClangTidy with other diagnostics configurations.

Diff Detail

Event Timeline

sammccall created this revision.Nov 2 2018, 4:56 AM
hokein accepted this revision.Nov 2 2018, 6:06 AM

This looks clearer!

This revision is now accepted and ready to land.Nov 2 2018, 6:06 AM
This revision was automatically updated to reflect the committed changes.