clang-tools 20.0.0git
Namespaces | Functions
AvoidBindCheck.cpp File Reference
#include "AvoidBindCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/Regex.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstddef>
#include <string>

Go to the source code of this file.

Namespaces

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

Functions

static bool clang::tidy::modernize::tryCaptureAsLocalVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E)
 
static bool clang::tidy::modernize::tryCaptureAsMemberVariable (const MatchFinder::MatchResult &Result, BindArgument &B, const Expr *E)
 
static const Expr * clang::tidy::modernize::ignoreTemporariesAndPointers (const Expr *E)
 
static const Expr * clang::tidy::modernize::ignoreTemporariesAndConstructors (const Expr *E)
 
static StringRef clang::tidy::modernize::getSourceTextForExpr (const MatchFinder::MatchResult &Result, const Expr *E)
 
static bool clang::tidy::modernize::isCallExprNamed (const Expr *E, StringRef Name)
 
static void clang::tidy::modernize::initializeBindArgumentForCallExpr (const MatchFinder::MatchResult &Result, BindArgument &B, const CallExpr *CE, unsigned &CaptureIndex)
 
static bool clang::tidy::modernize::anyDescendantIsLocal (const Stmt *Statement)
 
static SmallVector< BindArgument, 4 > clang::tidy::modernize::buildBindArguments (const MatchFinder::MatchResult &Result, const CallableInfo &Callable)
 
static int clang::tidy::modernize::findPositionOfPlaceholderUse (ArrayRef< BindArgument > Args, size_t PlaceholderIndex)
 
static void clang::tidy::modernize::addPlaceholderArgs (const LambdaProperties &LP, llvm::raw_ostream &Stream, bool PermissiveParameterList)
 
static void clang::tidy::modernize::addFunctionCallArgs (ArrayRef< BindArgument > Args, llvm::raw_ostream &Stream)
 
static bool clang::tidy::modernize::isPlaceHolderIndexRepeated (const ArrayRef< BindArgument > Args)
 
static std::vector< const FunctionDecl * > clang::tidy::modernize::findCandidateCallOperators (const CXXRecordDecl *RecordDecl, size_t NumArgs)
 
static bool clang::tidy::modernize::isFixitSupported (const CallableInfo &Callee, ArrayRef< BindArgument > Args)
 
const FunctionDecl * clang::tidy::modernize::getCallOperator (const CXXRecordDecl *Callable, size_t NumArgs)
 
const FunctionDecl * clang::tidy::modernize::getCallMethodDecl (const MatchFinder::MatchResult &Result, CallableType Type, CallableMaterializationKind Materialization)
 
static CallableType clang::tidy::modernize::getCallableType (const MatchFinder::MatchResult &Result)
 
static CallableMaterializationKind clang::tidy::modernize::getCallableMaterialization (const MatchFinder::MatchResult &Result)
 
static LambdaProperties clang::tidy::modernize::getLambdaProperties (const MatchFinder::MatchResult &Result)
 
static bool clang::tidy::modernize::emitCapture (llvm::StringSet<> &CaptureSet, StringRef Delimiter, CaptureMode CM, CaptureExpr CE, StringRef Identifier, StringRef InitExpression, raw_ostream &Stream)
 
static void clang::tidy::modernize::emitCaptureList (const LambdaProperties &LP, const MatchFinder::MatchResult &Result, raw_ostream &Stream)
 
static ArrayRef< BindArgument > clang::tidy::modernize::getForwardedArgumentList (const LambdaProperties &P)
 

Variable Documentation

◆ BindArguments

SmallVector<BindArgument, 4> BindArguments

Definition at line 104 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::buildBindArguments().

◆ BindNamespace

StringRef BindNamespace

Definition at line 105 of file AvoidBindCheck.cpp.

◆ Callable

CallableInfo Callable

◆ CaptureIdentifier

std::string CaptureIdentifier

Definition at line 73 of file AvoidBindCheck.cpp.

◆ CaptureInitializer

StringRef CaptureInitializer

Definition at line 97 of file AvoidBindCheck.cpp.

◆ CE

CaptureExpr CE = CE_None

◆ CM

