|
clang 24.0.0git
|
Models one WebKit pointer-safety policy: ref-counted (RefPtr), checked (CheckedPtr), or retainable (RetainPtr/OSPtr). More...
Public Member Functions | |
| virtual | ~PtrRefSafetyModel ()=default |
| virtual std::optional< bool > | isUnsafeType (QualType QT) const =0 |
| virtual std::optional< bool > | isUnsafePtr (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 *, bool PtrIsLifetimeBoundToOrigin) const |
| virtual bool | checksForInteriorDestruction () const |
| virtual bool | recognizesIndirectStores () const |
| virtual bool | isSafeDecl (const Decl *, const SourceManager &) const |
| virtual const char * | typeName () const =0 |
| virtual void | describeHazard (llvm::raw_ostream &Os, const Expr *, QualType SinkType) const |
| Prints a phrase describing why the reported value is unsafe, completing a sentence of the form "Local variable 'x' is a ". | |
| virtual RetainTypeChecker * | retainTypeChecker () const |
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 35 of file RawPtrRefSafetyModel.h.
|
virtualdefault |
|
inlinevirtual |
Definition at line 69 of file RawPtrRefSafetyModel.h.
|
inlinevirtual |
Prints a phrase describing why the reported value is unsafe, completing a sentence of the form "Local variable 'x' is a ".
Origin is the expression the value was traced back to, or null when the trace found none. SinkType is the type of the reported location.
Definition at line 92 of file RawPtrRefSafetyModel.h.
References clang::QualType::getTypePtr(), clang::Type::getUnqualifiedDesugaredType(), clang::isa(), clang::printTypeName(), and typeName().
|
pure virtual |
Name is the name of a safe smart pointer class for this policy.
|
inlinevirtual |
D refers to a declaration that is safe by construction for this policy (e.g. immortal system-header globals). Definition at line 80 of file RawPtrRefSafetyModel.h.
|
inlinevirtual |
E is known to produce a safe value for this policy. PtrIsLifetimeBoundToOrigin is whether the traversal that reached E followed at least one [[clang::lifetimebound]] edge. Definition at line 62 of file RawPtrRefSafetyModel.h.
|
pure virtual |
Record is a safe smart pointer for this policy. T is a safe smart pointer type for this policy. References clang::T.
|
pure virtual |
QT is a pointer/reference/view to an analyzed type, false if not, std::nullopt if inconclusive. IgnoreARC requests that Objective-C ARC be ignored when deciding retainability.
|
pure virtual |
QT itself is an unsafe (smart-pointer-capable but not managed) type, false if not, std::nullopt if inconclusive.
|
inlinevirtual |
FIXME: Make this flag true in all analyses and then remove it.
Definition at line 76 of file RawPtrRefSafetyModel.h.
|
inlinevirtual |
Definition at line 104 of file RawPtrRefSafetyModel.h.
|
pure virtual |
Referenced by describeHazard().