clang-tools 10.0.0

Public Types | Public Member Functions | List of all members
clang::clangd::StoreDiags Class Reference

StoreDiags collects the diagnostics that can later be reported by clangd. More...

`#include <Diagnostics.h>`

Inheritance diagram for clang::clangd::StoreDiags:
[legend]
Collaboration diagram for clang::clangd::StoreDiags:
[legend]

## Public Types
using | DiagFixer = std::function< std::vector< Fix >(DiagnosticsEngine::Level, const clang::Diagnostic &)>
using | LevelAdjuster = std::function< DiagnosticsEngine::Level(DiagnosticsEngine::Level, const clang::Diagnostic &)>

## Public Member Functions
std::vector< Diag > | take (const clang::tidy::ClangTidyContext *Tidy=nullptr)
void | BeginSourceFile (const LangOptions &Opts, const Preprocessor *) 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...

## Detailed Description

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 119 of file Diagnostics.h.

## Member Typedef Documentation

## ◆ DiagFixer

using clang::clangd::StoreDiags::DiagFixer = std::function<std::vector<Fix>(DiagnosticsEngine::Level, const clang::Diagnostic &)>

Definition at line 130 of file Diagnostics.h.

## ◆ LevelAdjuster

using clang::clangd::StoreDiags::LevelAdjuster = std::function<DiagnosticsEngine::Level( DiagnosticsEngine::Level, const clang::Diagnostic &)>

Definition at line 132 of file Diagnostics.h.

## Member Function Documentation

## ◆ BeginSourceFile()

void clang::clangd::StoreDiags::BeginSourceFile | ( | const LangOptions & | Opts,
|  | const Preprocessor * |
| ) |  |
| override

Definition at line 470 of file Diagnostics.cpp.

## ◆ contributeFixes()

void clang::clangd::StoreDiags::contributeFixes | ( | DiagFixer | Fixer | ) |
| inline

If set, possibly adds fixes for diagnostics using `Fixer`.

Definition at line 134 of file Diagnostics.h.

## ◆ EndSourceFile()

void clang::clangd::StoreDiags::EndSourceFile | ( |  | ) |
| override

Definition at line 475 of file Diagnostics.cpp.

References clang::clangd::None.

## ◆ HandleDiagnostic()

void clang::clangd::StoreDiags::HandleDiagnostic | ( | DiagnosticsEngine::Level | DiagLevel,
|  | const clang::Diagnostic & | Info
| ) |  |
| override

Definition at line 510 of file Diagnostics.cpp.

References clang::clangd::DiagBase::AbsFile, clang::clangd::DiagBase::File, clang::clangd::fillNonLocationData(), clang::clangd::getCanonicalPath(), clang::clangd::DiagBase::InsideMainFile, clang::clangd::isInsideMainFile(), clang::clangd::IgnoreDiagnostics::log(), and clang::clangd::DiagBase::Range.

## ◆ setLevelAdjuster()

void clang::clangd::StoreDiags::setLevelAdjuster | ( | LevelAdjuster | Adjuster | ) |
| 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 138 of file Diagnostics.h.

## ◆ take()

std::vector< Diag > clang::clangd::StoreDiags::take | ( | const clang::tidy::ClangTidyContext * | Tidy = `nullptr` | ) |

Definition at line 417 of file Diagnostics.cpp.

References clang::clangd::Diag::Clang, clang::clangd::Diag::ClangTidy, clang::clangd::Diag::Fixes, clang::tidy::ClangTidyContext::getCheckName(), clang::clangd::Diag::ID, clang::clangd::DiagBase::Message, clang::clangd::Fix::Message, Name, clang::clangd::Diag::Name, clang::clangd::Diag::Notes, clang::clangd::DiagBase::Range, clang::clangd::Diag::Source, and clang::clangd::Warning.

The documentation for this class was generated from the following files:

- Diagnostics.h
- Diagnostics.cpp