CaptureMode CM = CM_None

◆ Decl

const FunctionDecl* Decl = nullptr

Definition at line 98 of file AvoidBindCheck.cpp.

Referenced by clang::move::HelperDeclRefGraph::addEdge(), clang::move::ClangMoveTool::addRemovedDecl(), clang::tidy::RenamerClangTidyCheck::addUsage(), clang::tidy::utils::decl_ref_expr::allDeclRefExprs(), clang::clangd::allTargetDecls(), clang::tidy::modernize::anyDescendantIsLocal(), clang::clangd::categorize(), clang::tidy::bugprone::BoolPointerImplicitConversionCheck::check(), clang::tidy::bugprone::ForwardDeclarationNamespaceCheck::check(), clang::tidy::bugprone::InfiniteLoopCheck::check(), clang::tidy::bugprone::SuspiciousReallocUsageCheck::check(), clang::tidy::bugprone::SuspiciousStringCompareCheck::check(), clang::tidy::cert::DontModifyStdNamespaceCheck::check(), clang::tidy::google::readability::GlobalNamesInHeadersCheck::check(), clang::tidy::google::objc::GlobalVariableDeclarationCheck::check(), clang::tidy::google::runtime::OverloadedUnaryAndCheck::check(), clang::tidy::llvm_libc::ImplementationInNamespaceCheck::check(), clang::tidy::misc::IncludeCleanerCheck::check(), clang::tidy::modernize::MacroToEnumCheck::check(), clang::tidy::modernize::UseAutoCheck::check(), clang::tidy::modernize::UseUsingCheck::check(), clang::tidy::readability::RedundantSmartptrGetCheck::check(), clang::tidy::readability::SuspiciousCallArgumentCheck::check(), clang::tidy::readability::checkDef(), clang::tidy::readability::checkInitDeclUsageInElse(), clang::tidy::readability::declRanges(), clang::clangd::dumpAST(), clang::tidy::modernize::exprReferencesVariable(), clang::tidy::findDecl(), clang::clangd::findExplicitReferences(), clang::tidy::bugprone::findRVRefOverload(), clang::tidy::readability::IdentifierNamingCheck::findStyleKind(), clang::clangd::getAttributes(), clang::tidy::modernize::getCallableType(), clang::clangd::getDeclComment(), clang::clangd::SelectionTree::Node::getDeclContext(), clang::clangd::getHover(), clang::clangd::getIndexableLocalDecls(), clang::tidy::modernize::getLambdaProperties(), clang::tidy::bugprone::getNameAsString(), clang::tidy::bugprone::getNameOfNamespace(), clang::clangd::getNonLocalDeclRefs(), clang::tidy::llvm_libc::getOutermostNamespace(), clang::clangd::getSemanticHighlightings(), clang::clangd::getSemanticRanges(), clang::tidy::bugprone::getStrlenExpr(), clang::tidy::hasNoName(), clang::clangd::insertionPoint(), clang::tidy::utils::decl_ref_expr::isCopyAssignmentArgument(), clang::tidy::utils::decl_ref_expr::isCopyConstructorArgument(), isFallthroughSwitchBranch(), clang::tidy::modernize::isNamedType(), clang::tidy::utils::isPtrOrReferenceForVar(), clang::tidy::readability::IdentifierNamingCheck::matchesStyle(), clang::tidy::RenamerClangTidyCheck::onEndOfTranslationUnit(), clang::move::ClangMoveTool::onEndOfTranslationUnit(), clang::tidy::bugprone::ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit(), clang::tidy::bugprone::overlap(), clang::doc::serialize::parseBases(), clang::tidy::bugprone::populateCallees(), clang::clangd::preferredIncludeDirective(), clang::clangd::prepareCallHierarchy(), clang::move::HelperDeclRGBuilder::run(), and clang::clangd::typeForNode().

◆ DoesReturn

bool DoesReturn = false

Definition at line 99 of file AvoidBindCheck.cpp.

◆ E

const Expr* E = nullptr

Definition at line 86 of file AvoidBindCheck.cpp.

