clang 20.0.0git
Public Member Functions | Static Public Member Functions | List of all members
clang::ento::BugReporterVisitor Class Referenceabstract

BugReporterVisitors are used to add custom diagnostics along a path. More...

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

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

Public Member Functions

 BugReporterVisitor ()=default
 
 BugReporterVisitor (const BugReporterVisitor &)=default
 
 BugReporterVisitor (BugReporterVisitor &&)
 
BugReporterVisitoroperator= (const BugReporterVisitor &)=delete
 
BugReporterVisitoroperator= (BugReporterVisitor &&)=delete
 
virtual ~BugReporterVisitor ()
 
virtual PathDiagnosticPieceRef VisitNode (const ExplodedNode *Succ, BugReporterContext &BRC, PathSensitiveBugReport &BR)=0
 Return a diagnostic piece which should be associated with the given node.
 
virtual void finalizeVisitor (BugReporterContext &BRC, const ExplodedNode *EndPathNode, PathSensitiveBugReport &BR)
 Last function called on the visitor, no further calls to VisitNode would follow.
 
virtual PathDiagnosticPieceRef getEndPath (BugReporterContext &BRC, const ExplodedNode *N, PathSensitiveBugReport &BR)
 Provide custom definition for the final diagnostic piece on the path - the piece, which is displayed before the path is expanded.
 
virtual void Profile (llvm::FoldingSetNodeID &ID) const =0
 

Static Public Member Functions

static PathDiagnosticPieceRef getDefaultEndPath (const BugReporterContext &BRC, const ExplodedNode *N, const PathSensitiveBugReport &BR)
 Generates the default final diagnostic piece.
 

Detailed Description

BugReporterVisitors are used to add custom diagnostics along a path.

Definition at line 49 of file BugReporterVisitors.h.

Constructor & Destructor Documentation

◆ BugReporterVisitor() [1/3]

clang::ento::BugReporterVisitor::BugReporterVisitor ( )
default

◆ BugReporterVisitor() [2/3]

clang::ento::BugReporterVisitor::BugReporterVisitor ( const BugReporterVisitor )
default

◆ BugReporterVisitor() [3/3]

clang::ento::BugReporterVisitor::BugReporterVisitor ( BugReporterVisitor &&  )
inline

Definition at line 53 of file BugReporterVisitors.h.

◆ ~BugReporterVisitor()

BugReporterVisitor::~BugReporterVisitor ( )
virtualdefault

Member Function Documentation

◆ finalizeVisitor()

void BugReporterVisitor::finalizeVisitor ( BugReporterContext BRC,
const ExplodedNode EndPathNode,
PathSensitiveBugReport BR 
)
virtual

Last function called on the visitor, no further calls to VisitNode would follow.

Reimplemented in clang::ento::Z3CrosscheckVisitor, and clang::ento::LikelyFalsePositiveSuppressionBRVisitor.

Definition at line 359 of file BugReporterVisitors.cpp.

◆ getDefaultEndPath()

PathDiagnosticPieceRef BugReporterVisitor::getDefaultEndPath ( const BugReporterContext BRC,
const ExplodedNode N,
const PathSensitiveBugReport BR 
)
static

◆ getEndPath()

PathDiagnosticPieceRef BugReporterVisitor::getEndPath ( BugReporterContext BRC,
const ExplodedNode N,
PathSensitiveBugReport BR 
)
virtual

Provide custom definition for the final diagnostic piece on the path - the piece, which is displayed before the path is expanded.

NOTE that this function can be implemented on at most one used visitor, and otherwise it crahes at runtime.

Reimplemented in clang::ento::retaincountchecker::RefCountReportVisitor, and clang::ento::retaincountchecker::RefLeakReportVisitor.

Definition at line 353 of file BugReporterVisitors.cpp.

◆ operator=() [1/2]

BugReporterVisitor & clang::ento::BugReporterVisitor::operator= ( BugReporterVisitor &&  )
delete

◆ operator=() [2/2]

BugReporterVisitor & clang::ento::BugReporterVisitor::operator= ( const BugReporterVisitor )
delete

◆ Profile()

virtual void clang::ento::BugReporterVisitor::Profile ( llvm::FoldingSetNodeID &  ID) const
pure virtual

◆ VisitNode()

virtual PathDiagnosticPieceRef clang::ento::BugReporterVisitor::VisitNode ( const ExplodedNode Succ,
BugReporterContext BRC,
PathSensitiveBugReport BR 
)
pure virtual

Return a diagnostic piece which should be associated with the given node.

Note that this function does not get run on the very last node of the report, as the PathDiagnosticPiece associated with the last node should be unique. Use getEndPath to customize the note associated with the report end instead.

The last parameter can be used to register a new visitor with the given BugReport while processing a node.

Implemented in clang::ento::LikelyFalsePositiveSuppressionBRVisitor, clang::ento::NoStateChangeFuncVisitor, clang::ento::TrackConstraintBRVisitor, clang::ento::NilReceiverBRVisitor, clang::ento::ConditionBRVisitor, clang::ento::UndefOrNullArgVisitor, clang::ento::Z3CrosscheckVisitor, clang::ento::retaincountchecker::RefCountReportVisitor, clang::ento::TagVisitor, and clang::ento::SuppressInlineDefensiveChecksVisitor.

Referenced by REGISTER_MAP_WITH_PROGRAMSTATE().


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