10 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_DIAGNOSTICS_H 11 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_DIAGNOSTICS_H 15 #include "clang/Basic/Diagnostic.h" 16 #include "clang/Basic/LangOptions.h" 17 #include "llvm/ADT/ArrayRef.h" 18 #include "llvm/ADT/STLExtras.h" 19 #include "llvm/ADT/StringSet.h" 33 DiagnosticsEngine::Level
Severity = DiagnosticsEngine::Note;
45 llvm::SmallVector<TextEdit, 1>
Edits;
47 llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS,
const Fix &F);
60 llvm::raw_ostream &
operator<<(llvm::raw_ostream &OS,
const Diag &D);
80 std::vector<Diag> take();
82 void BeginSourceFile(
const LangOptions &Opts,
const Preprocessor *)
override;
83 void EndSourceFile()
override;
84 void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
85 const clang::Diagnostic &
Info)
override;
90 std::vector<Diag> Output;
91 llvm::Optional<LangOptions> LangOpts;
92 llvm::Optional<Diag> LastDiag;
StoreDiags collects the diagnostics that can later be reported by clangd.
Contains basic information about a diagnostic.
void toLSPDiags(const Diag &D, llvm::function_ref< void(clangd::Diagnostic, llvm::ArrayRef< Fix >)> OutFn)
Conversion to LSP diagnostics.
A top-level diagnostic that may have Notes and Fixes.
std::string Message
Message for the fix-it.
std::vector< Fix > Fixes
Alternative fixes for this diagnostic, one should be chosen.
llvm::SmallVector< TextEdit, 1 > Edits
TextEdits from clang's fix-its. Must be non-empty.
int getSeverity(DiagnosticsEngine::Level L)
Convert from clang diagnostic level to LSP severity.
DiagnosticsEngine::Level Severity
Represents a single fix-it that editor can apply to fix the error.
std::vector< Note > Notes
Elaborate on the problem, usually pointing to a related piece of code.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Represents a note for the diagnostic.
raw_ostream & operator<<(raw_ostream &OS, const CodeCompletion &C)