clang-tools
15.0.0git
|
StoreDiags collects the diagnostics that can later be reported by clangd. More...
#include <Diagnostics.h>
Public Types | |
using | DiagFixer = std::function< std::vector< Fix >(DiagnosticsEngine::Level, const clang::Diagnostic &)> |
When passed a main diagnostic, returns fixes to add to it. More... | |
using | LevelAdjuster = std::function< DiagnosticsEngine::Level(DiagnosticsEngine::Level, const clang::Diagnostic &)> |
using | DiagCallback = std::function< void(const clang::Diagnostic &, clangd::Diag &)> |
Public Member Functions | |
std::vector< Diag > | take (const clang::tidy::ClangTidyContext *Tidy=nullptr) |
void | BeginSourceFile (const LangOptions &Opts, const Preprocessor *PP) override |
void | EndSourceFile () override |
void | HandleDiagnostic (DiagnosticsEngine::Level DiagLevel, const clang::Diagnostic &Info) override |
void | contributeFixes (DiagFixer Fixer) |
If set, possibly adds fixes for diagnostics using Fixer . More... | |
void | setLevelAdjuster (LevelAdjuster Adjuster) |
If set, this allows the client of this class to adjust the level of diagnostics, such as promoting warnings to errors, or ignoring diagnostics. More... | |
void | setDiagCallback (DiagCallback CB) |
Invokes a callback every time a diagnostics is completely formed. More... | |
StoreDiags collects the diagnostics that can later be reported by clangd.
It groups all notes for a diagnostic into a single Diag and filters out diagnostics that don't mention the main file (i.e. neither the diag itself nor its notes are in the main file).
Definition at line 133 of file Diagnostics.h.
using clang::clangd::StoreDiags::DiagCallback = std::function<void(const clang::Diagnostic &, clangd::Diag &)> |
Definition at line 151 of file Diagnostics.h.
using clang::clangd::StoreDiags::DiagFixer = std::function<std::vector<Fix>(DiagnosticsEngine::Level, const clang::Diagnostic &)> |
When passed a main diagnostic, returns fixes to add to it.
When passed a note diagnostic, returns fixes to replace it with.
Definition at line 147 of file Diagnostics.h.
using clang::clangd::StoreDiags::LevelAdjuster = std::function<DiagnosticsEngine::Level( DiagnosticsEngine::Level, const clang::Diagnostic &)> |
Definition at line 149 of file Diagnostics.h.
|
override |
Definition at line 614 of file Diagnostics.cpp.
|
inline |
If set, possibly adds fixes for diagnostics using Fixer
.
Definition at line 153 of file Diagnostics.h.
|
override |
Definition at line 622 of file Diagnostics.cpp.
|
override |
Definition at line 662 of file Diagnostics.cpp.
|
inline |
Invokes a callback every time a diagnostics is completely formed.
Handler of the callback can also mutate the diagnostic.
Definition at line 160 of file Diagnostics.h.
Referenced by clang::clangd::ParsedAST::build().
|
inline |
If set, this allows the client of this class to adjust the level of diagnostics, such as promoting warnings to errors, or ignoring diagnostics.
Definition at line 157 of file Diagnostics.h.
std::vector< Diag > clang::clangd::StoreDiags::take | ( | const clang::tidy::ClangTidyContext * | Tidy = nullptr | ) |
Definition at line 560 of file Diagnostics.cpp.
References clang::clangd::Diag::Clang, clang::clangd::Diag::ClangTidy, ns1::ns2::D, clang::clangd::Diag::Fixes, clang::tidy::ClangTidyContext::getCheckName(), clang::clangd::DiagBase::ID, clang::clangd::DiagBase::Message, clang::clangd::Fix::Message, Name, clang::clangd::Diag::Name, clang::clangd::Diag::Notes, Output, clang::clangd::Diag::Source, and clang::clangd::Warning.