|
clang-tools 22.0.0git
|
Finds function calls where it is possible to cause a not null-terminated result. More...
#include <NotNullTerminatedResultCheck.h>
Public Member Functions | |
| NotNullTerminatedResultCheck (StringRef Name, ClangTidyContext *Context) | |
| void | storeOptions (ClangTidyOptions::OptionMap &Opts) override |
| void | registerMatchers (ast_matchers::MatchFinder *Finder) override |
| void | check (const ast_matchers::MatchFinder::MatchResult &Result) override |
| void | registerPPCallbacks (const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override |
Finds function calls where it is possible to cause a not null-terminated result.
Usually the proper length of a string is 'strlen(src) + 1' or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read.
For the user-facing documentation see: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/not-null-terminated-result.html
Definition at line 24 of file NotNullTerminatedResultCheck.h.
| clang::tidy::bugprone::NotNullTerminatedResultCheck::NotNullTerminatedResultCheck | ( | StringRef | Name, |
| ClangTidyContext * | Context ) |
Definition at line 501 of file NotNullTerminatedResultCheck.cpp.
|
override |
Definition at line 791 of file NotNullTerminatedResultCheck.cpp.
References clang::tidy::bugprone::FunctionExprName, and clang::tidy::bugprone::PP.
|
override |
Definition at line 545 of file NotNullTerminatedResultCheck.cpp.
References clang::tidy::bugprone::CastExprName, clang::tidy::bugprone::DestArrayTyName, clang::tidy::bugprone::DestExprName, clang::tidy::bugprone::DestMallocExprName, clang::tidy::bugprone::DestVarDeclName, clang::tidy::bugprone::FunctionExprName, clang::tidy::bugprone::LengthExprName, clang::tidy::bugprone::SrcExprName, clang::tidy::bugprone::SrcVarDeclName, clang::tidy::bugprone::UnknownDestName, clang::tidy::bugprone::UnknownLengthName, and clang::tidy::bugprone::WrongLengthExprName.
|
override |
Definition at line 511 of file NotNullTerminatedResultCheck.cpp.
References clang::tidy::bugprone::PP.
|
override |
Definition at line 506 of file NotNullTerminatedResultCheck.cpp.