clang 22.0.0git
clang::ento::NilReceiverBRVisitor Class Referencefinal

Prints path notes when a message is sent to a nil receiver. More...

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

Inheritance diagram for clang::ento::NilReceiverBRVisitor:
[legend]

Public Member Functions

void Profile (llvm::FoldingSetNodeID &ID) const override
PathDiagnosticPieceRef VisitNode (const ExplodedNode *N, BugReporterContext &BRC, PathSensitiveBugReport &BR) override
 Return a diagnostic piece which should be associated with the given node.
Public Member Functions inherited from clang::ento::BugReporterVisitor
 BugReporterVisitor ()=default
 BugReporterVisitor (const BugReporterVisitor &)=default
 BugReporterVisitor (BugReporterVisitor &&)
BugReporterVisitoroperator= (const BugReporterVisitor &)=delete
BugReporterVisitoroperator= (BugReporterVisitor &&)=delete
virtual ~BugReporterVisitor ()
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.

Static Public Member Functions

static const ExprgetNilReceiver (const Stmt *S, const ExplodedNode *N)
 If the statement is a message send expression with nil receiver, returns the receiver expression.
Static Public Member Functions inherited from clang::ento::BugReporterVisitor
static PathDiagnosticPieceRef getDefaultEndPath (const BugReporterContext &BRC, const ExplodedNode *N, const PathSensitiveBugReport &BR)
 Generates the default final diagnostic piece.

Detailed Description

Prints path notes when a message is sent to a nil receiver.

Definition at line 430 of file BugReporterVisitors.h.

Member Function Documentation

◆ getNilReceiver()

const Expr * NilReceiverBRVisitor::getNilReceiver ( const Stmt * S,
const ExplodedNode * N )
static

If the statement is a message send expression with nil receiver, returns the receiver expression.

Returns NULL otherwise.

Definition at line 2662 of file BugReporterVisitors.cpp.

References clang::ento::ExplodedNode::getState(), clang::ento::ExplodedNode::getSVal(), and V.

Referenced by VisitNode().

◆ Profile()

void clang::ento::NilReceiverBRVisitor::Profile ( llvm::FoldingSetNodeID & ID) const
inlineoverridevirtual

Implements clang::ento::BugReporterVisitor.

Definition at line 432 of file BugReporterVisitors.h.

◆ VisitNode()

PathDiagnosticPieceRef NilReceiverBRVisitor::VisitNode ( const ExplodedNode * Succ,
BugReporterContext & BRC,
PathSensitiveBugReport & BR )
overridevirtual

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.

Implements clang::ento::BugReporterVisitor.

Definition at line 2677 of file BugReporterVisitors.cpp.

References clang::ento::ExplodedNode::getLocationAs(), clang::ento::ExplodedNode::getLocationContext(), getNilReceiver(), clang::ento::BugReporterContext::getSourceManager(), clang::ento::OS, clang::ento::bugreporter::Thorough, and clang::ento::bugreporter::trackExpressionValue().


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