clang 20.0.0git
Public Types | Public Member Functions | Protected Member Functions | List of all members
clang::ento::BugReporter Class Reference

BugReporter is a utility class for generating PathDiagnostics for analysis. More...

#include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h"

Inheritance diagram for clang::ento::BugReporter:
Inheritance graph
[legend]

Public Types

using EQClasses_iterator = llvm::FoldingSet< BugReportEquivClass >::iterator
 Iterator over the set of BugReports tracked by the BugReporter.
 

Public Member Functions

 BugReporter (BugReporterData &d)
 
virtual ~BugReporter ()
 
void FlushReports ()
 Generate and flush diagnostics for all bug reports.
 
ArrayRef< PathDiagnosticConsumer * > getPathDiagnosticConsumers ()
 
llvm::iterator_range< EQClasses_iteratorequivalenceClasses ()
 
ASTContextgetContext ()
 
const SourceManagergetSourceManager ()
 
const AnalyzerOptionsgetAnalyzerOptions ()
 
PreprocessorgetPreprocessor ()
 
const DeclgetAnalysisEntryPoint () const
 Get the top-level entry point for the issue to be reported.
 
void setAnalysisEntryPoint (const Decl *EntryPoint)
 
virtual void emitReport (std::unique_ptr< BugReport > R)
 Add the given report to the set of reports tracked by BugReporter.
 
void EmitBasicReport (const Decl *DeclWithIssue, const CheckerBase *Checker, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, ArrayRef< SourceRange > Ranges=std::nullopt, ArrayRef< FixItHint > Fixits=std::nullopt)
 
void EmitBasicReport (const Decl *DeclWithIssue, CheckerNameRef CheckerName, StringRef BugName, StringRef BugCategory, StringRef BugStr, PathDiagnosticLocation Loc, ArrayRef< SourceRange > Ranges=std::nullopt, ArrayRef< FixItHint > Fixits=std::nullopt)
 

Protected Member Functions

virtual std::unique_ptr< DiagnosticForConsumerMapTygenerateDiagnosticForConsumerMap (BugReport *exampleReport, ArrayRef< PathDiagnosticConsumer * > consumers, ArrayRef< BugReport * > bugReports)
 Generate the diagnostics for the given bug report.
 

Detailed Description

BugReporter is a utility class for generating PathDiagnostics for analysis.

It collects the BugReports and BugTypes and knows how to generate and flush the corresponding diagnostics.

The base class is used for generating path-insensitive

Definition at line 585 of file BugReporter.h.

Member Typedef Documentation

◆ EQClasses_iterator

Iterator over the set of BugReports tracked by the BugReporter.

Definition at line 616 of file BugReporter.h.

Constructor & Destructor Documentation

◆ BugReporter()

BugReporter::BugReporter ( BugReporterData d)

Definition at line 2484 of file BugReporter.cpp.

◆ ~BugReporter()

BugReporter::~BugReporter ( )
virtual

Definition at line 2487 of file BugReporter.cpp.

Member Function Documentation

◆ EmitBasicReport() [1/2]

void BugReporter::EmitBasicReport ( const Decl DeclWithIssue,
CheckerNameRef  CheckerName,
StringRef  BugName,
StringRef  BugCategory,
StringRef  BugStr,
PathDiagnosticLocation  Loc,
ArrayRef< SourceRange Ranges = std::nullopt,
ArrayRef< FixItHint Fixits = std::nullopt 
)

◆ EmitBasicReport() [2/2]

void BugReporter::EmitBasicReport ( const Decl DeclWithIssue,
const CheckerBase Checker,
StringRef  BugName,
StringRef  BugCategory,
StringRef  BugStr,
PathDiagnosticLocation  Loc,
ArrayRef< SourceRange Ranges = std::nullopt,
ArrayRef< FixItHint Fixits = std::nullopt 
)

◆ emitReport()

void BugReporter::emitReport ( std::unique_ptr< BugReport R)
virtual

Add the given report to the set of reports tracked by BugReporter.

The reports are usually generated by the checkers. Further, they are folded based on the profile value, which is done to coalesce similar reports.

Reimplemented in clang::ento::PathSensitiveBugReporter.

Definition at line 2931 of file BugReporter.cpp.

References clang::ento::BugSuppression::isSuppressed().

Referenced by EmitBasicReport(), clang::ento::CheckerContext::emitReport(), clang::ento::PathSensitiveBugReporter::emitReport(), clang::ento::mpi::MPIBugReporter::reportDoubleNonblocking(), clang::ento::mpi::MPIBugReporter::reportMissingWait(), and clang::ento::mpi::MPIBugReporter::reportUnmatchedWait().

◆ equivalenceClasses()

llvm::iterator_range< EQClasses_iterator > clang::ento::BugReporter::equivalenceClasses ( )
inline

◆ FlushReports()

void BugReporter::FlushReports ( )

Generate and flush diagnostics for all bug reports.

Definition at line 2497 of file BugReporter.cpp.

◆ generateDiagnosticForConsumerMap()

std::unique_ptr< DiagnosticForConsumerMapTy > BugReporter::generateDiagnosticForConsumerMap ( BugReport exampleReport,
ArrayRef< PathDiagnosticConsumer * >  consumers,
ArrayRef< BugReport * >  bugReports 
)
protectedvirtual

Generate the diagnostics for the given bug report.

Definition at line 3247 of file BugReporter.cpp.

References generateDiagnosticForBasicReport().

◆ getAnalysisEntryPoint()

const Decl * clang::ento::BugReporter::getAnalysisEntryPoint ( ) const
inline

Get the top-level entry point for the issue to be reported.

Definition at line 630 of file BugReporter.h.

◆ getAnalyzerOptions()

const AnalyzerOptions & clang::ento::BugReporter::getAnalyzerOptions ( )
inline

Definition at line 625 of file BugReporter.h.

References D.

Referenced by clang::ento::BugReporterContext::getAnalyzerOptions().

◆ getContext()

ASTContext & clang::ento::BugReporter::getContext ( )
inline

Definition at line 621 of file BugReporter.h.

References D.

Referenced by CheckObjCInstMethSignature(), and clang::ento::BugReporterContext::getASTContext().

◆ getPathDiagnosticConsumers()

ArrayRef< PathDiagnosticConsumer * > clang::ento::BugReporter::getPathDiagnosticConsumers ( )
inline

Definition at line 611 of file BugReporter.h.

References D.

◆ getPreprocessor()

Preprocessor & clang::ento::BugReporter::getPreprocessor ( )
inline

Definition at line 627 of file BugReporter.h.

References D.

Referenced by clang::ento::CheckerContext::getPreprocessor().

◆ getSourceManager()

const SourceManager & clang::ento::BugReporter::getSourceManager ( )
inline

◆ setAnalysisEntryPoint()

void clang::ento::BugReporter::setAnalysisEntryPoint ( const Decl EntryPoint)
inline

Definition at line 632 of file BugReporter.h.

Referenced by clang::ento::ExprEngine::ExecuteWorkList().


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