clang 20.0.0git
Public Member Functions | Protected Attributes | List of all members
clang::ento::retaincountchecker::RefCountReport Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h"

Inheritance diagram for clang::ento::retaincountchecker::RefCountReport:
Inheritance graph
[legend]

Public Member Functions

 RefCountReport (const RefCountBug &D, const LangOptions &LOpts, ExplodedNode *n, SymbolRef sym, bool isLeak=false)
 
 RefCountReport (const RefCountBug &D, const LangOptions &LOpts, ExplodedNode *n, SymbolRef sym, StringRef endText)
 
ArrayRef< SourceRangegetRanges () const override
 Get the SourceRanges associated with the report.
 
- Public Member Functions inherited from clang::ento::PathSensitiveBugReport
 PathSensitiveBugReport (const BugType &bt, StringRef desc, const ExplodedNode *errorNode)
 
 PathSensitiveBugReport (const BugType &bt, StringRef shortDesc, StringRef desc, const ExplodedNode *errorNode)
 
 PathSensitiveBugReport (const BugType &bt, StringRef desc, const ExplodedNode *errorNode, PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique)
 Create a PathSensitiveBugReport with a custom uniqueing location.
 
 PathSensitiveBugReport (const BugType &bt, StringRef shortDesc, StringRef desc, const ExplodedNode *errorNode, PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique)
 
const ExplodedNodegetErrorNode () const
 
bool shouldPrunePath () const
 Indicates whether or not any path pruning should take place when generating a PathDiagnostic from this BugReport.
 
void disablePathPruning ()
 Disable all path pruning when generating a PathDiagnostic.
 
PathDiagnosticLocation getUniqueingLocation () const override
 Get the location on which the report should be uniqued.
 
const DeclgetUniqueingDecl () const override
 Get the declaration containing the uniqueing location.
 
const DeclgetDeclWithIssue () const override
 The smallest declaration that contains the bug location.
 
ArrayRef< SourceRangegetRanges () const override
 Get the SourceRanges associated with the report.
 
PathDiagnosticLocation getLocation () const override
 The primary location of the bug report that points at the undesirable behavior in the code.
 
void markInteresting (SymbolRef sym, bugreporter::TrackingKind TKind=bugreporter::TrackingKind::Thorough)
 Marks a symbol as interesting.
 
void markNotInteresting (SymbolRef sym)
 
void markInteresting (const MemRegion *R, bugreporter::TrackingKind TKind=bugreporter::TrackingKind::Thorough)
 Marks a region as interesting.
 
void markNotInteresting (const MemRegion *R)
 
void markInteresting (SVal V, bugreporter::TrackingKind TKind=bugreporter::TrackingKind::Thorough)
 Marks a symbolic value as interesting.
 
void markInteresting (const LocationContext *LC)
 
bool isInteresting (SymbolRef sym) const
 
bool isInteresting (const MemRegion *R) const
 
bool isInteresting (SVal V) const
 
bool isInteresting (const LocationContext *LC) const
 
std::optional< bugreporter::TrackingKindgetInterestingnessKind (SymbolRef sym) const
 
std::optional< bugreporter::TrackingKindgetInterestingnessKind (const MemRegion *R) const
 
std::optional< bugreporter::TrackingKindgetInterestingnessKind (SVal V) const
 
bool isValid () const
 Returns whether or not this report should be considered valid.
 
void markInvalid (const void *Tag, const void *Data)
 Marks the current report as invalid, meaning that it is probably a false positive and should not be reported to the user.
 
void Profile (llvm::FoldingSetNodeID &hash) const override
 Profile to identify equivalent bug reports for error report coalescing.
 
void clearVisitors ()
 Remove all visitors attached to this bug report.
 
visitor_iterator visitor_begin ()
 Iterators through the custom diagnostic visitors.
 
visitor_iterator visitor_end ()
 
visitor_range visitors ()
 
bool addTrackedCondition (const ExplodedNode *Cond)
 Notes that the condition of the CFGBlock associated with Cond is being tracked.
 
void addCallStackHint (PathDiagnosticPieceRef Piece, std::unique_ptr< StackHintGenerator > StackHint)
 
bool hasCallStackHint (PathDiagnosticPieceRef Piece) const
 
std::string getCallStackMessage (PathDiagnosticPieceRef Piece, const ExplodedNode *N) const
 Produce the hint for the given node.
 
void addVisitor (std::unique_ptr< BugReporterVisitor > visitor)
 Add custom or predefined bug report visitors to this report.
 
template<class VisitorType , class... Args>
void addVisitor (Args &&... ConstructorArgs)
 
- Public Member Functions inherited from clang::ento::BugReport
virtual ~BugReport ()=default
 
Kind getKind () const
 
const BugTypegetBugType () const
 
StringRef getDescription () const
 A verbose warning message that is appropriate for displaying next to the source code that introduces the problem.
 
StringRef getShortDescription (bool UseFallback=true) const
 A short general warning message that is appropriate for displaying in the list of all reported bugs.
 
virtual PathDiagnosticLocation getLocation () const =0
 The primary location of the bug report that points at the undesirable behavior in the code.
 
virtual const DeclgetDeclWithIssue () const =0
 The smallest declaration that contains the bug location.
 
virtual PathDiagnosticLocation getUniqueingLocation () const =0
 Get the location on which the report should be uniqued.
 
virtual const DeclgetUniqueingDecl () const =0
 Get the declaration that corresponds to (usually contains) the uniqueing location.
 