Referenced by EntityMap::add(), addModuleDescription(), clang::pp_trace::PPCallbacksTracker::appendArgument(), clang::clangd::ClangdServer::applyTweak(), clang::tidy::readability::areBinaryOperatorOperandsTypesEqualToOperatorResultType(), clang::tidy::readability::AST_MATCHER(), clang::clangd::RefSlab::Builder::build(), clang::clangd::ParsedAST::build(), clang::tidy::modernize::buildBindArguments(), clang::tidy::modernize::canBeModified(), clang::tidy::bugprone::ArgumentCommentCheck::check(), clang::tidy::bugprone::BoolPointerImplicitConversionCheck::check(), clang::tidy::bugprone::LambdaFunctionNameCheck::check(), clang::tidy::bugprone::SizeofExpressionCheck::check(), clang::tidy::bugprone::StringConstructorCheck::check(), clang::tidy::bugprone::SuspiciousStringCompareCheck::check(), clang::tidy::bugprone::SwappedArgumentsCheck::check(), clang::tidy::bugprone::UndelegatedConstructorCheck::check(), clang::tidy::bugprone::UnusedRaiiCheck::check(), clang::tidy::cert::CommandProcessorCheck::check(), clang::tidy::cert::SetLongJmpCheck::check(), clang::tidy::cert::ThrownExceptionTypeCheck::check(), clang::tidy::misc::ConfusableIdentifierCheck::check(), clang::tidy::misc::NonCopyableObjectsCheck::check(), clang::tidy::misc::UnusedParametersCheck::check(), clang::tidy::modernize::ReplaceAutoPtrCheck::check(), clang::tidy::modernize::UseUncaughtExceptionsCheck::check(), clang::tidy::readability::ContainerSizeEmptyCheck::check(), clang::tidy::readability::NamedParameterCheck::check(), clang::tidy::bugprone::checkOverrideByDerivedMethod(), clang::tidy::ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(), Modularize::CoverageChecker::collectFileSystemHeaders(), Modularize::CoverageChecker::collectModuleHeaders(), clang::replace::detail::collectReplacementsFromDirectory(), Modularize::CoverageChecker::collectUmbrellaHeaders(), Modularize::ModularizeUtilities::collectUmbrellaHeaders(), clang::tidy::readability::compareExpressionToConstant(), clang::tidy::readability::compareExpressionToNullPtr(), clang::tidy::readability::compareExpressionToZero(), clang::tidy::readability::containsBoolLiteral(), clang::tidy::modernize::containsExpr(), clang::doc::decodeRecord(), clang::tidy::modernize::digThroughConstructorsConversions(), clang::tidy::bugprone::exprLocEnd(), clang::tidy::modernize::exprReferencesVariable(), clang::tidy::bugprone::exprToStr(), findInputFile(), Modularize::CoverageChecker::findUnaccountedForHeaders(), clang::tidy::readability::flipDemorganSide(), clang::clangd::fromJSON(), clang::doc::genEnumsBlock(), clang::doc::genMarkdown(), clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::getAsBoolLiteral(), clang::tidy::cppcoreguidelines::getBuiltinType(), clang::tidy::cppcoreguidelines::getConstantExprValue(), clang::tidy::readability::getConstructExprArgRange(), clang::tidy::modernize::getDeclRef(), clang::tidy::modernize::getDereferenceOperand(), llvm::DenseMapInfo< clang::clangd::RefSlab::Builder::Entry >::getEmptyKey(), clang::tidy::bugprone::getExprAsString(), clang::tidy::cppcoreguidelines::getFloatingConstantExprValue(), clang::clangd::getHover(), clang::doc::serialize::getInfoRelativePath(), clang::tidy::modernize::getInitializer(), clang::tidy::cppcoreguidelines::getIntegerConstantExprValue(), clang::tidy::bugprone::getLength(), clang::tidy::bugprone::getLHSOfMulBinOp(), clang::tidy::bugprone::getMaxCalculationWidth(), clang::tidy::readability::FindUsageOfThis::getParent(), clang::tidy::readability::FindUsageOfThis::getParentExprIgnoreParens(), clang::tidy::modernize::getReferencedVariable(), clang::tidy::readability::getSourceExprDecl(), clang::pp_trace::PPCallbacksTracker::getSourceString(), clang::tidy::modernize::getSourceTextForExpr(), llvm::DenseMapInfo< clang::clangd::RefSlab::Builder::Entry >::getTombstoneKey(), clang::tidy::cppcoreguidelines::getUnqualifiedType(), clang::tidy::modernize::hasRValueOverload(), clang::tidy::bugprone::hasSameParameterTypes(), clang::tidy::bugprone::ignoreNoOpCasts(), clang::tidy::modernize::ignoreTemporariesAndConstructors(), clang::tidy::modernize::ignoreTemporariesAndPointers(), clang::tidy::modernize::ignoreUnaryPlus(), clang::clangd::increment(), clang::clangd::RefSlab::Builder::insert(), clang::tidy::modernize::isAliasDecl(), clang::tidy::utils::isBinaryOrTernary(), clang::tidy::modernize::isCallExprNamed(), clang::tidy::modernize::isDirectMemberExpr(), clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::isExpectedBinaryOp(), clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::isExpectedUnaryLNot(), clang::tidy::bugprone::isExprAComparisonOperator(), clang::tidy::bugprone::filter::isIgnoredParameter(), clang::tidy::abseil::isInMacro(), clang::tidy::bugprone::CharExpressionDetector::isLikelyCharExpression(), clang::tidy::bugprone::isLikelyTypo(), clang::clangd::isRegisteredTidyCheck(), clang::tidy::modernize::isZero(), Modularize::ModularizeUtilities::loadAllHeaderListsAndDependencies(), loadModuleDescriptions(), Modularize::ModularizeUtilities::loadProblemHeaderList(), Modularize::ModularizeUtilities::loadSingleHeaderListsAndDependencies(), main(), clang::clangd::Tweak::Effect::mainFileEdit(), clang::tidy::readability::needsNullPtrComparison(), clang::tidy::readability::needsParensAfterUnaryNegation(), clang::tidy::readability::needsStaticCast(), clang::tidy::readability::needsZeroComparison(), clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::nestedDemorgan(), clang::doc::serialize::parseEnumerators(), clang::clangd::reformatEdit(), clang::tidy::utils::UseRangesCheck::registerMatchers(), clang::clangd::ClangdServer::rename(), replaceDotDot(), clang::tidy::readability::replacementExpression(), clang::clangd::Tweak::Effect::showMessage(), clang::clangd::TEST(), clang::clangd::SpelledWord::touching(), clang::tidy::bugprone::filter::relatedness_heuristic::AppearsInSameExpr::TraverseStmt(), clang::tidy::readability::SimplifyBooleanExprCheck::Visitor::TraverseUnaryOperator(), clang::tidy::modernize::tryCaptureAsLocalVariable(), clang::tidy::modernize::tryCaptureAsMemberVariable(), clang::doc::serialize::ClangDocCommentVisitor::visitBlockCommandComment(), clang::tidy::readability::FindUsageOfThis::VisitCXXThisExpr(), clang::doc::serialize::ClangDocCommentVisitor::visitHTMLStartTagComment(), and clang::doc::serialize::ClangDocCommentVisitor::visitInlineCommandComment().

◆ IsFixitSupported

bool IsFixitSupported = false

Definition at line 106 of file AvoidBindCheck.cpp.

◆ IsUsed

bool IsUsed = false

Definition at line 83 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::addPlaceholderArgs().

◆ Kind

BindArgumentKind Kind = BK_Other

◆ Materialization

CallableMaterializationKind Materialization = CMK_Other

Definition at line 91 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::getCallMethodDecl().

◆ PlaceHolderIndex

size_t PlaceHolderIndex = 0

◆ SourceTokens

StringRef SourceTokens

Definition at line 68 of file AvoidBindCheck.cpp.

Referenced by clang::tidy::modernize::AvoidBindCheck::check().

◆ Type

CallableType Type = CT_Other

Definition at line 90 of file AvoidBindCheck.cpp.

◆ UsageIdentifier

std::string UsageIdentifier

Definition at line 77 of file AvoidBindCheck.cpp.