clang 24.0.0git
clang::PtrRefSafetyModel Class Referenceabstract

Models one WebKit pointer-safety policy: ref-counted (RefPtr), checked (CheckedPtr), or retainable (RetainPtr/OSPtr). More...

#include "/work/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/StaticAnalyzer/Checkers/WebKit/RawPtrRefSafetyModel.h"

Public Member Functions

virtual ~PtrRefSafetyModel ()=default
virtual std::optional< boolisUnsafeType (QualType QT) const =0
virtual std::optional< boolisUnsafePtr (QualType QT, bool IgnoreARC=false) const =0
virtual bool isSafePtr (const CXXRecordDecl *Record) const =0
virtual bool isSafePtrType (QualType T) const =0
virtual bool isPtrType (const std::string &Name) const =0
virtual bool isSafeExpr (const Expr *) const
virtual bool isSafeDecl (const Decl *, const SourceManager &) const
virtual const char * typeName () const =0
virtual RetainTypeCheckerretainTypeChecker () const

Detailed Description

Models one WebKit pointer-safety policy: ref-counted (RefPtr), checked (CheckedPtr), or retainable (RetainPtr/OSPtr).

It captures the family-specific "what is a safe/unsafe pointer" questions that are shared by the various RawPtrRef* checkers, independently of how each checker traverses the AST (call arguments, local variables, members, lambda captures, ...). This lets a single policy be defined once and reused across every traversal.

Definition at line 32 of file RawPtrRefSafetyModel.h.

Constructor & Destructor Documentation

◆ ~PtrRefSafetyModel()

virtual clang::PtrRefSafetyModel::~PtrRefSafetyModel ( )
virtualdefault

Member Function Documentation

◆ isPtrType()

virtual bool clang::PtrRefSafetyModel::isPtrType ( const std::string & Name) const
pure virtual
Returns
whether Name is the name of a safe smart pointer class for this policy.

◆ isSafeDecl()

virtual bool clang::PtrRefSafetyModel::isSafeDecl ( const Decl * ,
const SourceManager &  ) const
inlinevirtual
Returns
whether D refers to a declaration that is safe by construction for this policy (e.g. immortal system-header globals).

Definition at line 61 of file RawPtrRefSafetyModel.h.

◆ isSafeExpr()

virtual bool clang::PtrRefSafetyModel::isSafeExpr ( const Expr * ) const
inlinevirtual
Returns
whether E is known to produce a safe value for this policy.

Definition at line 57 of file RawPtrRefSafetyModel.h.

◆ isSafePtr()

virtual bool clang::PtrRefSafetyModel::isSafePtr ( const CXXRecordDecl * Record) const
pure virtual
Returns
whether Record is a safe smart pointer for this policy.

◆ isSafePtrType()

virtual bool clang::PtrRefSafetyModel::isSafePtrType ( QualType T) const
pure virtual
Returns
whether T is a safe smart pointer type for this policy.

References clang::T.

◆ isUnsafePtr()

virtual std::optional< bool > clang::PtrRefSafetyModel::isUnsafePtr ( QualType QT,
bool IgnoreARC = false ) const
pure virtual
Returns
whether QT is a raw pointer or reference to an unsafe type, false if not, std::nullopt if inconclusive. IgnoreARC requests that Objective-C ARC be ignored when deciding retainability.

◆ isUnsafeType()

virtual std::optional< bool > clang::PtrRefSafetyModel::isUnsafeType ( QualType QT) const
pure virtual
Returns
whether QT itself is an unsafe (smart-pointer-capable but not managed) type, false if not, std::nullopt if inconclusive.

◆ retainTypeChecker()

virtual RetainTypeChecker * clang::PtrRefSafetyModel::retainTypeChecker ( ) const
inlinevirtual
Returns
the RetainTypeChecker backing this policy, or nullptr if the policy does not track retain/OS types.

Definition at line 71 of file RawPtrRefSafetyModel.h.

◆ typeName()

virtual const char * clang::PtrRefSafetyModel::typeName ( ) const
pure virtual
Returns
a human readable name for the safe type category, used in diagnostics (e.g. "RefPtr-capable type").

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