clang 22.0.0git
|
#include "clang/AST/ExprCXX.h"
#include "clang/Basic/SourceManager.h"
#include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
#include "clang/StaticAnalyzer/Core/Checker.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/raw_ostream.h"
Go to the source code of this file.
Classes | |
class | FindStackRegionsSymbolVisitor |
A visitor made for use with a ScanReachableSymbols scanner, used for finding stack regions within an SVal that live on the current stack frame of the given checker context. More... |
Macros | |
#define | REGISTER_CHECKER(NAME) |
Functions | |
static void | EmitReturnedAsPartOfError (llvm::raw_ostream &OS, SVal ReturnedVal, const MemRegion *LeakedRegion) |
static SmallVector< const MemRegion * > | FilterReturnExpressionLeaks (const SmallVectorImpl< const MemRegion * > &MaybeEscaped, CheckerContext &C, const Expr *RetE, SVal &RetVal) |
Given some memory regions that are flagged by FindStackRegionsSymbolVisitor, this function filters out memory regions that are being returned that are likely not true leaks: | |
static SmallVector< const MemRegion * > | FindEscapingStackRegions (CheckerContext &C, const Expr *RetE, SVal RetVal) |
For use in finding regions that live on the checker context's current stack frame, deep in the SVal representing the return value. | |
static const MemSpaceRegion * | getStackOrGlobalSpaceRegion (ProgramStateRef State, const MemRegion *R) |
static const MemRegion * | getOriginBaseRegion (const MemRegion *Reg) |
static std::optional< std::string > | printReferrer (ProgramStateRef State, const MemRegion *Referrer) |
static bool | isInvalidatedSymbolRegion (const MemRegion *Region) |
Check whether Region refers to a freshly minted symbol after an opaque function call. |
#define REGISTER_CHECKER | ( | NAME | ) |
Definition at line 615 of file StackAddrEscapeChecker.cpp.
|
static |
Definition at line 153 of file StackAddrEscapeChecker.cpp.
References clang::ento::SVal::getAsRegion(), clang::isa(), and clang::ento::OS.
|
static |
Given some memory regions that are flagged by FindStackRegionsSymbolVisitor, this function filters out memory regions that are being returned that are likely not true leaks:
Definition at line 301 of file StackAddrEscapeChecker.cpp.
References clang::C, clang::ento::SVal::getAsRegion(), clang::Expr::getType(), clang::isa(), and clang::Type::isRecordType().
Referenced by FindEscapingStackRegions().
|
static |
For use in finding regions that live on the checker context's current stack frame, deep in the SVal representing the return value.
Definition at line 339 of file StackAddrEscapeChecker.cpp.
References clang::C, and FilterReturnExpressionLeaks().
Definition at line 384 of file StackAddrEscapeChecker.cpp.
References clang::ento::MemRegion::getBaseRegion().
|
static |
Definition at line 368 of file StackAddrEscapeChecker.cpp.
References clang::ento::MemRegion::getAs(), clang::ento::MemRegion::getBaseRegion(), clang::ento::MemRegion::getMemorySpace(), getStackOrGlobalSpaceRegion(), and clang::isa().
Referenced by getStackOrGlobalSpaceRegion(), and printReferrer().
Check whether Region
refers to a freshly minted symbol after an opaque function call.
Definition at line 438 of file StackAddrEscapeChecker.cpp.
References clang::ento::MemRegion::getAs().
|
static |
Definition at line 395 of file StackAddrEscapeChecker.cpp.
References clang::ento::MemRegion::canPrintPretty(), clang::ento::MemRegion::getBaseRegion(), getStackOrGlobalSpaceRegion(), clang::isa(), and clang::ento::MemRegion::printPretty().