clang-tools 22.0.0git
clang::tidy::performance::InefficientVectorOperationCheck Class Reference

Finds possible inefficient std::vector operations (e.g. More...

#include <InefficientVectorOperationCheck.h>

Inheritance diagram for clang::tidy::performance::InefficientVectorOperationCheck:
[legend]

Public Member Functions

 InefficientVectorOperationCheck (StringRef Name, ClangTidyContext *Context)
bool isLanguageVersionSupported (const LangOptions &LangOpts) const override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override
void storeOptions (ClangTidyOptions::OptionMap &Opts) override

Detailed Description

Finds possible inefficient std::vector operations (e.g.

push_back) in for loops that may cause unnecessary memory reallocations.

When EnableProto, also finds calls that add element to protobuf repeated field without calling Reserve() first.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-vector-operation.html

Definition at line 24 of file InefficientVectorOperationCheck.h.

Constructor & Destructor Documentation

◆ InefficientVectorOperationCheck()

clang::tidy::performance::InefficientVectorOperationCheck::InefficientVectorOperationCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 75 of file InefficientVectorOperationCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::performance::InefficientVectorOperationCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

◆ isLanguageVersionSupported()

bool clang::tidy::performance::InefficientVectorOperationCheck::isLanguageVersionSupported ( const LangOptions & LangOpts) const
inlineoverride

Definition at line 27 of file InefficientVectorOperationCheck.h.

◆ registerMatchers()

void clang::tidy::performance::InefficientVectorOperationCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 158 of file InefficientVectorOperationCheck.cpp.

◆ storeOptions()

void clang::tidy::performance::InefficientVectorOperationCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

The documentation for this class was generated from the following files: