clang: clang::ento::BasicBugReport Class Reference (original) (raw)
#include "[clang/StaticAnalyzer/Core/BugReporter/BugReporter.h](BugReporter%5F8h%5Fsource.html)"
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. | |
![]() |
|
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. | |
Additional Inherited Members | |
---|---|
![]() |
|
enum class | Kind { Basic, PathSensitive } |
![]() |
|
BugReport (Kind kind, const BugType &bt, StringRef desc) | |
BugReport (Kind K, const BugType &BT, StringRef ShortDescription, StringRef Description) | |
![]() |
|
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.
◆ classof()
static bool clang::ento::BasicBugReport::classof ( const BugReport * R) | inlinestatic |
---|
◆ getDeclWithIssue()
const Decl * clang::ento::BasicBugReport::getDeclWithIssue ( ) const | inlineoverridevirtual |
---|
◆ getLocation()
◆ getUniqueingDecl()
const Decl * clang::ento::BasicBugReport::getUniqueingDecl ( ) const | inlineoverridevirtual |
---|
◆ getUniqueingLocation()
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().
◆ Profile()
void BasicBugReport::Profile ( llvm::FoldingSetNodeID & hash) const | overridevirtual |
---|
◆ setDeclWithIssue()
void clang::ento::BasicBugReport::setDeclWithIssue ( const Decl * declWithIssue) | 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.
The documentation for this class was generated from the following files:
- include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
- lib/StaticAnalyzer/Core/BugReporter.cpp