Diagnostics
Core
Clang diagnostics (errors, warnings, notes)
Severity mapping (Error, Warning)
Diagnostic ranges with source locations
Related information (notes attached to diagnostics)
File URI conversion for cross-file diagnostics
Pull diagnostics model (
textDocument/diagnostic) (clangd#2108)Report all missing
#includeerrors, not just the first — the parser stops on the first fatal errorcpp#include "missing_a.h" // error reported #include "missing_b.h" // error NOT reported (parser already stopped) #include "missing_c.h" // error NOT reportedShow the full include chain for diagnostics originating in header files (clangd#1392)
// current: "In included file: expected ';'" // expected: "In main.cpp → utils.h → detail/impl.h: expected ';'"Reflect unsaved header file changes in diagnostics (clangd#488)
// header.h (unsaved buffer): added new_func() // main.cpp: calls new_func() → should NOT show "undeclared identifier"Diagnostics for template instantiation errors in preamble headers (clangd#137)
Tags
-
Deprecatedtag for-Wdeprecateddiagnostics -
Unnecessarytag for unused variable/parameter warnings
Publishing
- Push diagnostics on compilation completion
- Clear diagnostics on file close
- Per-file diagnostic grouping (interested file + headers)
- Diagnostic
codefield with Clang error codes -
codeDescriptionwith links to Clang documentation - Diagnostic
sourcefield distinguishing clang vs clang-tidy - Configurable debounce delay before computing diagnostics (clangd#1471)
- Recompute diagnostics in open files when background indexing completes (clangd#2604)
Diagnostic Suppression
-
// NOLINTcomment suppression -
// NOLINTNEXTLINEcomment suppression -
// NOLINTBEGIN/// NOLINTENDblock suppression -
NOLINTfor include-cleaner diagnostics (clangd#1982) - Configurable severity per diagnostic category in config file (clangd#1937)
- Filter diagnostics by version control diff — only show warnings near changed lines (clangd#822)
Diagnostic Actions
- Automatic fix-its attached to diagnostics as code actions
Header Diagnostics
Include-cleaner diagnostics for unused and missing
#includedirectivesSuppress false
-Wunused-functionfor static inline functions in headers (clangd#1211)cpp// utils.h static inline int helper() { return 42; } // should NOT warn "unused function" when checking header standalonePropagate
-Wpaddedand similar layout warnings from headers (clangd#1429)Suppress false
-Wempty-translation-unitfrom preamble optimization (clangd#2358)Thread safety analysis across header boundaries (clangd#2386)
clang-tidy Integration
- clang-tidy diagnostics (gated by config)
- Suppress clang-tidy warnings originating in system-header macros (clangd#1587, clangd#2000)
- Clang static analyzer support (clangd#905)
- Version-specific clang-tidy documentation links (clangd#2136)
- Diagnostics for preprocessor directives that precede code (clangd#2501)
Diagnostic Display
Correct diagnostic range for qualified type names — underline the full name, not just the base (clangd#1035)
cppns::Inner obj(42); // ^^^^^ only base name underlined // should underline "ns::Inner"Show optimization remarks (
-Rpass) as diagnostics (clangd#2519)Project-wide warning listing (clangd#1973)
Config File Diagnostics
- Report diagnostics for malformed
.clang-tidyand.clang-formatfiles (clangd#2313, clangd#2591)
Diagnostic Correctness
Known issues that should be handled correctly:
- Macro redefinition warning pointing to the same location (clangd#2479)
- Wrong
-Wmissing-bracesfix suggestion for nested array initialization (clangd#2434) - Invalid severity 0 when preamble invalidation mixes diagnostic messages (clangd#2124)
- Undeclared identifier diagnostic hidden by correction-related diagnostics (clangd#547)
- Misleading downstream diagnostics when
--includefile is missing (clangd#2229)
Changelog
| Date | Change | PR |
|---|---|---|
| — | Clang diagnostics, severity mapping, tags, push publishing | — |