clang-tools 19.0.0git
Classes | Public Attributes | List of all members
clang::clangd::config::Fragment::DiagnosticsBlock Struct Reference

Controls behavior of diagnostics (errors and warnings). More...

#include <ConfigFragment.h>

Classes

struct  ClangTidyBlock
 Controls how clang-tidy will run over the code base. More...
 
struct  IncludesBlock
 Controls IncludeCleaner diagnostics. More...
 

Public Attributes

std::vector< Located< std::string > > Suppress
 Diagnostic codes that should be suppressed.
 
std::optional< Located< std::string > > UnusedIncludes
 Controls how clangd will correct "unnecessary" #include directives.
 
std::optional< Located< std::string > > MissingIncludes
 Controls if clangd should analyze missing #include directives.
 
IncludesBlock Includes
 
ClangTidyBlock ClangTidy
 

Detailed Description

Controls behavior of diagnostics (errors and warnings).

Definition at line 209 of file ConfigFragment.h.

Member Data Documentation

◆ ClangTidy

ClangTidyBlock clang::clangd::config::Fragment::DiagnosticsBlock::ClangTidy

Definition at line 288 of file ConfigFragment.h.

◆ Includes

IncludesBlock clang::clangd::config::Fragment::DiagnosticsBlock::Includes

Definition at line 258 of file ConfigFragment.h.

◆ MissingIncludes

std::optional<Located<std::string> > clang::clangd::config::Fragment::DiagnosticsBlock::MissingIncludes

Controls if clangd should analyze missing #include directives.

clangd will warn if no header providing a symbol is #included (missing) directly, and suggest adding it.

Strict means a header providing a symbol is missing if it is not *directly #include'd. The file might still compile if the header is included transitively.

Valid values are:

  • Strict
  • std::nullopt

Definition at line 249 of file ConfigFragment.h.

◆ Suppress

std::vector<Located<std::string> > clang::clangd::config::Fragment::DiagnosticsBlock::Suppress

Diagnostic codes that should be suppressed.

Valid values are:

  • *, to disable all diagnostics
  • diagnostic codes exposed by clangd (e.g unknown_type, -Wunused-result)
  • clang internal diagnostic codes (e.g. err_unknown_type)
  • warning categories (e.g. unused-result)
  • clang-tidy check names (e.g. bugprone-narrowing-conversions)

This is a simple filter. Diagnostics can be controlled in other ways (e.g. by disabling a clang-tidy check, or the -Wunused compile flag). This often has other advantages, such as skipping some analysis.

Definition at line 222 of file ConfigFragment.h.

◆ UnusedIncludes

std::optional<Located<std::string> > clang::clangd::config::Fragment::DiagnosticsBlock::UnusedIncludes

Controls how clangd will correct "unnecessary" #include directives.

clangd can warn if a header is #included but not used, and suggest removing it. Strict means a header is unused if it does not directly provide any symbol used in the file. Removing it may still break compilation if it transitively includes headers that are used. This should be fixed by including those headers directly.

Valid values are:

  • Strict
  • std::nullopt

Definition at line 236 of file ConfigFragment.h.


The documentation for this struct was generated from the following file: