clang-tools  14.0.0git
Namespaces | Functions
ClangTidyDiagnosticConsumer.cpp File Reference
#include "ClangTidyDiagnosticConsumer.h"
#include "ClangTidyOptions.h"
#include "GlobList.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/Attr.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/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include <tuple>
#include <utility>
#include <vector>
Include dependency graph for ClangTidyDiagnosticConsumer.cpp:

Go to the source code of this file.

Namespaces

 clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
 
 clang::tidy
 

Functions

static bool isNOLINTFound (StringRef NolintDirectiveText, StringRef CheckName, StringRef Line, size_t *FoundNolintIndex=nullptr, StringRef *FoundNolintChecksStr=nullptr)
 
static llvm::Optional< StringRef > getBuffer (const SourceManager &SM, FileID File, bool AllowIO)
 
static ClangTidyError createNolintError (const ClangTidyContext &Context, const SourceManager &SM, SourceLocation Loc, bool IsNolintBegin)
 
static Optional< ClangTidyErrortallyNolintBegins (const ClangTidyContext &Context, const SourceManager &SM, StringRef CheckName, SmallVector< StringRef > Lines, SourceLocation LinesLoc, SmallVector< std::pair< SourceLocation, StringRef >> &NolintBegins)
 
static bool lineIsWithinNolintBegin (const ClangTidyContext &Context, SmallVectorImpl< ClangTidyError > &SuppressionErrors, const SourceManager &SM, SourceLocation Loc, StringRef CheckName, StringRef TextBeforeDiag, StringRef TextAfterDiag)
 
static bool lineIsMarkedWithNOLINT (const ClangTidyContext &Context, SmallVectorImpl< ClangTidyError > &SuppressionErrors, bool AllowIO, const SourceManager &SM, SourceLocation Loc, StringRef CheckName, bool EnableNolintBlocks)
 
static bool lineIsMarkedWithNOLINTinMacro (const Diagnostic &Info, const ClangTidyContext &Context, SmallVectorImpl< ClangTidyError > &SuppressionErrors, bool AllowIO, bool EnableNolintBlocks)
 
bool clang::tidy::shouldSuppressDiagnostic (DiagnosticsEngine::Level DiagLevel, const Diagnostic &Info, ClangTidyContext &Context, SmallVectorImpl< ClangTidyError > &SuppressionErrors, bool AllowIO=true, bool EnableNolintBlocks=true)
 Check whether a given diagnostic should be suppressed due to the presence of a "NOLINT" suppression comment. More...
 
const llvm::StringMap< tooling::Replacements > * clang::tidy::getFixIt (const tooling::Diagnostic &Diagnostic, bool AnyFix)
 Gets the Fix attached to Diagnostic. More...
 

Function Documentation

◆ createNolintError()

static ClangTidyError createNolintError ( const ClangTidyContext Context,
const SourceManager &  SM,
SourceLocation  Loc,
bool  IsNolintBegin 
)
static

Definition at line 356 of file ClangTidyDiagnosticConsumer.cpp.

◆ getBuffer()

static llvm::Optional<StringRef> getBuffer ( const SourceManager &  SM,
FileID  File,
bool  AllowIO 
)
static

Definition at line 350 of file ClangTidyDiagnosticConsumer.cpp.

◆ isNOLINTFound()

static bool isNOLINTFound ( StringRef  NolintDirectiveText,
StringRef  CheckName,
StringRef  Line,
size_t *  FoundNolintIndex = nullptr,
StringRef *  FoundNolintChecksStr = nullptr 
)
static

Definition at line 308 of file ClangTidyDiagnosticConsumer.cpp.

References clang::tidy::GlobList::contains(), and Line.

◆ lineIsMarkedWithNOLINT()

static bool lineIsMarkedWithNOLINT ( const ClangTidyContext Context,
SmallVectorImpl< ClangTidyError > &  SuppressionErrors,
bool  AllowIO,
const SourceManager &  SM,
SourceLocation  Loc,
StringRef  CheckName,
bool  EnableNolintBlocks 
)
static

Definition at line 448 of file ClangTidyDiagnosticConsumer.cpp.

◆ lineIsMarkedWithNOLINTinMacro()

static bool lineIsMarkedWithNOLINTinMacro ( const Diagnostic Info,
const ClangTidyContext Context,
SmallVectorImpl< ClangTidyError > &  SuppressionErrors,
bool  AllowIO,
bool  EnableNolintBlocks 
)
static

Definition at line 487 of file ClangTidyDiagnosticConsumer.cpp.

◆ lineIsWithinNolintBegin()

static bool lineIsWithinNolintBegin ( const ClangTidyContext Context,
SmallVectorImpl< ClangTidyError > &  SuppressionErrors,
const SourceManager &  SM,
SourceLocation  Loc,
StringRef  CheckName,
StringRef  TextBeforeDiag,
StringRef  TextAfterDiag 
)
static

Definition at line 408 of file ClangTidyDiagnosticConsumer.cpp.

◆ tallyNolintBegins()

static Optional<ClangTidyError> tallyNolintBegins ( const ClangTidyContext Context,
const SourceManager &  SM,
StringRef  CheckName,
SmallVector< StringRef >  Lines,
SourceLocation  LinesLoc,
SmallVector< std::pair< SourceLocation, StringRef >> &  NolintBegins 
)
static

Definition at line 372 of file ClangTidyDiagnosticConsumer.cpp.