clang
13.0.0git
|
#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
Public Types | |
using | succ_iterator = ExplodedNode *const * |
using | succ_range = llvm::iterator_range< succ_iterator > |
using | const_succ_iterator = const ExplodedNode *const * |
using | const_succ_range = llvm::iterator_range< const_succ_iterator > |
using | pred_iterator = ExplodedNode *const * |
using | pred_range = llvm::iterator_range< pred_iterator > |
using | const_pred_iterator = const ExplodedNode *const * |
using | const_pred_range = llvm::iterator_range< const_pred_iterator > |
Public Member Functions | |
ExplodedNode (const ProgramPoint &loc, ProgramStateRef state, int64_t Id, bool IsSink) | |
ProgramPoint | getLocation () const |
getLocation - Returns the edge associated with the given node. More... | |
const LocationContext * | getLocationContext () const |
const StackFrameContext * | getStackFrame () const |
const Decl & | getCodeDecl () const |
CFG & | getCFG () const |
const CFGBlock * | getCFGBlock () const |
const ParentMap & | getParentMap () const |
template<typename T > | |
T & | getAnalysis () const |
const ProgramStateRef & | getState () const |
template<typename T > | |
Optional< T > | getLocationAs () const LLVM_LVALUE_FUNCTION |
SVal | getSVal (const Stmt *S) const |
Get the value of an arbitrary expression at this node. More... | |
void | Profile (llvm::FoldingSetNodeID &ID) const |
void | addPredecessor (ExplodedNode *V, ExplodedGraph &G) |
addPredeccessor - Adds a predecessor to the current node, and in tandem add this node as a successor of the other node. More... | |
unsigned | succ_size () const |
unsigned | pred_size () const |
bool | succ_empty () const |
bool | pred_empty () const |
bool | isSink () const |
bool | hasSinglePred () const |
ExplodedNode * | getFirstPred () |
const ExplodedNode * | getFirstPred () const |
ExplodedNode * | getFirstSucc () |
const ExplodedNode * | getFirstSucc () const |
pred_iterator | pred_begin () |
pred_iterator | pred_end () |
pred_range | preds () |
const_pred_iterator | pred_begin () const |
const_pred_iterator | pred_end () const |
const_pred_range | preds () const |
succ_iterator | succ_begin () |
succ_iterator | succ_end () |
succ_range | succs () |
const_succ_iterator | succ_begin () const |
const_succ_iterator | succ_end () const |
const_succ_range | succs () const |
int64_t | getID () const |
bool | isTrivial () const |
The node is trivial if it has only one successor, only one predecessor, it's predecessor has only one successor, and its program state is the same as the program state of the previous node. More... | |
const Stmt * | getStmtForDiagnostics () const |
If the node's program point corresponds to a statement, retrieve that statement. More... | |
const Stmt * | getNextStmtForDiagnostics () const |
Find the next statement that was executed on this node's execution path. More... | |
const Stmt * | getPreviousStmtForDiagnostics () const |
Find the statement that was executed immediately before this node. More... | |
const Stmt * | getCurrentOrPreviousStmtForDiagnostics () const |
Find the statement that was executed at or immediately before this node. More... | |
Static Public Member Functions | |
static void | Profile (llvm::FoldingSetNodeID &ID, const ProgramPoint &Loc, const ProgramStateRef &state, bool IsSink) |
Friends | |
class | BranchNodeBuilder |
class | CoreEngine |
class | EndOfFunctionNodeBuilder |
class | ExplodedGraph |
class | IndirectGotoNodeBuilder |
class | NodeBuilder |
class | SwitchNodeBuilder |
Definition at line 65 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::const_pred_iterator = const ExplodedNode * const * |
Definition at line 236 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::const_pred_range = llvm::iterator_range<const_pred_iterator> |
Definition at line 237 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::const_succ_iterator = const ExplodedNode * const * |
Definition at line 230 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::const_succ_range = llvm::iterator_range<const_succ_iterator> |
Definition at line 231 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::pred_iterator = ExplodedNode * const * |
Definition at line 233 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::pred_range = llvm::iterator_range<pred_iterator> |
Definition at line 234 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::succ_iterator = ExplodedNode * const * |
Definition at line 227 of file ExplodedGraph.h.
using clang::ento::ExplodedNode::succ_range = llvm::iterator_range<succ_iterator> |
Definition at line 228 of file ExplodedGraph.h.
|
inlineexplicit |
Definition at line 137 of file ExplodedGraph.h.
void ExplodedNode::addPredecessor | ( | ExplodedNode * | V, |
ExplodedGraph & | G | ||
) |
addPredeccessor - Adds a predecessor to the current node, and in tandem add this node as a successor of the other node.
Definition at line 205 of file ExplodedGraph.cpp.
References V.
Referenced by clang::ento::CoreEngine::enqueueStmtNode(), clang::ento::SwitchNodeBuilder::generateCaseStmtNode(), clang::ento::SwitchNodeBuilder::generateDefaultCaseNode(), clang::ento::IndirectGotoNodeBuilder::generateNode(), clang::ento::NodeBuilder::generateNodeImpl(), clang::ento::ExprEngine::processCallExit(), and clang::ento::ExplodedGraph::trim().
|
inline |
Definition at line 165 of file ExplodedGraph.h.
References clang::LocationContext::getAnalysis(), and getLocationContext().
|
inline |
Definition at line 156 of file ExplodedGraph.h.
References clang::LocationContext::getCFG(), and getLocationContext().
const CFGBlock * ExplodedNode::getCFGBlock | ( | ) | const |
Definition at line 291 of file ExplodedGraph.cpp.
References getLocation(), and P.
|
inline |
Definition at line 154 of file ExplodedGraph.h.
References clang::LocationContext::getDecl(), and getLocationContext().
Referenced by clang::ento::retaincountchecker::RefLeakReportVisitor::getEndPath().
const Stmt * ExplodedNode::getCurrentOrPreviousStmtForDiagnostics | ( | ) | const |
Find the statement that was executed at or immediately before this node.
Useful when any nearby statement will do. If the statement belongs to a body-farmed definition, retrieve the call site for that definition.
Definition at line 387 of file ExplodedGraph.cpp.
Referenced by clang::ento::PathSensitiveBugReport::Profile().
|
inline |
Definition at line 210 of file ExplodedGraph.h.
References pred_begin(), and pred_empty().
Referenced by annotateStartParameter(), clang::ento::CoreEngine::dispatchWorkItem(), GetAllocationSite(), getCalleeNode(), getFirstPred(), getPreviousStmtForDiagnostics(), isTrivial(), clang::ento::taint::TaintBugVisitor::VisitNode(), clang::ento::FindLastStoreBRVisitor::VisitNode(), clang::ento::TrackConstraintBRVisitor::VisitNode(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), clang::ento::ConditionBRVisitor::VisitNodeImpl(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
|
inline |
Definition at line 214 of file ExplodedGraph.h.
References getFirstPred().
|
inline |
Definition at line 218 of file ExplodedGraph.h.
References succ_begin(), and succ_empty().
Referenced by llvm::GraphTraits< clang::ento::ExplodedGraph * >::child_end(), getFirstSucc(), getNextStmtForDiagnostics(), and llvm::GraphTraits< clang::ento::ExplodedGraph * >::predecessorOfTrivial().
|
inline |
Definition at line 222 of file ExplodedGraph.h.
References getFirstSucc().
|
inline |
Definition at line 263 of file ExplodedGraph.h.
References Id.
Referenced by clang::ento::ExplodedGraph::trim().
|
inline |
getLocation - Returns the edge associated with the given node.
Definition at line 144 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::dispatchWorkItem(), clang::ento::WorkList::enqueue(), clang::ento::CoreEngine::enqueueStmtNode(), clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(), GetAllocationSite(), getCFGBlock(), getLocationContext(), clang::ento::CheckerContext::getLocationRegionIfPostStore(), clang::ento::StackHintGeneratorForSymbol::getMessage(), getStackFrame(), clang::ento::PathSensitiveBugReport::getStmt(), getStmtForDiagnostics(), clang::ento::ExprEngine::processCFGBlockEntrance(), clang::ento::ExprEngine::processEndOfFunction(), clang::ento::ExplodedGraph::trim(), clang::ento::ExprEngine::VisitLogicalExpr(), clang::ento::TrackConstraintBRVisitor::VisitNode(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), clang::ento::UndefOrNullArgVisitor::VisitNode(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), clang::ento::TagVisitor::VisitNode(), clang::ento::ConditionBRVisitor::VisitNodeImpl(), and clang::ento::ExprEngine::VisitObjCMessage().
|
inline |
Definition at line 172 of file ExplodedGraph.h.
Referenced by annotateStartParameter(), clang::ento::FindLastStoreBRVisitor::VisitNode(), clang::ento::NilReceiverBRVisitor::VisitNode(), and clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode().
|
inline |
Definition at line 146 of file ExplodedGraph.h.
References getLocation(), and clang::ProgramPoint::getLocationContext().
Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkEndFunction(), clang::ento::ExprEngine::CreateCXXTemporaryObject(), clang::ento::CoreEngine::enqueueStmtNode(), clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(), clang::ento::FalsePositiveRefutationBRVisitor::finalizeVisitor(), clang::ento::BranchNodeBuilder::generateNode(), GetAllocationSite(), getAnalysis(), getCFG(), getCodeDecl(), clang::ento::CheckerContext::getCurrentAnalysisDeclContext(), clang::ento::PathSensitiveBugReport::getDeclWithIssue(), clang::ento::CheckerContext::getLocationContext(), clang::ento::IndirectGotoNodeBuilder::getLocationContext(), clang::ento::SwitchNodeBuilder::getLocationContext(), getParentMap(), getStmtForDiagnostics(), clang::ento::ConditionBRVisitor::patternMatch(), clang::ento::ExprEngine::ProcessAutomaticObjDtor(), clang::ento::ExprEngine::ProcessBaseDtor(), clang::ento::ExprEngine::processBranch(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::processCFGBlockEntrance(), clang::ento::ExprEngine::processCFGElement(), clang::ento::ExprEngine::processCleanupTemporaryBranch(), clang::ento::ExprEngine::ProcessDeleteDtor(), clang::ento::ExprEngine::processEndOfFunction(), clang::ento::ExprEngine::ProcessInitializer(), clang::ento::ExprEngine::ProcessMemberDtor(), clang::ento::ExprEngine::ProcessNewAllocator(), clang::ento::retaincountchecker::RetainCountChecker::processObjCLiterals(), clang::ento::ExprEngine::ProcessStmt(), clang::ento::ExprEngine::ProcessTemporaryDtor(), clang::ento::ExprEngine::removeDeadOnEndOfFunction(), clang::ento::CheckerManager::runCheckersForEndFunction(), clang::ento::updateLoopStack(), clang::ento::ExprEngine::VisitBlockExpr(), clang::ento::ExprEngine::VisitCallExpr(), clang::ento::ExprEngine::VisitCast(), clang::ento::ExprEngine::VisitCommonDeclRefExpr(), clang::ento::ExprEngine::VisitCompoundLiteralExpr(), clang::ento::ConditionBRVisitor::VisitConditionVariable(), clang::ento::ExprEngine::VisitCXXCatchStmt(), clang::ento::ExprEngine::VisitCXXDeleteExpr(), clang::ento::ExprEngine::VisitCXXNewAllocatorCall(), clang::ento::ExprEngine::VisitCXXNewExpr(), clang::ento::ExprEngine::VisitCXXThisExpr(), clang::ento::ExprEngine::VisitDeclStmt(), clang::ento::ExprEngine::VisitGCCAsmStmt(), clang::ento::ExprEngine::VisitGuardedExpr(), clang::ento::ExprEngine::VisitIncrementDecrementOperator(), clang::ento::ExprEngine::VisitInitListExpr(), clang::ento::ExprEngine::VisitLambdaExpr(), clang::ento::ExprEngine::VisitLogicalExpr(), clang::ento::ExprEngine::VisitLvalObjCIvarRefExpr(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), clang::ento::ExprEngine::VisitObjCMessage(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
const Stmt * ExplodedNode::getNextStmtForDiagnostics | ( | ) | const |
Find the next statement that was executed on this node's execution path.
Useful for explaining control flow that follows the current node. If the statement belongs to a body-farmed definition, retrieve the call site for that definition.
Definition at line 352 of file ExplodedGraph.cpp.
References getFirstSucc().
|
inline |
Definition at line 160 of file ExplodedGraph.h.
References getLocationContext(), and clang::LocationContext::getParentMap().
const Stmt * ExplodedNode::getPreviousStmtForDiagnostics | ( | ) | const |
Find the statement that was executed immediately before this node.
Useful when the node corresponds to a CFG block entrance. If the statement belongs to a body-farmed definition, retrieve the call site for that definition.
Definition at line 379 of file ExplodedGraph.cpp.
References getFirstPred().
|
inline |
Definition at line 150 of file ExplodedGraph.h.
References getLocation(), and clang::ProgramPoint::getStackFrame().
Referenced by annotateConsumedSummaryMismatch(), getCalleeNode(), clang::ento::CheckerContext::getStackFrame(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::processEndOfFunction(), and clang::ento::FindLastStoreBRVisitor::VisitNode().
|
inline |
Definition at line 169 of file ExplodedGraph.h.
References State.
Referenced by clang::ento::FalsePositiveRefutationBRVisitor::addConstraints(), annotateConsumedSummaryMismatch(), annotateStartParameter(), clang::ento::mpi::MPIChecker::checkDoubleNonblocking(), clang::ento::retaincountchecker::RetainCountChecker::checkEndFunction(), clang::ento::CheckerContext::CheckerContext(), clang::ento::ExprEngine::CreateCXXTemporaryObject(), clang::ento::ExprEngine::defaultEvalCall(), clang::ento::CoreEngine::enqueueStmtNode(), clang::ento::ExprEngine::evalEagerlyAssumeBinOpBifurcation(), GetAllocationSite(), clang::ento::retaincountchecker::RefLeakReportVisitor::getEndPath(), clang::ento::StackHintGeneratorForSymbol::getMessage(), clang::ento::CheckerContext::getState(), isTrivial(), clang::ento::PathSensitiveBugReport::PathSensitiveBugReport(), clang::ento::ConditionBRVisitor::patternMatch(), clang::ento::ExprEngine::ProcessAutomaticObjDtor(), clang::ento::ExprEngine::ProcessBaseDtor(), clang::ento::ExprEngine::processBranch(), clang::ento::ExprEngine::processCallEnter(), clang::ento::ExprEngine::processCallExit(), clang::ento::ExprEngine::processCFGBlockEntrance(), clang::ento::ExprEngine::processCleanupTemporaryBranch(), clang::ento::ExprEngine::ProcessDeleteDtor(), clang::ento::ExprEngine::processEndOfFunction(), clang::ento::ExprEngine::ProcessInitializer(), clang::ento::ExprEngine::ProcessMemberDtor(), clang::ento::ExprEngine::ProcessNewAllocator(), clang::ento::ExprEngine::ProcessTemporaryDtor(), clang::ento::ExprEngine::removeDead(), clang::ento::updateLoopStack(), clang::ento::ExprEngine::VisitBlockExpr(), clang::ento::ExprEngine::VisitCallExpr(), clang::ento::ExprEngine::VisitCast(), clang::ento::ExprEngine::VisitCommonDeclRefExpr(), clang::ento::ExprEngine::VisitCompoundLiteralExpr(), clang::ento::ExprEngine::VisitCXXCatchStmt(), clang::ento::ExprEngine::VisitCXXDeleteExpr(), clang::ento::ExprEngine::VisitCXXNewAllocatorCall(), clang::ento::ExprEngine::VisitCXXNewExpr(), clang::ento::ExprEngine::VisitCXXThisExpr(), clang::ento::ExprEngine::VisitDeclStmt(), clang::ento::ExprEngine::VisitGCCAsmStmt(), clang::ento::ExprEngine::VisitGuardedExpr(), clang::ento::ExprEngine::VisitIncrementDecrementOperator(), clang::ento::ExprEngine::VisitInitListExpr(), clang::ento::ExprEngine::VisitLambdaExpr(), clang::ento::ExprEngine::VisitLogicalExpr(), clang::ento::ExprEngine::VisitLvalObjCIvarRefExpr(), clang::ento::ExprEngine::VisitMSAsmStmt(), clang::ento::taint::TaintBugVisitor::VisitNode(), clang::ento::FindLastStoreBRVisitor::VisitNode(), clang::ento::retaincountchecker::RefCountReportVisitor::VisitNode(), clang::ento::UndefOrNullArgVisitor::VisitNode(), clang::ento::SuppressInlineDefensiveChecksVisitor::VisitNode(), clang::ento::ExprEngine::VisitObjCMessage(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
const Stmt * ExplodedNode::getStmtForDiagnostics | ( | ) | const |
If the node's program point corresponds to a statement, retrieve that statement.
Useful for figuring out where to put a warning or a note. If the statement belongs to a body-farmed definition, retrieve the call site for that definition.
Definition at line 321 of file ExplodedGraph.cpp.
References findTopAutosynthesizedParentContext(), clang::LocationContext::getAnalysisDeclContext(), getLocation(), getLocationContext(), clang::AnalysisDeclContext::isBodyAutosynthesized(), and P.
Get the value of an arbitrary expression at this node.
Definition at line 177 of file ExplodedGraph.h.
Referenced by clang::ento::CheckerContext::getCalleeDecl(), clang::ento::StackHintGeneratorForSymbol::getMessage(), and clang::ento::retaincountchecker::RetainCountChecker::processObjCLiterals().
|
inline |
Definition at line 206 of file ExplodedGraph.h.
References pred_size().
Referenced by clang::ento::CoreEngine::dispatchWorkItem().
|
inline |
Definition at line 204 of file ExplodedGraph.h.
Referenced by clang::ento::CoreEngine::enqueueStmtNode(), ExplodedNode(), clang::ento::NodeBuilderWithSinks::generateSink(), Profile(), and clang::ento::ExplodedGraph::trim().
bool ExplodedNode::isTrivial | ( | ) | const |
The node is trivial if it has only one successor, only one predecessor, it's predecessor has only one successor, and its program state is the same as the program state of the previous node.
Trivial nodes may be skipped while printing exploded graph.
Definition at line 285 of file ExplodedGraph.cpp.
References getFirstPred(), getState(), pred_size(), and succ_size().
Referenced by llvm::GraphTraits< clang::ento::ExplodedGraph * >::predecessorOfTrivial().
|
inline |
Definition at line 239 of file ExplodedGraph.h.
Referenced by alreadyExecutedAtLeastOneLoopIteration(), getFirstPred(), pred_begin(), clang::ento::ExprEngine::VisitGuardedExpr(), and clang::ento::ExprEngine::VisitLogicalExpr().
|
inline |
Definition at line 243 of file ExplodedGraph.h.
References pred_begin().
|
inline |
Definition at line 202 of file ExplodedGraph.h.
Referenced by getFirstPred(), and clang::ento::isPossiblyEscaped().
|
inline |
Definition at line 240 of file ExplodedGraph.h.
Referenced by pred_end().
|
inline |
Definition at line 246 of file ExplodedGraph.h.
References pred_end().
|
inline |
Definition at line 200 of file ExplodedGraph.h.
Referenced by hasSinglePred(), isTrivial(), and clang::ento::ExprEngine::VisitLogicalExpr().
|
inline |
Definition at line 241 of file ExplodedGraph.h.
|
inline |
Definition at line 249 of file ExplodedGraph.h.
|
inline |
Definition at line 190 of file ExplodedGraph.h.
|
inlinestatic |
Definition at line 181 of file ExplodedGraph.h.
References state.
Referenced by clang::ento::ExplodedGraph::getNode(), and Profile().
|
inline |
Definition at line 251 of file ExplodedGraph.h.
Referenced by llvm::GraphTraits< clang::ento::ExplodedGraph * >::child_begin(), getFirstSucc(), and succ_begin().
|
inline |
Definition at line 255 of file ExplodedGraph.h.
References succ_begin().
|
inline |
Definition at line 201 of file ExplodedGraph.h.
Referenced by getFirstSucc().
|
inline |
Definition at line 252 of file ExplodedGraph.h.
Referenced by llvm::GraphTraits< clang::ento::ExplodedGraph * >::child_end(), and succ_end().
|
inline |
Definition at line 258 of file ExplodedGraph.h.
References succ_end().
|
inline |
Definition at line 199 of file ExplodedGraph.h.
Referenced by isTrivial(), and llvm::GraphTraits< clang::ento::ExplodedGraph * >::predecessorOfTrivial().
|
inline |
Definition at line 253 of file ExplodedGraph.h.
|
inline |
Definition at line 261 of file ExplodedGraph.h.
|
friend |
Definition at line 66 of file ExplodedGraph.h.
|
friend |
Definition at line 67 of file ExplodedGraph.h.
|
friend |
Definition at line 68 of file ExplodedGraph.h.
|
friend |
Definition at line 69 of file ExplodedGraph.h.
|
friend |
Definition at line 70 of file ExplodedGraph.h.
|
friend |
Definition at line 71 of file ExplodedGraph.h.
|
friend |
Definition at line 72 of file ExplodedGraph.h.