void addNote (StringRef Msg, const PathDiagnosticLocation &Pos, ArrayRef< SourceRange > Ranges={})
 Add new item to the list of additional notes that need to be attached to this report.
 
ArrayRef< std::shared_ptr< PathDiagnosticNotePiece > > getNotes ()
 
void addRange (SourceRange R)
 Add a range to a bug report.
 
virtual ArrayRef< SourceRangegetRanges () const
 Get the SourceRanges associated with the report.
 
void addFixItHint (const FixItHint &F)
 Add a fix-it hint to the bug report.
 
llvm::ArrayRef< FixItHintgetFixits () const
 
virtual void Profile (llvm::FoldingSetNodeID &hash) const =0
 Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug.
 

Protected Attributes

SymbolRef Sym
 
bool isLeak = false
 
- Protected Attributes inherited from clang::ento::PathSensitiveBugReport
const ExplodedNodeErrorNode = nullptr
 The ExplodedGraph node against which the report was thrown.
 
const SourceRange ErrorNodeRange
 The range that corresponds to ErrorNode's program point.
 
llvm::DenseMap< SymbolRef, bugreporter::TrackingKindInterestingSymbols
 Profile to identify equivalent bug reports for error report coalescing.
 
llvm::DenseMap< const MemRegion *, bugreporter::TrackingKindInterestingRegions
 A (stack of) set of regions that are registered with this report as being "interesting", and thus used to help decide which diagnostics to include when constructing the final path diagnostic.
 
llvm::SmallSet< const LocationContext *, 2 > InterestingLocationContexts
 A set of location contexts that correspoind to call sites which should be considered "interesting".
 
VisitorList Callbacks
 A set of custom visitors which generate "event" diagnostics at interesting points in the path.
 
llvm::FoldingSet< BugReporterVisitorCallbacksSet
 Used for ensuring the visitors are only added once.
 
bool DoNotPrunePath = false
 When set, this flag disables all callstack pruning from a diagnostic path.
 
llvm::SmallSet< InvalidationRecord, 4 > Invalidations
 If non-empty, this bug report is likely a false positive and should not be shown to the user.
 
llvm::SmallSet< const ExplodedNode *, 4 > TrackedConditions
 Conditions we're already tracking.
 
PathDiagnosticLocation UniqueingLocation
 Reports with different uniqueing locations are considered to be different for the purposes of deduplication.
 
const DeclUniqueingDecl
 
std::map< PathDiagnosticPieceRef, std::unique_ptr< StackHintGenerator > > StackHints
 If an event occurs in a different frame than the final diagnostic, supply a message that will be used to construct an extra hint on the returns from all the calls on the stack from this event to the final diagnostic.
 
- Protected Attributes inherited from clang::ento::BugReport
Kind K
 
const BugTypeBT
 
std::string ShortDescription
 
std::string Description
 
SmallVector< SourceRange, 4 > Ranges
 
SmallVector< std::shared_ptr< PathDiagnosticNotePiece >, 4 > Notes
 
SmallVector< FixItHint, 4 > Fixits
 

Additional Inherited Members

- Public Types inherited from clang::ento::PathSensitiveBugReport
using VisitorList = SmallVector< std::unique_ptr< BugReporterVisitor >, 8 >
 
using visitor_iterator = VisitorList::iterator
 
using visitor_range = llvm::iterator_range< visitor_iterator >
 
- Public Types inherited from clang::ento::BugReport
enum class  Kind { Basic , PathSensitive }
 
- Static Public Member Functions inherited from clang::ento::PathSensitiveBugReport
static bool classof (const BugReport *R)
 
- Protected Types inherited from clang::ento::PathSensitiveBugReport
using InvalidationRecord = std::pair< const void *, const void * >
 Used to track unique reasons why a bug report might be invalid.
 
- Protected Member Functions inherited from clang::ento::PathSensitiveBugReport
const StmtgetStmt () const
 
- Protected Member Functions inherited from clang::ento::BugReport
 BugReport (Kind kind, const BugType &bt, StringRef desc)
 
 BugReport (Kind K, const BugType &BT, StringRef ShortDescription, StringRef Description)
 

Detailed Description

Definition at line 49 of file RetainCountDiagnostics.h.

Constructor & Destructor Documentation

◆ RefCountReport() [1/2]

RefCountReport::RefCountReport ( const RefCountBug D,
const LangOptions LOpts,
ExplodedNode n,
SymbolRef  sym,
bool  isLeak = false 
)

Definition at line 837 of file RetainCountDiagnostics.cpp.

References isLeak.

◆ RefCountReport() [2/2]

RefCountReport::RefCountReport ( const RefCountBug D,
const LangOptions LOpts,
ExplodedNode n,
SymbolRef  sym,
StringRef  endText 
)

Definition at line 845 of file RetainCountDiagnostics.cpp.

Member Function Documentation

◆ getRanges()

ArrayRef< SourceRange > clang::ento::retaincountchecker::RefCountReport::getRanges ( ) const
inlineoverridevirtual

Get the SourceRanges associated with the report.

Reimplemented from clang::ento::PathSensitiveBugReport.

Definition at line 63 of file RetainCountDiagnostics.h.

References clang::ento::PathSensitiveBugReport::getRanges(), and isLeak.

Member Data Documentation

◆ isLeak

bool clang::ento::retaincountchecker::RefCountReport::isLeak = false
protected

Definition at line 52 of file RetainCountDiagnostics.h.

Referenced by getRanges(), and RefCountReport().

◆ Sym

SymbolRef clang::ento::retaincountchecker::RefCountReport::Sym
protected

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