clang-tools 22.0.0git
clang::tidy::bugprone::filter Namespace Reference

Namespaces

namespace  relatedness_heuristic
 This namespace contains the implementations for the suppression of diagnostics from similarly-used ("related") parameters.

Classes

class  SimilarlyUsedParameterPairSuppressor
 Helper class that is used to detect if two parameters of the same function are used in a similar fashion, to suppress the result. More...

Functions

static bool isIgnoredParameter (const TheCheck &Check, const ParmVarDecl *Node)
 Returns whether the parameter's name or the parameter's type's name is configured by the user to be ignored from analysis and diagnostic.
static bool isSimilarlyUsedParameter (const SimilarlyUsedParameterPairSuppressor &Suppressor, const ParmVarDecl *Param1, const ParmVarDecl *Param2)
static bool prefixSuffixCoverUnderThreshold (std::size_t Threshold, StringRef Str1, StringRef Str2)
 Returns whether the two strings are prefixes or suffixes of each other with at most Threshold characters differing on the non-common end.
static void padStringAtEnd (SmallVectorImpl< char > &Str, std::size_t ToLen)
static void padStringAtBegin (SmallVectorImpl< char > &Str, std::size_t ToLen)
static bool isCommonPrefixWithoutSomeCharacters (std::size_t N, StringRef S1, StringRef S2)
static bool isCommonSuffixWithoutSomeCharacters (std::size_t N, StringRef S1, StringRef S2)

Function Documentation

◆ isCommonPrefixWithoutSomeCharacters()

bool clang::tidy::bugprone::filter::isCommonPrefixWithoutSomeCharacters ( std::size_t N,
StringRef S1,
StringRef S2 )
static

◆ isCommonSuffixWithoutSomeCharacters()

bool clang::tidy::bugprone::filter::isCommonSuffixWithoutSomeCharacters ( std::size_t N,
StringRef S1,
StringRef S2 )
static

◆ isIgnoredParameter()

bool clang::tidy::bugprone::filter::isIgnoredParameter ( const TheCheck & Check,
const ParmVarDecl * Node )
static

Returns whether the parameter's name or the parameter's type's name is configured by the user to be ignored from analysis and diagnostic.

Definition at line 1523 of file EasilySwappableParametersCheck.cpp.

References clang::tidy::bugprone::EasilySwappableParametersCheck::IgnoredParameterNames, and clang::tidy::bugprone::EasilySwappableParametersCheck::IgnoredParameterTypeSuffixes.

Referenced by clang::tidy::bugprone::model::modelMixingRange().

◆ isSimilarlyUsedParameter()

bool clang::tidy::bugprone::filter::isSimilarlyUsedParameter ( const SimilarlyUsedParameterPairSuppressor & Suppressor,
const ParmVarDecl * Param1,
const ParmVarDecl * Param2 )
inlinestatic

Definition at line 1833 of file EasilySwappableParametersCheck.cpp.

◆ padStringAtBegin()

void clang::tidy::bugprone::filter::padStringAtBegin ( SmallVectorImpl< char > & Str,
std::size_t ToLen )
static

◆ padStringAtEnd()

void clang::tidy::bugprone::filter::padStringAtEnd ( SmallVectorImpl< char > & Str,
std::size_t ToLen )
static

◆ prefixSuffixCoverUnderThreshold()

bool clang::tidy::bugprone::filter::prefixSuffixCoverUnderThreshold ( std::size_t Threshold,
StringRef Str1,
StringRef Str2 )
static

Returns whether the two strings are prefixes or suffixes of each other with at most Threshold characters differing on the non-common end.

Definition at line 1866 of file EasilySwappableParametersCheck.cpp.

References isCommonPrefixWithoutSomeCharacters(), isCommonSuffixWithoutSomeCharacters(), padStringAtBegin(), and padStringAtEnd().

Referenced by clang::tidy::bugprone::model::modelMixingRange().