clang 22.0.0git
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:
[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

References BugReporterVisitor().

◆ BugReporterVisitor() [3/3]

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

Definition at line 53 of file BugReporterVisitors.h.

References BugReporterVisitor().

◆ ~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::LikelyFalsePositiveSuppressionBRVisitor, and clang::ento::Z3CrosscheckVisitor.

Definition at line 355 of file BugReporterVisitors.cpp.

◆ getDefaultEndPath()

◆ 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 349 of file BugReporterVisitors.cpp.

◆ operator=() [1/2]

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

References BugReporterVisitor().

◆ operator=() [2/2]

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

References BugReporterVisitor().

◆ Profile()

◆ 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::ConditionBRVisitor, clang::ento::LikelyFalsePositiveSuppressionBRVisitor, clang::ento::NilReceiverBRVisitor, clang::ento::NoStateChangeFuncVisitor, clang::ento::retaincountchecker::RefCountReportVisitor, clang::ento::SuppressInlineDefensiveChecksVisitor, clang::ento::TagVisitor, clang::ento::TrackConstraintBRVisitor, clang::ento::UndefOrNullArgVisitor, and clang::ento::Z3CrosscheckVisitor.

Referenced by REGISTER_MAP_WITH_PROGRAMSTATE().


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