clang 20.0.0git
|
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"
Public Member Functions | |
BasicBugReport (const BugType &bt, StringRef desc, PathDiagnosticLocation l) | |
PathDiagnosticLocation | getLocation () const override |
The primary location of the bug report that points at the undesirable behavior in the code. | |
const Decl * | getDeclWithIssue () const override |
The smallest declaration that contains the bug location. | |
PathDiagnosticLocation | getUniqueingLocation () const override |
Get the location on which the report should be uniqued. | |
const Decl * | getUniqueingDecl () const override |
Get the declaration that corresponds to (usually contains) the uniqueing location. | |
void | setDeclWithIssue (const Decl *declWithIssue) |
Specifically set the Decl where an issue occurred. | |
void | Profile (llvm::FoldingSetNodeID &hash) const override |
Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug. | |
Public Member Functions inherited from clang::ento::BugReport | |
virtual | ~BugReport ()=default |
Kind | getKind () const |
const BugType & | getBugType () 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 Decl * | getDeclWithIssue () 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 Decl * | getUniqueingDecl () 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< SourceRange > | getRanges () const |
Get the SourceRanges associated with the report. | |
void | addFixItHint (const FixItHint &F) |
Add a fix-it hint to the bug report. | |
llvm::ArrayRef< FixItHint > | getFixits () const |
virtual void | Profile (llvm::FoldingSetNodeID &hash) const =0 |
Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug. | |
Static Public Member Functions | |
static bool | classof (const BugReport *R) |
Additional Inherited Members | |
Public Types inherited from clang::ento::BugReport | |
enum class | Kind { Basic , PathSensitive } |
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) | |
Protected Attributes inherited from clang::ento::BugReport | |
Kind | K |
const BugType & | BT |
std::string | ShortDescription |
std::string | Description |
SmallVector< SourceRange, 4 > | Ranges |
SmallVector< std::shared_ptr< PathDiagnosticNotePiece >, 4 > | Notes |
SmallVector< FixItHint, 4 > | Fixits |
Definition at line 251 of file BugReporter.h.
|
inline |
Definition at line 256 of file BugReporter.h.
Definition at line 259 of file BugReporter.h.
References clang::ento::BugReport::Basic, and clang::ento::BugReport::getKind().
|
inlineoverridevirtual |
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.
Implements clang::ento::BugReport.
Definition at line 268 of file BugReporter.h.
Referenced by generateDiagnosticForBasicReport(), and getUniqueingDecl().
|
inlineoverridevirtual |
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.
Implements clang::ento::BugReport.
Definition at line 263 of file BugReporter.h.
References clang::ento::PathDiagnosticLocation::isValid().
Referenced by getUniqueingLocation().
|
inlineoverridevirtual |
Get the declaration that corresponds to (usually contains) the uniqueing location.
This is not actively used for uniqueing, i.e. otherwise identical reports that have different uniqueing decls will be considered equivalent.
Implements clang::ento::BugReport.
Definition at line 276 of file BugReporter.h.
References getDeclWithIssue().
Referenced by generateDiagnosticForBasicReport().
|
inlineoverridevirtual |
Get the location on which the report should be uniqued.
Two warnings are considered to be equivalent whenever they have the same bug types, descriptions, and uniqueing locations. Out of a class of equivalent warnings only one gets displayed to the user. For most warnings the uniqueing location coincides with their location, but sometimes it makes sense to use different locations. For example, a leak checker can place the warning at the location where the last reference to the leaking resource is dropped but at the same time unique the warning by where that resource is acquired (allocated).
Implements clang::ento::BugReport.
Definition at line 272 of file BugReporter.h.
References getLocation().
Referenced by generateDiagnosticForBasicReport().
|
overridevirtual |
Reports are uniqued to ensure that we do not emit multiple diagnostics for each bug.
Implements clang::ento::BugReport.
Definition at line 2194 of file BugReporter.cpp.
References clang::ento::BugReport::BT, clang::ento::BugReport::getKind(), clang::ento::BugReport::getShortDescription(), clang::ento::PathDiagnosticLocation::isValid(), clang::ento::PathDiagnosticLocation::Profile(), and clang::ento::BugReport::Ranges.
|
inline |
Specifically set the Decl where an issue occurred.
This isn't necessary for BugReports that cover a path as it will be automatically inferred.
Definition at line 282 of file BugReporter.h.