#include "Diagnostics.h"
#include "../clang-tidy/ClangTidyDiagnosticConsumer.h"
#include "Compiler.h"
#include "Protocol.h"
#include "SourceCode.h"
#include "support/Logger.h"
#include "clang/Basic/AllDiagnostics.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <optional>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
namespace clang {
namespace clangd {
namespace {
const char *getDiagnosticCode(unsigned ID) { … }
bool mentionsMainFile(const Diag &D) { … }
bool isExcluded(unsigned DiagID) { … }
bool locationInRange(SourceLocation L, CharSourceRange R,
const SourceManager &M) { … }
std::optional<Range> diagnosticRange(const clang::Diagnostic &D,
const LangOptions &L) { … }
const char *getMainFileRange(const Diag &D, const SourceManager &SM,
SourceLocation DiagLoc, Range &R) { … }
bool tryMoveToMainFile(Diag &D, FullSourceLoc DiagLoc) { … }
bool isNote(DiagnosticsEngine::Level L) { … }
llvm::StringRef diagLeveltoString(DiagnosticsEngine::Level Lvl) { … }
void printDiag(llvm::raw_string_ostream &OS, const DiagBase &D) { … }
std::string capitalize(std::string Message) { … }
std::string mainMessage(const Diag &D, const ClangdDiagnosticOptions &Opts) { … }
std::string noteMessage(const Diag &Main, const DiagBase &Note,
const ClangdDiagnosticOptions &Opts) { … }
void setTags(clangd::Diag &D) { … }
}
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const DiagBase &D) { … }
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Fix &F) { … }
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Diag &D) { … }
Diag toDiag(const llvm::SMDiagnostic &D, Diag::DiagSource Source) { … }
void toLSPDiags(
const Diag &D, const URIForFile &File, const ClangdDiagnosticOptions &Opts,
llvm::function_ref<void(clangd::Diagnostic, llvm::ArrayRef<Fix>)> OutFn) { … }
int getSeverity(DiagnosticsEngine::Level L) { … }
std::vector<Diag> StoreDiags::take(const clang::tidy::ClangTidyContext *Tidy) { … }
void StoreDiags::BeginSourceFile(const LangOptions &Opts,
const Preprocessor *PP) { … }
void StoreDiags::EndSourceFile() { … }
static void writeCodeToFixMessage(llvm::raw_ostream &OS, llvm::StringRef Code) { … }
static void fillNonLocationData(DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info,
clangd::DiagBase &D) { … }
void StoreDiags::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
const clang::Diagnostic &Info) { … }
void StoreDiags::flushLastDiag() { … }
bool isDiagnosticSuppressed(const clang::Diagnostic &Diag,
const llvm::StringSet<> &Suppress,
const LangOptions &LangOpts) { … }
llvm::StringRef normalizeSuppressedCode(llvm::StringRef Code) { … }
std::optional<std::string> getDiagnosticDocURI(Diag::DiagSource Source,
unsigned ID,
llvm::StringRef Name) { … }
}
}