clang  14.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]
Collaboration diagram for clang::ento::BugReporterVisitor:
Collaboration graph
[legend]

Public Member Functions

 BugReporterVisitor ()=default
 
 BugReporterVisitor (const BugReporterVisitor &)=default
 
 BugReporterVisitor (BugReporterVisitor &&)
 
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. More...
 
virtual void finalizeVisitor (BugReporterContext &BRC, const ExplodedNode *EndPathNode, PathSensitiveBugReport &BR)
 Last function called on the visitor, no further calls to VisitNode would follow. More...
 
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. More...
 
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. More...
 

Detailed Description

BugReporterVisitors are used to add custom diagnostics along a path.

Definition at line 48 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 52 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::LikelyFalsePositiveSuppressionBRVisitor, and clang::ento::FalsePositiveRefutationBRVisitor.

Definition at line 325 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::RefLeakReportVisitor, and clang::ento::retaincountchecker::RefCountReportVisitor.

Definition at line 319 of file BugReporterVisitors.cpp.

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


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