[PATCH] D54033: [clang-tidy] Untangle layering in ClangTidyDiagnosticConsumer somewhat. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 2 04:56:12 PDT 2018


sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added subscribers: cfe-commits, xazax.hun.

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.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54033

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tidy/plugin/ClangTidyPlugin.cpp
  unittests/clang-tidy/ClangTidyTest.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54033.172339.patch
Type: text/x-patch
Size: 6202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181102/19012168/attachment-0001.bin>


More information about the cfe-commits mailing list