clang 24.0.0git
clang::ento::NodeBuilder Class Reference

This is the simplest builder which generates nodes in the ExplodedGraph. More...

#include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"

Public Member Functions

 NodeBuilder (ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
 NodeBuilder (ExplodedNode *SrcNode, ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
 NodeBuilder (const ExplodedNodeSet &SrcSet, ExplodedNodeSet &DstSet, const NodeBuilderContext &Ctx)
ExplodedNodegenerateNode (const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred, bool MarkAsSink=false)
 Generates a node in the ExplodedGraph.
ExplodedNodegenerateSink (const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
 Generates a sink in the ExplodedGraph.
ExplodedNodegenerateNode (const Stmt *S, ExplodedNode *Pred, ProgramStateRef St, const ProgramPointTag *tag=nullptr, ProgramPoint::Kind K=ProgramPoint::PostStmtKind)
ExplodedNodegenerateSink (const Stmt *S, ExplodedNode *Pred, ProgramStateRef St, const ProgramPointTag *tag=nullptr, ProgramPoint::Kind K=ProgramPoint::PostStmtKind)
const ExplodedNodeSetgetResults () const
void takeNodes (const ExplodedNodeSet &S)
void takeNodes (ExplodedNode *N)
void addNodes (const ExplodedNodeSet &S)
void addNodes (ExplodedNode *N)

Protected Attributes

const NodeBuilderContextC
ExplodedNodeSetFrontier
 The frontier set - a set of nodes which need to be propagated after the builder dies.

Detailed Description

This is the simplest builder which generates nodes in the ExplodedGraph.

The main benefit of the builder is that it automatically tracks the frontier nodes (or destination set). This is the set of nodes which should be propagated to the next step / builder. They are the nodes which have been added to the builder (either as the input node set or as the newly constructed nodes) but did not have any outgoing transitions added.

TODO: This "main benefit" is often useless, in fact the only significant use is within CheckerManager::ExpandGraphWithCheckers. There this logic ensures that if a checker performs multiple transitions on the same path, then only the last of them is "built upon" by other checkers or the engine.

However, there are also many short-lived temporary NodeBuilder instances where the generateNode is called in a very predictable manner (once, or once for each source node) and the frontier management is overkill. These locations should be gradually simplified by using the method CoreEngine::makeNode() instead of the temporary NodeBuilders.

Definition at line 265 of file CoreEngine.h.

Constructor & Destructor Documentation

◆ NodeBuilder() [1/3]

clang::ento::NodeBuilder::NodeBuilder ( ExplodedNodeSet & DstSet,
const NodeBuilderContext & Ctx )
inline

Definition at line 274 of file CoreEngine.h.

References C, and Frontier.

Referenced by NodeBuilder(), and NodeBuilder().

◆ NodeBuilder() [2/3]

clang::ento::NodeBuilder::NodeBuilder ( ExplodedNode * SrcNode,
ExplodedNodeSet & DstSet,
const NodeBuilderContext & Ctx )
inline

Definition at line 277 of file CoreEngine.h.

References Frontier, and NodeBuilder().

◆ NodeBuilder() [3/3]

clang::ento::NodeBuilder::NodeBuilder ( const ExplodedNodeSet & SrcSet,
ExplodedNodeSet & DstSet,
const NodeBuilderContext & Ctx )
inline

Definition at line 283 of file CoreEngine.h.

References Frontier, and NodeBuilder().

Member Function Documentation

◆ addNodes() [1/2]

void clang::ento::NodeBuilder::addNodes ( const ExplodedNodeSet & S)
inline

Definition at line 332 of file CoreEngine.h.

References Frontier.

◆ addNodes() [2/2]

void clang::ento::NodeBuilder::addNodes ( ExplodedNode * N)
inline

Definition at line 333 of file CoreEngine.h.

References Frontier.

◆ generateNode() [1/2]

ExplodedNode * NodeBuilder::generateNode ( const ProgramPoint & PP,
ProgramStateRef State,
ExplodedNode * Pred,
bool MarkAsSink = false )

Generates a node in the ExplodedGraph.

Definition at line 674 of file CoreEngine.cpp.

References C, and Frontier.

Referenced by generateNode(), and generateSink().

◆ generateNode() [2/2]

◆ generateSink() [1/2]

ExplodedNode * clang::ento::NodeBuilder::generateSink ( const ProgramPoint & PP,
ProgramStateRef State,
ExplodedNode * Pred )
inline

Generates a sink in the ExplodedGraph.

When a node is marked as sink, the exploration from the node is stopped - the node becomes the last node on the path and certain kinds of bugs are suppressed.

Definition at line 298 of file CoreEngine.h.

References generateNode().

Referenced by generateSink().

◆ generateSink() [2/2]

◆ getResults()

const ExplodedNodeSet & clang::ento::NodeBuilder::getResults ( ) const
inline

Definition at line 324 of file CoreEngine.h.

References Frontier.

◆ takeNodes() [1/2]

void clang::ento::NodeBuilder::takeNodes ( const ExplodedNodeSet & S)
inline

Definition at line 326 of file CoreEngine.h.

References Frontier.

◆ takeNodes() [2/2]

void clang::ento::NodeBuilder::takeNodes ( ExplodedNode * N)
inline

Definition at line 331 of file CoreEngine.h.

References Frontier.

Member Data Documentation

◆ C

const NodeBuilderContext& clang::ento::NodeBuilder::C
protected

Definition at line 267 of file CoreEngine.h.

Referenced by generateNode(), and NodeBuilder().

◆ Frontier

ExplodedNodeSet& clang::ento::NodeBuilder::Frontier
protected

The frontier set - a set of nodes which need to be propagated after the builder dies.

Definition at line 271 of file CoreEngine.h.

Referenced by addNodes(), addNodes(), generateNode(), getResults(), NodeBuilder(), NodeBuilder(), NodeBuilder(), takeNodes(), and takeNodes().


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