diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2018-11-08 17:42:16 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2018-11-08 17:42:16 +0000 |
| commit | 3c1f4903b77752aa6fb820e32715a824b4e82ead (patch) | |
| tree | eace8522d4cb99aaed0f1aea85de960105c947d1 /clang-tools-extra/clang-tidy/plugin | |
| parent | 08b64d60fe0a5166972bbf72b38b93b2174bf62a (diff) | |
| download | bcm5719-llvm-3c1f4903b77752aa6fb820e32715a824b4e82ead.tar.gz bcm5719-llvm-3c1f4903b77752aa6fb820e32715a824b4e82ead.zip | |
[clang-tidy] Untangle layering in ClangTidyDiagnosticConsumer somewhat. NFC
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.
Reviewers: hokein
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54033
llvm-svn: 346418
Diffstat (limited to 'clang-tools-extra/clang-tidy/plugin')
| -rw-r--r-- | clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp index da1e2255821..22448939e83 100644 --- a/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp +++ b/clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp @@ -35,7 +35,7 @@ public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef File) override { // Insert the current diagnostics engine. - Context->DiagEngine = &Compiler.getDiagnostics(); + Context->setDiagnosticsEngine(&Compiler.getDiagnostics()); // Create the AST consumer. ClangTidyASTConsumerFactory Factory(*Context); |

