|
clang-tools 24.0.0git
|
StoreDiags collects the diagnostics that can later be reported by clangd. More...
#include <Diagnostics.h>
Public Types | |
| using | DiagFixer |
| When passed a main diagnostic, returns fixes to add to it. | |
| using | LevelAdjuster |
| using | DiagCallback |
| using | DiagFinalizer = std::function<void(Diag &)> |
Public Member Functions | |
| std::vector< Diag > | take () |
| 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. | |
| 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. | |
| void | setDiagCallback (DiagCallback CB) |
| Invokes a callback when a main diagnostic is first formed, before notes and fixes are attached. | |
| void | setDiagFinalizer (DiagFinalizer F) |
| Invokes a callback after notes and fixes have been attached. | |
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 135 of file Diagnostics.h.
Definition at line 151 of file Diagnostics.h.
| using clang::clangd::StoreDiags::DiagFinalizer = std::function<void(Diag &)> |
Definition at line 153 of file Diagnostics.h.
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.
Definition at line 149 of file Diagnostics.h.
|
override |
Definition at line 616 of file Diagnostics.cpp.
|
inline |
If set, possibly adds fixes for diagnostics using Fixer.
Definition at line 155 of file Diagnostics.h.
Referenced by clang::clangd::ParsedAST::build().
|
override |
Definition at line 624 of file Diagnostics.cpp.
Referenced by clang::clangd::ParsedAST::build().
|
override |
Definition at line 686 of file Diagnostics.cpp.
References clang::clangd::Config::current(), clang::clangd::Config::Diagnostics, clang::clangd::fillNonLocationData(), clang::clangd::getCanonicalPath(), clang::clangd::Info, clang::clangd::isDiagnosticSuppressed(), clang::clangd::isInsideMainFile(), clang::clangd::IgnoreDiagnostics::log(), clang::clangd::Config::Suppress, clang::clangd::Config::SuppressAll, clang::clangd::toTextEdit(), clang::clangd::translatePreamblePatchLocation(), and clang::clangd::writeCodeToFixMessage().
|
inline |
Invokes a callback when a main diagnostic is first formed, before notes and fixes are attached.
The callback can mutate the diagnostic.
Definition at line 162 of file Diagnostics.h.
Referenced by clang::clangd::ParsedAST::build(), and clang::clangd::buildPreamble().
|
inline |
Invokes a callback after notes and fixes have been attached.
Definition at line 164 of file Diagnostics.h.
Referenced by clang::clangd::ParsedAST::build(), and clang::clangd::buildPreamble().
|
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 159 of file Diagnostics.h.
Referenced by clang::clangd::ParsedAST::build(), and clang::clangd::buildPreamble().
| std::vector< Diag > clang::clangd::StoreDiags::take | ( | ) |
Definition at line 567 of file Diagnostics.cpp.
References clang::clangd::Diag::Clang, clang::clangd::DiagBase::ID, clang::clangd::Diag::Name, clang::clangd::Diag::Source, clang::clangd::Diag::Unknown, and clang::clangd::Warning.
Referenced by clang::clangd::ParsedAST::build(), clang::clangd::TestTU::build(), and clang::clangd::buildPreamble().