Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-tidy] Get ClangTidyContext out of the business of storing diag…
…nostics. NFC Summary: Currently ClangTidyContext::diag() sends the diagnostics to a DiagnosticsEngine, which probably delegates to a ClangTidyDiagnosticsConsumer, which is supposed to go back and populate ClangTidyContext::Errors. After this patch, the diagnostics are stored in the ClangTidyDiagnosticsConsumer itself and can be retrieved from there. Why? - the round-trip from context -> engine -> consumer -> context is confusing and makes it harder to establish layering between these things. - context does too many things, and makes it hard to use clang-tidy as a library - everyone who actually wants the diagnostics has access to the ClangTidyDiagnosticsConsumer The most natural implementation (ClangTidyDiagnosticsConsumer::take() finalizes diagnostics) causes a test failure: clang-tidy-run-with-database.cpp asserts that clang-tidy exits successfully when trying to process a file that doesn't exist. In clang-tidy today, this happens because finish() is never called, so the diagnostic is never flushed. This looks like a bug to me. For now, this patch carefully preserves that behavior, but I'll ping the authors to see whether it's deliberate and worth preserving. Reviewers: hokein Subscribers: xazax.hun, cfe-commits, alexfh Differential Revision: https://reviews.llvm.org/D53953 llvm-svn: 345961
- Loading branch information
1 parent
31d012e
commit cb50e23
Showing
7 changed files
with
42 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters