class PathSensitiveBugReport
Declaration
class PathSensitiveBugReport : public BugReport { /* full declaration omitted */ };
Description
This class provides an interface through which checkers can create individual bug reports.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:289
Inherits from: BugReport
Member Variables
- protected const clang::ento::ExplodedNode* ErrorNode = nullptr
- The ExplodedGraph node against which the report was thrown. It corresponds to the end of the execution path that demonstrates the bug.
- protected const clang::SourceRange ErrorNodeRange
- The range that corresponds to ErrorNode's program point. It is usually highlighted in the report.
- protected llvm::DenseMap<SymbolRef, bugreporter::TrackingKind> InterestingSymbols
- A (stack of) a set of symbols 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. The stack is largely used by BugReporter when generating PathDiagnostics for multiple PathDiagnosticConsumers.
- protected llvm::DenseMap<const MemRegion*, bugreporter::TrackingKind> InterestingRegions
- 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. The stack is largely used by BugReporter when generating PathDiagnostics for multiple PathDiagnosticConsumers.
- protected llvm::SmallSet<const LocationContext*, 2> InterestingLocationContexts
- A set of location contexts that correspoind to call sites which should be considered "interesting".
- protected clang::ento::PathSensitiveBugReport::VisitorList Callbacks
- A set of custom visitors which generate "event" diagnostics at interesting points in the path.
- protected llvm::FoldingSet<BugReporterVisitor> CallbacksSet
- Used for ensuring the visitors are only added once.
- protected bool DoNotPrunePath = false
- When set, this flag disables all callstack pruning from a diagnostic path. This is useful for some reports that want maximum fidelty when reporting an issue.
- protected llvm::SmallSet<InvalidationRecord, 4> Invalidations
- protected llvm::SmallSet<const ExplodedNode*, 4> TrackedConditions
- Conditions we're already tracking.
- protected clang::ento::PathDiagnosticLocation UniqueingLocation
- Reports with different uniqueing locations are considered to be different for the purposes of deduplication.
- protected const clang::Decl* UniqueingDecl
- protected 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.
Inherited from BugReport:
- protected K
- protected BT
- protected ShortDescription
- protected Description
- protected Ranges
- protected Notes
- protected Fixits
Method Overview
- public PathSensitiveBugReport(const clang::ento::BugType & bt, llvm::StringRef desc, const clang::ento::ExplodedNode * errorNode)
- public PathSensitiveBugReport(const clang::ento::BugType & bt, llvm::StringRef shortDesc, llvm::StringRef desc, const clang::ento::ExplodedNode * errorNode)
- public PathSensitiveBugReport(const clang::ento::BugType & bt, llvm::StringRef desc, const clang::ento::ExplodedNode * errorNode, clang::ento::PathDiagnosticLocation LocationToUnique, const clang::Decl * DeclToUnique)
- public PathSensitiveBugReport(const clang::ento::BugType & bt, llvm::StringRef shortDesc, llvm::StringRef desc, const clang::ento::ExplodedNode * errorNode, clang::ento::PathDiagnosticLocation LocationToUnique, const clang::Decl * DeclToUnique)
- public void Profile(llvm::FoldingSetNodeID & hash) const
- public void addCallStackHint(clang::ento::PathDiagnosticPieceRef Piece, std::unique_ptr<StackHintGenerator> StackHint)
- public bool addTrackedCondition(const clang::ento::ExplodedNode * Cond)
- public template <class VisitorType, class... Args>void addVisitor(Args &&... ConstructorArgs)
- public void addVisitor(std::unique_ptr<BugReporterVisitor> visitor)
- public static bool classof(const clang::ento::BugReport * R)
- public void clearVisitors()
- public void disablePathPruning()
- public std::string getCallStackMessage(clang::ento::PathDiagnosticPieceRef Piece, const clang::ento::ExplodedNode * N) const
- public const clang::Decl * getDeclWithIssue() const
- public const clang::ento::ExplodedNode * getErrorNode() const
- public Optional<bugreporter::TrackingKind> getInterestingnessKind(clang::ento::SVal V) const
- public Optional<bugreporter::TrackingKind> getInterestingnessKind(const clang::ento::MemRegion * R) const
- public Optional<bugreporter::TrackingKind> getInterestingnessKind(clang::ento::SymbolRef sym) const
- public clang::ento::PathDiagnosticLocation getLocation() const
- public ArrayRef<clang::SourceRange> getRanges() const
- protected const clang::Stmt * getStmt() const
- public const clang::Decl * getUniqueingDecl() const
- public clang::ento::PathDiagnosticLocation getUniqueingLocation() const
- public bool hasCallStackHint(clang::ento::PathDiagnosticPieceRef Piece) const
- public bool isInteresting(clang::ento::SVal V) const
- public bool isInteresting(clang::ento::SymbolRef sym) const
- public bool isInteresting(const clang::LocationContext * LC) const
- public bool isInteresting(const clang::ento::MemRegion * R) const
- public bool isValid() const
- public void markInteresting(const clang::LocationContext * LC)
- public void markInteresting(clang::ento::SVal V, bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough)
- public void markInteresting(const clang::ento::MemRegion * R, bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough)
- public void markInteresting(clang::ento::SymbolRef sym, bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough)
- public void markInvalid(const void * Tag, const void * Data)
- public void markNotInteresting(const clang::ento::MemRegion * R)
- public void markNotInteresting(clang::ento::SymbolRef sym)
- public bool shouldPrunePath() const
- public clang::ento::PathSensitiveBugReport::visitor_iterator visitor_begin()
- public clang::ento::PathSensitiveBugReport::visitor_iterator visitor_end()
- public clang::ento::PathSensitiveBugReport::visitor_range visitors()
Inherited from BugReport:
- public Profile
- public addFixItHint
- public addNote
- public addRange
- public getBugType
- public getDeclWithIssue
- public getDescription
- public getFixits
- public getKind
- public getLocation
- public getNotes
- public getRanges
- public getShortDescription
- public getUniqueingDecl
- public getUniqueingLocation
Methods
¶PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode)
PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:369
Parameters
- const clang::ento::BugType& bt
- llvm::StringRef desc
- const clang::ento::ExplodedNode* errorNode
¶PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef shortDesc,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode)
PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef shortDesc,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:373
Parameters
- const clang::ento::BugType& bt
- llvm::StringRef shortDesc
- llvm::StringRef desc
- const clang::ento::ExplodedNode* errorNode
¶PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode,
clang::ento::PathDiagnosticLocation
LocationToUnique,
const clang::Decl* DeclToUnique)
PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode,
clang::ento::PathDiagnosticLocation
LocationToUnique,
const clang::Decl* DeclToUnique)
Description
Create a PathSensitiveBugReport with a custom uniqueing location. The reports that have the same report location, description, bug type, and ranges are uniqued - only one of the equivalent reports will be presented to the user. This method allows to rest the location which should be used for uniquing reports. For example, memory leaks checker, could set this to the allocation site, rather then the location where the bug is reported.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:386
Parameters
- const clang::ento::BugType& bt
- llvm::StringRef desc
- const clang::ento::ExplodedNode* errorNode
- clang::ento::PathDiagnosticLocation LocationToUnique
- const clang::Decl* DeclToUnique
¶PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef shortDesc,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode,
clang::ento::PathDiagnosticLocation
LocationToUnique,
const clang::Decl* DeclToUnique)
PathSensitiveBugReport(
const clang::ento::BugType& bt,
llvm::StringRef shortDesc,
llvm::StringRef desc,
const clang::ento::ExplodedNode* errorNode,
clang::ento::PathDiagnosticLocation
LocationToUnique,
const clang::Decl* DeclToUnique)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:393
Parameters
- const clang::ento::BugType& bt
- llvm::StringRef shortDesc
- llvm::StringRef desc
- const clang::ento::ExplodedNode* errorNode
- clang::ento::PathDiagnosticLocation LocationToUnique
- const clang::Decl* DeclToUnique
¶void Profile(llvm::FoldingSetNodeID& hash) const
void Profile(llvm::FoldingSetNodeID& hash) const
Description
Profile to identify equivalent bug reports for error report coalescing. Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:488
Parameters
- llvm::FoldingSetNodeID& hash
¶void addCallStackHint(
clang::ento::PathDiagnosticPieceRef Piece,
std::unique_ptr<StackHintGenerator> StackHint)
void addCallStackHint(
clang::ento::PathDiagnosticPieceRef Piece,
std::unique_ptr<StackHintGenerator> StackHint)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:519
Parameters
- clang::ento::PathDiagnosticPieceRef Piece
- std::unique_ptr<StackHintGenerator> StackHint
¶bool addTrackedCondition(
const clang::ento::ExplodedNode* Cond)
bool addTrackedCondition(
const clang::ento::ExplodedNode* Cond)
Description
Notes that the condition of the CFGBlock associated with \p Cond is being tracked.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:515
Parameters
- const clang::ento::ExplodedNode* Cond
Returns
false if the condition is already being tracked.
¶template <class VisitorType, class... Args>
void addVisitor(Args&&... ConstructorArgs)
template <class VisitorType, class... Args>
void addVisitor(Args&&... ConstructorArgs)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:498
Templates
- VisitorType
- Args
Parameters
- Args&&... ConstructorArgs
¶void addVisitor(
std::unique_ptr<BugReporterVisitor> visitor)
void addVisitor(
std::unique_ptr<BugReporterVisitor> visitor)
Description
Add custom or predefined bug report visitors to this report. The visitors should be used when the default trace is not sufficient. For example, they allow constructing a more elaborate trace. @ {
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:495
Parameters
- std::unique_ptr<BugReporterVisitor> visitor
¶static bool classof(
const clang::ento::BugReport* R)
static bool classof(
const clang::ento::BugReport* R)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:398
Parameters
- const clang::ento::BugReport* R
¶void clearVisitors()
void clearVisitors()
Description
Remove all visitors attached to this bug report.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:505
¶void disablePathPruning()
void disablePathPruning()
Description
Disable all path pruning when generating a PathDiagnostic.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:409
¶std::string getCallStackMessage(
clang::ento::PathDiagnosticPieceRef Piece,
const clang::ento::ExplodedNode* N) const
std::string getCallStackMessage(
clang::ento::PathDiagnosticPieceRef Piece,
const clang::ento::ExplodedNode* N) const
Description
Produce the hint for the given node. The node contains information about the call for which the diagnostic can be generated.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:531
Parameters
- clang::ento::PathDiagnosticPieceRef Piece
- const clang::ento::ExplodedNode* N
¶const clang::Decl* getDeclWithIssue() const
const clang::Decl* getDeclWithIssue() const
Description
The smallest declaration that contains the bug location. This is purely cosmetic; the declaration can be displayed to the user but it does not affect whether the report is emitted.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:421
¶const clang::ento::ExplodedNode* getErrorNode()
const
const clang::ento::ExplodedNode* getErrorNode()
const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:402
¶Optional<bugreporter::TrackingKind>
getInterestingnessKind(clang::ento::SVal V) const
Optional<bugreporter::TrackingKind>
getInterestingnessKind(clang::ento::SVal V) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:462
Parameters
¶Optional<bugreporter::TrackingKind>
getInterestingnessKind(
const clang::ento::MemRegion* R) const
Optional<bugreporter::TrackingKind>
getInterestingnessKind(
const clang::ento::MemRegion* R) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:460
Parameters
- const clang::ento::MemRegion* R
¶Optional<bugreporter::TrackingKind>
getInterestingnessKind(
clang::ento::SymbolRef sym) const
Optional<bugreporter::TrackingKind>
getInterestingnessKind(
clang::ento::SymbolRef sym) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:457
Parameters
¶clang::ento::PathDiagnosticLocation getLocation()
const
clang::ento::PathDiagnosticLocation getLocation()
const
Description
The primary location of the bug report that points at the undesirable behavior in the code. UIs should attach the warning description to this location. The warning description should describe the bad behavior at this location.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:425
¶ArrayRef<clang::SourceRange> getRanges() const
ArrayRef<clang::SourceRange> getRanges() const
Description
Get the SourceRanges associated with the report.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:423
¶const clang::Stmt* getStmt() const
const clang::Stmt* getStmt() const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:358
¶const clang::Decl* getUniqueingDecl() const
const clang::Decl* getUniqueingDecl() const
Description
Get the declaration containing the uniqueing location.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:417
¶clang::ento::PathDiagnosticLocation
getUniqueingLocation() const
clang::ento::PathDiagnosticLocation
getUniqueingLocation() const
Description
Get the location on which the report should be uniqued.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:412
¶bool hasCallStackHint(
clang::ento::PathDiagnosticPieceRef Piece)
const
bool hasCallStackHint(
clang::ento::PathDiagnosticPieceRef Piece)
const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:524
Parameters
- clang::ento::PathDiagnosticPieceRef Piece
¶bool isInteresting(clang::ento::SVal V) const
bool isInteresting(clang::ento::SVal V) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:453
Parameters
¶bool isInteresting(
clang::ento::SymbolRef sym) const
bool isInteresting(
clang::ento::SymbolRef sym) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:451
Parameters
¶bool isInteresting(
const clang::LocationContext* LC) const
bool isInteresting(
const clang::LocationContext* LC) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:454
Parameters
- const clang::LocationContext* LC
¶bool isInteresting(
const clang::ento::MemRegion* R) const
bool isInteresting(
const clang::ento::MemRegion* R) const
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:452
Parameters
- const clang::ento::MemRegion* R
¶bool isValid() const
bool isValid() const
Description
Returns whether or not this report should be considered valid. Invalid reports are those that have been classified as likely false positives after the fact.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:468
¶void markInteresting(
const clang::LocationContext* LC)
void markInteresting(
const clang::LocationContext* LC)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:449
Parameters
- const clang::LocationContext* LC
¶void markInteresting(
clang::ento::SVal V,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
void markInteresting(
clang::ento::SVal V,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
Description
Marks a symbolic value as interesting. Different kinds of interestingness will be processed differently by visitors (e.g. if the tracking kind is condition, will append "will be used as a condition" to the message).
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:447
Parameters
- clang::ento::SVal V
- bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough
¶void markInteresting(
const clang::ento::MemRegion* R,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
void markInteresting(
const clang::ento::MemRegion* R,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
Description
Marks a region as interesting. Different kinds of interestingness will be processed differently by visitors (e.g. if the tracking kind is condition, will append "will be used as a condition" to the message).
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:438
Parameters
- const clang::ento::MemRegion* R
- bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough
¶void markInteresting(
clang::ento::SymbolRef sym,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
void markInteresting(
clang::ento::SymbolRef sym,
bugreporter::TrackingKind TKind =
bugreporter::TrackingKind::Thorough)
Description
Marks a symbol as interesting. Different kinds of interestingness will be processed differently by visitors (e.g. if the tracking kind is condition, will append "will be used as a condition" to the message).
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:430
Parameters
- clang::ento::SymbolRef sym
- bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough
¶void markInvalid(const void* Tag,
const void* Data)
void markInvalid(const void* Tag,
const void* Data)
Description
Marks the current report as invalid, meaning that it is probably a false positive and should not be reported to the user. The \p Tag and \p Data arguments are intended to be opaque identifiers for this particular invalidation, where \p Tag represents the visitor responsible for invalidation, and \p Data represents the reason this visitor decided to invalidate the bug report.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:481
Parameters
- const void* Tag
- const void* Data
¶void markNotInteresting(
const clang::ento::MemRegion* R)
void markNotInteresting(
const clang::ento::MemRegion* R)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:442
Parameters
- const clang::ento::MemRegion* R
¶void markNotInteresting(
clang::ento::SymbolRef sym)
void markNotInteresting(
clang::ento::SymbolRef sym)
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:433
Parameters
¶bool shouldPrunePath() const
bool shouldPrunePath() const
Description
Indicates whether or not any path pruning should take place when generating a PathDiagnostic from this BugReport.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:406
¶clang::ento::PathSensitiveBugReport::
visitor_iterator
visitor_begin()
clang::ento::PathSensitiveBugReport::
visitor_iterator
visitor_begin()
Description
Iterators through the custom diagnostic visitors.
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:508
¶clang::ento::PathSensitiveBugReport::
visitor_iterator
visitor_end()
clang::ento::PathSensitiveBugReport::
visitor_iterator
visitor_end()
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:509
¶clang::ento::PathSensitiveBugReport::visitor_range
visitors()
clang::ento::PathSensitiveBugReport::visitor_range
visitors()
Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:510