clang-tools 22.0.0git
clang::tidy::bugprone::MisplacedOperatorInStrlenInAllocCheck Class Reference

Finds cases where 1 is added to the string in the argument to a function / in the strlen() family instead of the result and value is used as an argument to a memory allocation function. More...

#include <MisplacedOperatorInStrlenInAllocCheck.h>

Inheritance diagram for clang::tidy::bugprone::MisplacedOperatorInStrlenInAllocCheck:
[legend]

Public Member Functions

 MisplacedOperatorInStrlenInAllocCheck (StringRef Name, ClangTidyContext *Context)
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Finds cases where 1 is added to the string in the argument to a function / in the strlen() family instead of the result and value is used as an argument to a memory allocation function.

For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/misplaced-operator-in-strlen-in-alloc.html

Definition at line 22 of file MisplacedOperatorInStrlenInAllocCheck.h.

Constructor & Destructor Documentation

◆ MisplacedOperatorInStrlenInAllocCheck()

clang::tidy::bugprone::MisplacedOperatorInStrlenInAllocCheck::MisplacedOperatorInStrlenInAllocCheck ( StringRef Name,
ClangTidyContext * Context )
inline

Definition at line 24 of file MisplacedOperatorInStrlenInAllocCheck.h.

Member Function Documentation

◆ check()

void clang::tidy::bugprone::MisplacedOperatorInStrlenInAllocCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 71 of file MisplacedOperatorInStrlenInAllocCheck.cpp.

◆ registerMatchers()

void clang::tidy::bugprone::MisplacedOperatorInStrlenInAllocCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 18 of file MisplacedOperatorInStrlenInAllocCheck.cpp.


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