clang-tools 22.0.0git
NotNullTerminatedResultCheck.cpp File Reference
#include "NotNullTerminatedResultCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/PPCallbacks.h"
#include "clang/Lex/Preprocessor.h"
#include <optional>

Go to the source code of this file.

Namespaces

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

Enumerations

enum class  clang::tidy::bugprone::LengthHandleKind { clang::tidy::bugprone::Increase , clang::tidy::bugprone::Decrease }

Functions

static const Expr * clang::tidy::bugprone::getDestCapacityExpr (const MatchFinder::MatchResult &Result)
static unsigned clang::tidy::bugprone::getLength (const Expr *E, const MatchFinder::MatchResult &Result)
static int clang::tidy::bugprone::getDestCapacity (const MatchFinder::MatchResult &Result)
static const CallExpr * clang::tidy::bugprone::getStrlenExpr (const MatchFinder::MatchResult &Result)
static int clang::tidy::bugprone::getGivenLength (const MatchFinder::MatchResult &Result)
static StringRef clang::tidy::bugprone::exprToStr (const Expr *E, const MatchFinder::MatchResult &Result)
static SourceLocation clang::tidy::bugprone::exprLocEnd (const Expr *E, const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isInjectUL (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isKnownDest (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isDestBasedOnGivenLength (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isDestAndSrcEquals (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isStringDataAndLength (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isGivenLengthEqualToSrcLength (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isCorrectGivenLength (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isDestCapacityOverflows (const MatchFinder::MatchResult &Result)
static bool clang::tidy::bugprone::isFixedGivenLengthAndUnknownSrc (const MatchFinder::MatchResult &Result)
static void clang::tidy::bugprone::lengthExprHandle (const Expr *LengthExpr, LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::lengthArgHandle (LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::lengthArgPosHandle (unsigned ArgPos, LengthHandleKind LengthHandle, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static bool clang::tidy::bugprone::isDestExprFix (const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static bool clang::tidy::bugprone::isDestCapacityFix (const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::removeArg (int ArgPos, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::renameFunc (StringRef NewFuncName, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::renameMemcpy (StringRef Name, bool IsCopy, bool IsSafe, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::insertDestCapacityArg (bool IsOverflows, StringRef Name, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)
static void clang::tidy::bugprone::insertNullTerminatorExpr (StringRef Name, const MatchFinder::MatchResult &Result, DiagnosticBuilder &Diag)

Variables

constexpr llvm::StringLiteral clang::tidy::bugprone::FunctionExprName = "FunctionExpr"
constexpr llvm::StringLiteral clang::tidy::bugprone::CastExprName = "CastExpr"
constexpr llvm::StringLiteral clang::tidy::bugprone::UnknownDestName = "UnknownDest"
constexpr llvm::StringLiteral clang::tidy::bugprone::DestArrayTyName = "DestArrayTy"
constexpr llvm::StringLiteral clang::tidy::bugprone::DestVarDeclName = "DestVarDecl"
constexpr llvm::StringLiteral clang::tidy::bugprone::DestMallocExprName = "DestMalloc"
constexpr llvm::StringLiteral clang::tidy::bugprone::DestExprName = "DestExpr"
constexpr llvm::StringLiteral clang::tidy::bugprone::SrcVarDeclName = "SrcVarDecl"
constexpr llvm::StringLiteral clang::tidy::bugprone::SrcExprName = "SrcExpr"
constexpr llvm::StringLiteral clang::tidy::bugprone::LengthExprName = "LengthExpr"
constexpr llvm::StringLiteral clang::tidy::bugprone::WrongLengthExprName = "WrongLength"
constexpr llvm::StringLiteral clang::tidy::bugprone::UnknownLengthName = "UnknownLength"