#include "ClangTidyDiagnosticConsumer.h"
#include "ClangTidyOptions.h"
#include "GlobList.h"
#include "NoLintDirectiveHandler.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/Attr.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/DiagnosticRenderer.h"
#include "clang/Lex/Lexer.h"
#include "clang/Tooling/Core/Diagnostic.h"
#include "clang/Tooling/Core/Replacement.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include <optional>
#include <tuple>
#include <utility>
#include <vector>
usingnamespaceclang;
usingnamespacetidy;
namespace {
class ClangTidyDiagnosticRenderer : public DiagnosticRenderer { … };
}
ClangTidyError::ClangTidyError(StringRef CheckName,
ClangTidyError::Level DiagLevel,
StringRef BuildDirectory, bool IsWarningAsError)
: … { … }
ClangTidyContext::ClangTidyContext(
std::unique_ptr<ClangTidyOptionsProvider> OptionsProvider,
bool AllowEnablingAnalyzerAlphaCheckers, bool EnableModuleHeadersParsing)
: … { … }
ClangTidyContext::~ClangTidyContext() = default;
DiagnosticBuilder ClangTidyContext::diag(
StringRef CheckName, SourceLocation Loc, StringRef Description,
DiagnosticIDs::Level Level ) { … }
DiagnosticBuilder ClangTidyContext::diag(
StringRef CheckName, StringRef Description,
DiagnosticIDs::Level Level ) { … }
DiagnosticBuilder ClangTidyContext::diag(const tooling::Diagnostic &Error) { … }
DiagnosticBuilder ClangTidyContext::configurationDiag(
StringRef Message,
DiagnosticIDs::Level Level ) { … }
bool ClangTidyContext::shouldSuppressDiagnostic(
DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info,
SmallVectorImpl<tooling::Diagnostic> &NoLintErrors, bool AllowIO,
bool EnableNoLintBlocks) { … }
void ClangTidyContext::setSourceManager(SourceManager *SourceMgr) { … }
static bool parseFileExtensions(llvm::ArrayRef<std::string> AllFileExtensions,
FileExtensionsSet &FileExtensions) { … }
void ClangTidyContext::setCurrentFile(StringRef File) { … }
void ClangTidyContext::setASTContext(ASTContext *Context) { … }
const ClangTidyGlobalOptions &ClangTidyContext::getGlobalOptions() const { … }
const ClangTidyOptions &ClangTidyContext::getOptions() const { … }
ClangTidyOptions ClangTidyContext::getOptionsForFile(StringRef File) const { … }
void ClangTidyContext::setEnableProfiling(bool P) { … }
void ClangTidyContext::setProfileStoragePrefix(StringRef Prefix) { … }
std::optional<ClangTidyProfiling::StorageParams>
ClangTidyContext::getProfileStorageParams() const { … }
bool ClangTidyContext::isCheckEnabled(StringRef CheckName) const { … }
bool ClangTidyContext::treatAsError(StringRef CheckName) const { … }
std::string ClangTidyContext::getCheckName(unsigned DiagnosticID) const { … }
ClangTidyDiagnosticConsumer::ClangTidyDiagnosticConsumer(
ClangTidyContext &Ctx, DiagnosticsEngine *ExternalDiagEngine,
bool RemoveIncompatibleErrors, bool GetFixesFromNotes,
bool EnableNolintBlocks)
: … { … }
void ClangTidyDiagnosticConsumer::finalizeLastError() { … }
namespace clang::tidy {
const llvm::StringMap<tooling::Replacements> *
getFixIt(const tooling::Diagnostic &Diagnostic, bool AnyFix) { … }
}
void ClangTidyDiagnosticConsumer::HandleDiagnostic(
DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info) { … }
bool ClangTidyDiagnosticConsumer::passesLineFilter(StringRef FileName,
unsigned LineNumber) const { … }
void ClangTidyDiagnosticConsumer::forwardDiagnostic(const Diagnostic &Info) { … }
void ClangTidyDiagnosticConsumer::checkFilters(SourceLocation Location,
const SourceManager &Sources) { … }
void ClangTidyDiagnosticConsumer::removeIncompatibleErrors() { … }
namespace {
struct LessClangTidyError { … };
struct EqualClangTidyError { … };
}
std::vector<ClangTidyError> ClangTidyDiagnosticConsumer::take() { … }
namespace {
struct LessClangTidyErrorWithoutDiagnosticName { … };
}
void ClangTidyDiagnosticConsumer::removeDuplicatedDiagnosticsOfAliasCheckers() { … }