diff options
author | Sam McCall <sam.mccall@gmail.com> | 2018-11-02 10:01:59 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2018-11-02 10:01:59 +0000 |
commit | cb50e23ba86ecfbb22f0eb1eec2fde9cc0c55569 (patch) | |
tree | 1b20436cdd349fdeebc06a52c670ee1d07b4ea09 /clang/lib/Lex/ModuleMap.cpp | |
parent | 31d012eb2f2d839c0e37bf65bb868441b90b3e33 (diff) | |
download | llvm-cb50e23ba86ecfbb22f0eb1eec2fde9cc0c55569.zip llvm-cb50e23ba86ecfbb22f0eb1eec2fde9cc0c55569.tar.gz llvm-cb50e23ba86ecfbb22f0eb1eec2fde9cc0c55569.tar.bz2 |
[clang-tidy] Get ClangTidyContext out of the business of storing diagnostics. 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
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions