clang 22.0.0git
SmartPtrModeling.cpp File Reference

Go to the source code of this file.

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::ento
namespace  clang::ento::smartptr

Functions

static bool hasStdClassWithName (const CXXRecordDecl *RD, ArrayRef< llvm::StringLiteral > Names)
static bool isStdSmartPtr (const CXXRecordDecl *RD)
static bool isStdSmartPtr (const Expr *E)
bool clang::ento::smartptr::isStdSmartPtrCall (const CallEvent &Call)
 Returns true if the event call is on smart pointer.
bool clang::ento::smartptr::isStdSmartPtr (const CXXRecordDecl *RD)
bool clang::ento::smartptr::isStdSmartPtr (const Expr *E)
bool clang::ento::smartptr::isNullSmartPtr (const ProgramStateRef State, const MemRegion *ThisRegion)
 Returns whether the smart pointer is null or not.
static TrackedRegionMapTy removeTrackedSubregions (TrackedRegionMapTy RegionMap, TrackedRegionMapTy::Factory &RegionMapFactory, const MemRegion *Region)
static ProgramStateRef updateSwappedRegion (ProgramStateRef State, const MemRegion *Region, const SVal *RegionInnerPointerVal)
static QualType getInnerPointerType (CheckerContext C, const CXXRecordDecl *RD)
static QualType getPointerTypeFromTemplateArg (const CallEvent &Call, CheckerContext &C)
static QualType getInnerPointerType (const CallEvent &Call, CheckerContext &C)
static void checkAndPrettyPrintRegion (llvm::raw_ostream &OS, const MemRegion *Region)
static bool isStdBasicOstream (const Expr *E)
static bool isStdFunctionCall (const CallEvent &Call)
static bool isStdOstreamOperatorCall (const CallEvent &Call)
static bool isPotentiallyComparisionOpCall (const CallEvent &Call)

Variables

constexpr llvm::StringLiteral STD_PTR_NAMES []
constexpr llvm::StringLiteral BASIC_OSTREAM_NAMES [] = {"basic_ostream"}

Function Documentation

◆ checkAndPrettyPrintRegion()

void checkAndPrettyPrintRegion ( llvm::raw_ostream & OS,
const MemRegion * Region )
static

◆ getInnerPointerType() [1/2]

QualType getInnerPointerType ( CheckerContext C,
const CXXRecordDecl * RD )
static

Definition at line 180 of file SmartPtrModeling.cpp.

References clang::C, and clang::Decl::isInStdNamespace().

Referenced by getInnerPointerType().

◆ getInnerPointerType() [2/2]

QualType getInnerPointerType ( const CallEvent & Call,
CheckerContext & C )
static

◆ getPointerTypeFromTemplateArg()

QualType getPointerTypeFromTemplateArg ( const CallEvent & Call,
CheckerContext & C )
static

Definition at line 198 of file SmartPtrModeling.cpp.

References clang::C, and clang::Call.

◆ hasStdClassWithName()

bool hasStdClassWithName ( const CXXRecordDecl * RD,
ArrayRef< llvm::StringLiteral > Names )
static

Definition at line 100 of file SmartPtrModeling.cpp.

References hasStdClassWithName(), and clang::if().

Referenced by hasStdClassWithName(), isStdBasicOstream(), and isStdSmartPtr().

◆ isPotentiallyComparisionOpCall()

bool isPotentiallyComparisionOpCall ( const CallEvent & Call)
static

◆ isStdBasicOstream()

bool isStdBasicOstream ( const Expr * E)
static

◆ isStdFunctionCall()

bool isStdFunctionCall ( const CallEvent & Call)
static

Definition at line 246 of file SmartPtrModeling.cpp.

References clang::Call.

Referenced by isPotentiallyComparisionOpCall(), and isStdOstreamOperatorCall().

◆ isStdOstreamOperatorCall()

◆ isStdSmartPtr() [1/2]

bool isStdSmartPtr ( const CXXRecordDecl * RD)
static

Definition at line 112 of file SmartPtrModeling.cpp.

References hasStdClassWithName(), and STD_PTR_NAMES.

Referenced by isStdOstreamOperatorCall(), and isStdSmartPtr().

◆ isStdSmartPtr() [2/2]

bool isStdSmartPtr ( const Expr * E)
static

◆ removeTrackedSubregions()

TrackedRegionMapTy removeTrackedSubregions ( TrackedRegionMapTy RegionMap,
TrackedRegionMapTy::Factory & RegionMapFactory,
const MemRegion * Region )
static

Definition at line 157 of file SmartPtrModeling.cpp.

◆ updateSwappedRegion()

ProgramStateRef updateSwappedRegion ( ProgramStateRef State,
const MemRegion * Region,
const SVal * RegionInnerPointerVal )
static

Definition at line 169 of file SmartPtrModeling.cpp.

Variable Documentation

◆ BASIC_OSTREAM_NAMES

llvm::StringLiteral BASIC_OSTREAM_NAMES[] = {"basic_ostream"}
constexpr

Definition at line 239 of file SmartPtrModeling.cpp.

Referenced by isStdBasicOstream().

◆ STD_PTR_NAMES

llvm::StringLiteral STD_PTR_NAMES[]
constexpr
Initial value:
= {"shared_ptr", "unique_ptr",
"weak_ptr"}

Definition at line 109 of file SmartPtrModeling.cpp.

Referenced by isStdSmartPtr().