clang API Documentation

Public Types | Public Member Functions | Protected Member Functions
clang::ento::ExprEngine Class Reference

#include <ExprEngine.h>

Inheritance diagram for clang::ento::ExprEngine:
Inheritance graph
[legend]
Collaboration diagram for clang::ento::ExprEngine:
Collaboration graph
[legend]

List of all members.

Public Types

enum  InliningModes { Inline_Regular = 0, Inline_Minimal = 0x1 }
 The modes of inlining, which override the default analysis-wide settings. More...

Public Member Functions

 ExprEngine (AnalysisManager &mgr, bool gcEnabled, SetOfConstDecls *VisitedCalleesIn, FunctionSummariesTy *FS, InliningModes HowToInlineIn)
 ~ExprEngine ()
bool ExecuteWorkList (const LocationContext *L, unsigned Steps=150000)
 Returns true if there is still simulation state on the worklist.
bool ExecuteWorkListWithInitialState (const LocationContext *L, unsigned Steps, ProgramStateRef InitState, ExplodedNodeSet &Dst)
ASTContextgetContext () const
 getContext - Return the ASTContext associated with this analysis.
AnalysisManagergetAnalysisManager () override
CheckerManagergetCheckerManager () const
SValBuildergetSValBuilder ()
BugReportergetBugReporter ()
const NodeBuilderContextgetBuilderContext ()
bool isObjCGCEnabled ()
const StmtgetStmt () const
void GenerateAutoTransition (ExplodedNode *N)
void enqueueEndOfPath (ExplodedNodeSet &S)
void GenerateCallExitNode (ExplodedNode *N)
void ViewGraph (bool trim=false)
 Visualize the ExplodedGraph created by executing the simulation.
void ViewGraph (ArrayRef< const ExplodedNode * > Nodes)
ProgramStateRef getInitialState (const LocationContext *InitLoc) override
ExplodedGraphgetGraph ()
const ExplodedGraphgetGraph () const
void removeDead (ExplodedNode *Node, ExplodedNodeSet &Out, const Stmt *ReferenceStmt, const LocationContext *LC, const Stmt *DiagnosticStmt=nullptr, ProgramPoint::Kind K=ProgramPoint::PreStmtPurgeDeadSymbolsKind)
 Run the analyzer's garbage collection - remove dead symbols and bindings from the state.
void processCFGElement (const CFGElement E, ExplodedNode *Pred, unsigned StmtIdx, NodeBuilderContext *Ctx) override
void ProcessStmt (const CFGStmt S, ExplodedNode *Pred)
void ProcessInitializer (const CFGInitializer I, ExplodedNode *Pred)
void ProcessImplicitDtor (const CFGImplicitDtor D, ExplodedNode *Pred)
void ProcessNewAllocator (const CXXNewExpr *NE, ExplodedNode *Pred)
void ProcessAutomaticObjDtor (const CFGAutomaticObjDtor D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void ProcessDeleteDtor (const CFGDeleteDtor D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void ProcessBaseDtor (const CFGBaseDtor D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void ProcessMemberDtor (const CFGMemberDtor D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void ProcessTemporaryDtor (const CFGTemporaryDtor D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void processCFGBlockEntrance (const BlockEdge &L, NodeBuilderWithSinks &nodeBuilder, ExplodedNode *Pred) override
 Called by CoreEngine when processing the entrance of a CFGBlock.
void processBranch (const Stmt *Condition, const Stmt *Term, NodeBuilderContext &BuilderCtx, ExplodedNode *Pred, ExplodedNodeSet &Dst, const CFGBlock *DstT, const CFGBlock *DstF) override
void processCleanupTemporaryBranch (const CXXBindTemporaryExpr *BTE, NodeBuilderContext &BldCtx, ExplodedNode *Pred, ExplodedNodeSet &Dst, const CFGBlock *DstT, const CFGBlock *DstF) override
void processStaticInitializer (const DeclStmt *DS, NodeBuilderContext &BuilderCtx, ExplodedNode *Pred, ExplodedNodeSet &Dst, const CFGBlock *DstT, const CFGBlock *DstF) override
void processIndirectGoto (IndirectGotoNodeBuilder &builder) override
void processSwitch (SwitchNodeBuilder &builder) override
void processEndOfFunction (NodeBuilderContext &BC, ExplodedNode *Pred) override
void removeDeadOnEndOfFunction (NodeBuilderContext &BC, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Remove dead bindings/symbols before exiting a function.
void processCallEnter (CallEnter CE, ExplodedNode *Pred) override
 Generate the entry node of the callee.
void processCallExit (ExplodedNode *Pred) override
void processEndWorklist (bool hasWorkRemaining) override
 Called by CoreEngine when the analysis worklist has terminated.
ProgramStateRef processAssume (ProgramStateRef state, SVal cond, bool assumption) override
bool wantsRegionChangeUpdate (ProgramStateRef state) override
ProgramStateRef processRegionChanges (ProgramStateRef state, const InvalidatedSymbols *invalidated, ArrayRef< const MemRegion * > ExplicitRegions, ArrayRef< const MemRegion * > Regions, const CallEvent *Call) override
void printState (raw_ostream &Out, ProgramStateRef State, const char *NL, const char *Sep) override
 printState - Called by ProgramStateManager to print checker-specific data.
ProgramStateManagergetStateManager () override
StoreManagergetStoreManager ()
ConstraintManagergetConstraintManager ()
BasicValueFactorygetBasicVals ()
SymbolManagergetSymbolManager ()
const SymbolManagergetSymbolManager () const
bool wasBlocksExhausted () const
bool hasEmptyWorkList () const
bool hasWorkRemaining () const
const CoreEnginegetCoreEngine () const
void Visit (const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitLvalArraySubscriptExpr (const ArraySubscriptExpr *Ex, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitArraySubscriptExpr - Transfer function for array accesses.
void VisitGCCAsmStmt (const GCCAsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitGCCAsmStmt - Transfer function logic for inline asm.
void VisitMSAsmStmt (const MSAsmStmt *A, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitMSAsmStmt - Transfer function logic for MS inline asm.
void VisitBlockExpr (const BlockExpr *BE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitBlockExpr - Transfer function logic for BlockExprs.
void VisitBinaryOperator (const BinaryOperator *B, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitBinaryOperator - Transfer function logic for binary operators.
void VisitCallExpr (const CallExpr *CE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitCall - Transfer function for function calls.
void VisitCast (const CastExpr *CastE, const Expr *Ex, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitCast - Transfer function logic for all casts (implicit and explicit).
void VisitCompoundLiteralExpr (const CompoundLiteralExpr *CL, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitCompoundLiteralExpr - Transfer function logic for compound literals.
void VisitCommonDeclRefExpr (const Expr *DR, const NamedDecl *D, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Transfer function logic for DeclRefExprs and BlockDeclRefExprs.
void VisitDeclStmt (const DeclStmt *DS, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitDeclStmt - Transfer function logic for DeclStmts.
void VisitGuardedExpr (const Expr *Ex, const Expr *L, const Expr *R, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitGuardedExpr - Transfer function logic for ?, __builtin_choose.
void VisitInitListExpr (const InitListExpr *E, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitLogicalExpr (const BinaryOperator *B, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitLogicalExpr - Transfer function logic for '&&', '||'.
void VisitMemberExpr (const MemberExpr *M, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitMemberExpr - Transfer function for member expressions.
void VisitObjCAtSynchronizedStmt (const ObjCAtSynchronizedStmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Transfer function logic for ObjCAtSynchronizedStmts.
void VisitLvalObjCIvarRefExpr (const ObjCIvarRefExpr *DR, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Transfer function logic for computing the lvalue of an Objective-C ivar.
void VisitObjCForCollectionStmt (const ObjCForCollectionStmt *S, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitObjCMessage (const ObjCMessageExpr *ME, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitReturnStmt (const ReturnStmt *R, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitReturnStmt - Transfer function logic for return statements.
void VisitOffsetOfExpr (const OffsetOfExpr *Ex, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitOffsetOfExpr - Transfer function for offsetof.
void VisitUnaryExprOrTypeTraitExpr (const UnaryExprOrTypeTraitExpr *Ex, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitUnaryExprOrTypeTraitExpr - Transfer function for sizeof.
void VisitUnaryOperator (const UnaryOperator *B, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 VisitUnaryOperator - Transfer function logic for unary operators.
void VisitIncrementDecrementOperator (const UnaryOperator *U, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Handle ++ and -- (both pre- and post-increment).
void VisitCXXBindTemporaryExpr (const CXXBindTemporaryExpr *BTE, ExplodedNodeSet &PreVisit, ExplodedNodeSet &Dst)
void VisitCXXCatchStmt (const CXXCatchStmt *CS, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXThisExpr (const CXXThisExpr *TE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXConstructExpr (const CXXConstructExpr *E, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXDestructor (QualType ObjectType, const MemRegion *Dest, const Stmt *S, bool IsBaseDtor, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXNewAllocatorCall (const CXXNewExpr *CNE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXNewExpr (const CXXNewExpr *CNE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXDeleteExpr (const CXXDeleteExpr *CDE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void CreateCXXTemporaryObject (const MaterializeTemporaryExpr *ME, ExplodedNode *Pred, ExplodedNodeSet &Dst)
 Create a C++ temporary object for an rvalue.
void evalEagerlyAssumeBinOpBifurcation (ExplodedNodeSet &Dst, ExplodedNodeSet &Src, const Expr *Ex)
std::pair< const
ProgramPointTag *, const
ProgramPointTag * > 
geteagerlyAssumeBinOpBifurcationTags ()
SVal evalMinus (SVal X)
SVal evalComplement (SVal X)
SVal evalBinOp (ProgramStateRef state, BinaryOperator::Opcode op, NonLoc L, NonLoc R, QualType T)
SVal evalBinOp (ProgramStateRef state, BinaryOperator::Opcode op, NonLoc L, SVal R, QualType T)
SVal evalBinOp (ProgramStateRef ST, BinaryOperator::Opcode Op, SVal LHS, SVal RHS, QualType T)
void evalLoad (ExplodedNodeSet &Dst, const Expr *NodeEx, const Expr *BoundExpr, ExplodedNode *Pred, ProgramStateRef St, SVal location, const ProgramPointTag *tag=nullptr, QualType LoadTy=QualType())
 Simulate a read of the result of Ex.
void evalStore (ExplodedNodeSet &Dst, const Expr *AssignE, const Expr *StoreE, ExplodedNode *Pred, ProgramStateRef St, SVal TargetLV, SVal Val, const ProgramPointTag *tag=nullptr)
ProgramStateRef bindReturnValue (const CallEvent &Call, const LocationContext *LCtx, ProgramStateRef State)
 Create a new state in which the call return value is binded to the call origin expression.
void evalCall (ExplodedNodeSet &Dst, ExplodedNode *Pred, const CallEvent &Call)
void defaultEvalCall (NodeBuilder &B, ExplodedNode *Pred, const CallEvent &Call)
 Default implementation of call evaluation.

Protected Member Functions

void evalBind (ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred, SVal location, SVal Val, bool atDeclInit=false, const ProgramPoint *PP=nullptr)
ProgramStateRef processPointerEscapedOnBind (ProgramStateRef State, SVal Loc, SVal Val) override
 Call PointerEscape callback when a value escapes as a result of bind.
ProgramStateRef notifyCheckersOfPointerEscape (ProgramStateRef State, const InvalidatedSymbols *Invalidated, ArrayRef< const MemRegion * > ExplicitRegions, ArrayRef< const MemRegion * > Regions, const CallEvent *Call, RegionAndSymbolInvalidationTraits &ITraits) override

Detailed Description

Definition at line 48 of file ExprEngine.h.


Member Enumeration Documentation

The modes of inlining, which override the default analysis-wide settings.

Enumerator:
Inline_Regular 

Follow the default settings for inlining callees.

Inline_Minimal 

Do minimal inlining of callees.

Definition at line 51 of file ExprEngine.h.


Constructor & Destructor Documentation

ExprEngine::ExprEngine ( AnalysisManager mgr,
bool  gcEnabled,
SetOfConstDecls VisitedCalleesIn,
FunctionSummariesTy FS,
InliningModes  HowToInlineIn 
)

Definition at line 69 of file ExprEngine.cpp.

Definition at line 95 of file ExprEngine.cpp.

References clang::ento::BugReporter::FlushReports().


Member Function Documentation

void ExprEngine::defaultEvalCall ( NodeBuilder B,
ExplodedNode Pred,
const CallEvent Call 
)
void ExprEngine::evalBind ( ExplodedNodeSet Dst,
const Stmt StoreE,
ExplodedNode Pred,
SVal  location,
SVal  Val,
bool  atDeclInit = false,
const ProgramPoint PP = nullptr 
) [protected]

evalBind - Handle the semantics of binding a value to a specific location. This method is used by evalStore, VisitDeclStmt, and others.

evalBind - Handle the semantics of binding a value to a specific location. This method is used by evalStore and (soon) VisitDeclStmt, and others.

Definition at line 2110 of file ExprEngine.cpp.

References clang::ento::ExplodedNodeSet::begin(), clang::ento::SVal::castAs(), clang::ento::ExplodedNodeSet::end(), clang::ento::StmtNodeBuilder::generateNode(), clang::ento::SVal::getAs(), getCheckerManager(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::ExplodedNode::getState(), processPointerEscapedOnBind(), and clang::ento::CheckerManager::runCheckersForBind().

Referenced by evalStore(), ProcessInitializer(), VisitCXXNewExpr(), and VisitDeclStmt().

Definition at line 483 of file ExprEngine.h.

References clang::ento::SValBuilder::evalBinOp().

void ExprEngine::evalCall ( ExplodedNodeSet Dst,
ExplodedNode Pred,
const CallEvent Call 
)

Evaluate a call, running pre- and post-call checks and allowing checkers to be responsible for handling the evaluation of the call itself.

Definition at line 510 of file ExprEngineCallAndReturn.cpp.

References getCheckerManager(), clang::ento::CheckerManager::runCheckersForEvalCall(), clang::ento::CheckerManager::runCheckersForPostCall(), and clang::ento::CheckerManager::runCheckersForPreCall().

Referenced by VisitCallExpr().

void ExprEngine::evalLoad ( ExplodedNodeSet Dst,
const Expr NodeEx,
const Expr BoundExpr,
ExplodedNode Pred,
ProgramStateRef  St,
SVal  location,
const ProgramPointTag tag = nullptr,
QualType  LoadTy = QualType() 
)
void ExprEngine::evalStore ( ExplodedNodeSet Dst,
const Expr AssignE,
const Expr LocationE,
ExplodedNode Pred,
ProgramStateRef  state,
SVal  location,
SVal  Val,
const ProgramPointTag tag = nullptr 
)

evalStore - Handle the semantics of a store via an assignment.

Parameters:
DstThe node set to store generated state nodes
AssignEThe assignment expression if the store happens in an assignment.
LocationEThe location expression that is stored to.
stateThe current simulation state
locationThe location to store the value
ValThe value to be stored

Definition at line 2172 of file ExprEngine.cpp.

References clang::ento::ExplodedNodeSet::begin(), clang::ento::ExplodedNodeSet::empty(), clang::ento::ExplodedNodeSet::end(), evalBind(), and clang::ento::SVal::isUndef().

Referenced by VisitBinaryOperator(), and VisitIncrementDecrementOperator().

bool clang::ento::ExprEngine::ExecuteWorkList ( const LocationContext L,
unsigned  Steps = 150000 
) [inline]

Returns true if there is still simulation state on the worklist.

Definition at line 108 of file ExprEngine.h.

References clang::ento::CoreEngine::ExecuteWorkList().

Execute the work list with an initial state. Nodes that reaches the exit of the function are added into the Dst set, which represent the exit state of the function call. Returns true if there is still simulation state on the worklist.

Definition at line 116 of file ExprEngine.h.

References clang::ento::CoreEngine::ExecuteWorkListWithInitialState().

Definition at line 320 of file ExprEngine.h.

Referenced by processCallExit().

Definition at line 2308 of file ExprEngine.cpp.

Referenced by evalEagerlyAssumeBinOpBifurcation().

Definition at line 159 of file ExprEngine.h.

Definition at line 160 of file ExprEngine.h.

ProgramStateRef ExprEngine::getInitialState ( const LocationContext InitLoc) [override, virtual]

Definition at line 312 of file ExprEngine.h.

Definition at line 313 of file ExprEngine.h.

Definition at line 318 of file ExprEngine.h.

References clang::ento::CoreEngine::hasWorkRemaining().

Definition at line 140 of file ExprEngine.h.

Referenced by clang::ento::CheckerContext::isObjCGCEnabled().

ProgramStateRef ExprEngine::notifyCheckersOfPointerEscape ( ProgramStateRef  State,
const InvalidatedSymbols Invalidated,
ArrayRef< const MemRegion * >  ExplicitRegions,
ArrayRef< const MemRegion * >  Regions,
const CallEvent Call,
RegionAndSymbolInvalidationTraits ITraits 
) [override, protected, virtual]

Call PointerEscape callback when a value escapes as a result of region invalidation.

Parameters:
[in]ITraitsSpecifies invalidation traits for regions/symbols.

Implements clang::ento::SubEngine.

Definition at line 2061 of file ExprEngine.cpp.

References clang::ento::MemRegion::getAs(), getCheckerManager(), clang::ento::PSK_DirectEscapeOnCall, clang::ento::PSK_EscapeOther, clang::ento::PSK_IndirectEscapeOnCall, clang::ento::CheckerManager::runCheckersForPointerEscape(), State, and clang::ento::MemRegion::StripCasts().

void ExprEngine::printState ( raw_ostream &  Out,
ProgramStateRef  State,
const char *  NL,
const char *  Sep 
) [override, virtual]

printState - Called by ProgramStateManager to print checker-specific data.

Implements clang::ento::SubEngine.

Definition at line 278 of file ExprEngine.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::runCheckersForPrintState().

ProgramStateRef ExprEngine::processAssume ( ProgramStateRef  state,
SVal  cond,
bool  assumption 
) [override, virtual]

evalAssume - Callback function invoked by the ConstraintManager when making assumptions about state values.

evalAssume - Called by ConstraintManager. Used to call checker-specific logic for handling assumptions on symbolic values.

Implements clang::ento::SubEngine.

Definition at line 259 of file ExprEngine.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::runCheckersForEvalAssume().

void ExprEngine::ProcessBaseDtor ( const CFGBaseDtor  D,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::processBranch ( const Stmt Condition,
const Stmt Term,
NodeBuilderContext BuilderCtx,
ExplodedNode Pred,
ExplodedNodeSet Dst,
const CFGBlock DstT,
const CFGBlock DstF 
) [override, virtual]
void ExprEngine::processCallEnter ( CallEnter  CE,
ExplodedNode Pred 
) [override, virtual]
void ExprEngine::processCallExit ( ExplodedNode CEBNode) [override, virtual]

Generate the sequence of nodes that simulate the call exit and the post visit for CallExpr.

The call exit is simulated with a sequence of nodes, which occur between CallExitBegin and CallExitEnd. The following operations occur between the two program points: 1. CallExitBegin (triggers the start of call exit sequence) 2. Bind the return value 3. Run Remove dead bindings to clean up the dead symbols from the callee. 4. CallExitEnd (switch to the caller context) 5. PostStmt<CallExpr>

Implements clang::ento::SubEngine.

Definition at line 218 of file ExprEngineCallAndReturn.cpp.

References clang::ento::ExplodedNodeSet::Add(), clang::ento::ExplodedNode::addPredecessor(), adjustReturnValue(), clang::AnalyzerOptions::AnalysisPurgeOpt, clang::ento::ExplodedNodeSet::begin(), clang::ento::SVal::castAs(), clang::ento::CallEventRef< T >::cloneWithState(), clang::ento::ExplodedNodeSet::end(), clang::ento::WorkList::enqueue(), clang::CallEventManager::getCaller(), clang::ento::ProgramStateManager::getCallEventManager(), getCheckerManager(), getCoreEngine(), clang::LocationContext::getCurrentStackFrame(), clang::ento::SValBuilder::getCXXThis(), clang::ento::CallEvent::getDeclaredResultType(), getLastStmt(), clang::ento::ExplodedNode::getLocationContext(), clang::ento::ExplodedGraph::getNode(), clang::LocationContext::getParent(), clang::ento::ExplodedNode::getState(), getStateManager(), getStoreManager(), clang::ento::CoreEngine::getWorkList(), clang::ento::ExplodedNodeSet::insert(), clang::QualType::isNull(), isTemporaryPRValue(), clang::ento::AnalysisManager::options, clang::ProgramPoint::PostStmtPurgeDeadSymbolsKind, removeDead(), clang::ento::CheckerManager::runCheckersForPostCall(), clang::ento::CheckerManager::runCheckersForPostObjCMessage(), clang::ento::CheckerManager::runCheckersForPostStmt(), and wasDifferentDeclUsedForInlining().

void ExprEngine::processCFGBlockEntrance ( const BlockEdge L,
NodeBuilderWithSinks nodeBuilder,
ExplodedNode Pred 
) [override, virtual]
void ExprEngine::processCFGElement ( const CFGElement  E,
ExplodedNode Pred,
unsigned  StmtIdx,
NodeBuilderContext Ctx 
) [override, virtual]
void ExprEngine::processCleanupTemporaryBranch ( const CXXBindTemporaryExpr BTE,
NodeBuilderContext BldCtx,
ExplodedNode Pred,
ExplodedNodeSet Dst,
const CFGBlock DstT,
const CFGBlock DstF 
) [override, virtual]

Called by CoreEngine. Used to generate successor nodes for temporary destructors depending on whether the corresponding constructor was visited.

Implements clang::ento::SubEngine.

Definition at line 695 of file ExprEngine.cpp.

References clang::ento::BranchNodeBuilder::generateNode(), clang::ento::ExplodedNode::getStackFrame(), clang::ento::ExplodedNode::getState(), and clang::ento::BranchNodeBuilder::markInfeasible().

void ExprEngine::processEndOfFunction ( NodeBuilderContext BC,
ExplodedNode Pred 
) [override, virtual]
void ExprEngine::processEndWorklist ( bool  hasWorkRemaining) [override, virtual]

Called by CoreEngine when the analysis worklist has terminated.

Implements clang::ento::SubEngine.

Definition at line 283 of file ExprEngine.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::runCheckersForEndAnalysis().

void ExprEngine::processIndirectGoto ( IndirectGotoNodeBuilder builder) [override, virtual]
void ExprEngine::ProcessNewAllocator ( const CXXNewExpr NE,
ExplodedNode Pred 
)
ProgramStateRef ExprEngine::processPointerEscapedOnBind ( ProgramStateRef  State,
SVal  Loc,
SVal  Val 
) [override, protected, virtual]

Call PointerEscape callback when a value escapes as a result of bind.

Implements clang::ento::SubEngine.

Definition at line 2019 of file ExprEngine.cpp.

References clang::ento::SVal::getAs(), getCheckerManager(), clang::ento::PSK_EscapeOnBind, clang::ento::CheckerManager::runCheckersForPointerEscape(), and State.

Referenced by evalBind().

ProgramStateRef ExprEngine::processRegionChanges ( ProgramStateRef  state,
const InvalidatedSymbols invalidated,
ArrayRef< const MemRegion * >  ExplicitRegions,
ArrayRef< const MemRegion * >  Regions,
const CallEvent Call 
) [override, virtual]

processRegionChanges - Called by ProgramStateManager whenever a change is made to the store. Used to update checkers that track region values.

Implements clang::ento::SubEngine.

Definition at line 269 of file ExprEngine.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::runCheckersForRegionChanges().

void clang::ento::ExprEngine::processStaticInitializer ( const DeclStmt DS,
NodeBuilderContext BuilderCtx,
ExplodedNode Pred,
ExplodedNodeSet Dst,
const CFGBlock DstT,
const CFGBlock DstF 
) [override, virtual]

Called by CoreEngine. Used to processing branching behavior at static initalizers.

Implements clang::ento::SubEngine.

void ExprEngine::ProcessStmt ( const CFGStmt  S,
ExplodedNode Pred 
)
void ExprEngine::processSwitch ( SwitchNodeBuilder builder) [override, virtual]
void ExprEngine::removeDead ( ExplodedNode Node,
ExplodedNodeSet Out,
const Stmt ReferenceStmt,
const LocationContext LC,
const Stmt DiagnosticStmt = nullptr,
ProgramPoint::Kind  K = ProgramPoint::PreStmtPurgeDeadSymbolsKind 
)

Run the analyzer's garbage collection - remove dead symbols and bindings from the state.

Checkers can participate in this process with two callbacks: checkLiveSymbols and checkDeadSymbols. See the CheckerDocumentation class for more information.

Parameters:
NodeThe predecessor node, from which the processing should start.
OutThe returned set of output nodes.
ReferenceStmtThe statement which is about to be processed. Everything needed for this statement should be considered live. A null statement means that everything in child LocationContexts is dead.
LCThe location context of the ReferenceStmt. A null location context means that we have reached the end of analysis and that all statements and local variables should be considered dead.
DiagnosticStmtUsed as a location for any warnings that should occur while removing the dead (e.g. leaks). By default, the ReferenceStmt is used.
KDenotes whether this is a pre- or post-statement purge. This must only be ProgramPoint::PostStmtPurgeDeadSymbolsKind if an entire location context is being cleared, in which case the ReferenceStmt must either be a ReturnStmt or NULL. Otherwise, it must be ProgramPoint::PreStmtPurgeDeadSymbolsKind (the default) and ReferenceStmt must be valid (non-null).

Definition at line 341 of file ExprEngine.cpp.

References clang::ento::ExplodedNodeSet::begin(), clang::ento::ExplodedNodeSet::end(), clang::ento::StmtNodeBuilder::generateNode(), getCheckerManager(), getConstraintManager(), clang::LocationContext::getCurrentStackFrame(), clang::LocationContext::getParent(), clang::ento::ProgramStateManager::getPersistentStateWithGDM(), clang::ento::ExplodedNode::getState(), getStoreManager(), clang::ento::SymbolReaper::hasDeadSymbols(), clang::ento::ProgramStateManager::haveEqualEnvironments(), clang::ento::ProgramStateManager::haveEqualStores(), clang::ProgramPoint::PostStmtPurgeDeadSymbolsKind, clang::ProgramPoint::PreStmtPurgeDeadSymbolsKind, clang::ento::ConstraintManager::removeDeadBindings(), clang::ento::ProgramStateManager::removeDeadBindings(), clang::ento::CheckerManager::runCheckersForDeadSymbols(), and clang::ento::CheckerManager::runCheckersForLiveSymbols().

Referenced by processCallExit(), ProcessStmt(), and removeDeadOnEndOfFunction().

void ExprEngine::ViewGraph ( bool  trim = false)
void ExprEngine::ViewGraph ( ArrayRef< const ExplodedNode * >  Nodes)

Visualize a trimmed ExplodedGraph that only contains paths to the given nodes.

Definition at line 2691 of file ExprEngine.cpp.

References getContext(), clang::ASTContext::getSourceManager(), GraphPrintCheckerState, GraphPrintSourceManager, clang::ento::ExplodedGraph::trim(), and ViewGraph().

void ExprEngine::Visit ( const Stmt S,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

Visit - Transfer function logic for all statements. Dispatches to other functions that handle specific kinds of statements.

Definition at line 738 of file ExprEngine.cpp.

References clang::ento::CoreEngine::addAbortedBlock(), clang::ento::NodeBuilder::addNodes(), clang::ento::ExplodedNodeSet::begin(), clang::ento::NodeBuilderContext::blockCount(), clang::BO_Comma, clang::CompoundStmt::body_empty(), clang::CompoundStmt::body_rbegin(), AttributeLangSupport::C, clang::ento::SValBuilder::conjureSymbolVal(), CreateCXXTemporaryObject(), clang::AnalyzerOptions::eagerlyAssumeBinOpBifurcation, clang::ento::ExplodedNodeSet::end(), evalEagerlyAssumeBinOpBifurcation(), clang::ento::StmtNodeBuilder::generateNode(), clang::ento::StmtNodeBuilder::generateSink(), clang::CallExpr::getArg(), clang::ento::NodeBuilderContext::getBlock(), clang::CallExpr::getCalleeDecl(), getCheckerManager(), clang::ento::SValBuilder::getConstantVal(), getContext(), clang::DeclRefExpr::getDecl(), clang::AbstractConditionalOperator::getFalseExpr(), clang::ChooseExpr::getLHS(), clang::ento::ExplodedNode::getLocationContext(), clang::Stmt::getLocStart(), clang::UnaryOperator::getOpcode(), clang::BinaryOperator::getOpcode(), clang::PseudoObjectExpr::getResultExpr(), clang::BinaryOperator::getRHS(), clang::ChooseExpr::getRHS(), clang::ento::ExplodedNode::getState(), clang::Stmt::getStmtClass(), clang::CastExpr::getSubExpr(), clang::StmtExpr::getSubStmt(), clang::AbstractConditionalOperator::getTrueExpr(), clang::Expr::getType(), clang::BinaryOperator::isEqualityOp(), clang::BinaryOperator::isLogicalOp(), clang::BinaryOperator::isRelationalOp(), clang::ento::SValBuilder::makeIntValWithPtrWidth(), clang::Stmt::NoStmtClass, clang::ento::AnalysisManager::options, clang::ProgramPoint::PreStmtKind, clang::ento::CheckerManager::runCheckersForPostStmt(), clang::ento::CheckerManager::runCheckersForPreStmt(), S, clang::ento::NodeBuilder::takeNodes(), clang::UO_LNot, VisitBinaryOperator(), VisitBlockExpr(), VisitCallExpr(), VisitCast(), VisitCommonDeclRefExpr(), VisitCompoundLiteralExpr(), VisitCXXBindTemporaryExpr(), VisitCXXCatchStmt(), VisitCXXConstructExpr(), VisitCXXDeleteExpr(), VisitCXXNewExpr(), VisitCXXThisExpr(), VisitDeclStmt(), VisitGCCAsmStmt(), VisitGuardedExpr(), VisitInitListExpr(), VisitLogicalExpr(), VisitLvalArraySubscriptExpr(), VisitLvalObjCIvarRefExpr(), VisitMemberExpr(), VisitMSAsmStmt(), VisitObjCAtSynchronizedStmt(), VisitObjCForCollectionStmt(), VisitObjCMessage(), VisitOffsetOfExpr(), VisitReturnStmt(), VisitUnaryExprOrTypeTraitExpr(), VisitUnaryOperator(), and clang::ASTContext::VoidTy.

Referenced by ProcessStmt().

void ExprEngine::VisitBlockExpr ( const BlockExpr BE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCallExpr ( const CallExpr CE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCast ( const CastExpr CastE,
const Expr Ex,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

VisitCast - Transfer function logic for all casts (implicit and explicit).

Definition at line 227 of file ExprEngineC.cpp.

References clang::ento::ExplodedNodeSet::begin(), clang::ento::NodeBuilderContext::blockCount(), clang::CK_AddressSpaceConversion, clang::CK_AnyPointerToBlockPointerCast, clang::CK_ARCConsumeObject, clang::CK_ARCExtendBlockObject, clang::CK_ARCProduceObject, clang::CK_ARCReclaimReturnedObject, clang::CK_ArrayToPointerDecay, clang::CK_AtomicToNonAtomic, clang::CK_BaseToDerived, clang::CK_BaseToDerivedMemberPointer, clang::CK_BitCast, clang::CK_BlockPointerToObjCPointerCast, clang::CK_BuiltinFnToFnPtr, clang::CK_ConstructorConversion, clang::CK_CopyAndAutoreleaseBlockObject, clang::CK_CPointerToObjCPointerCast, clang::CK_Dependent, clang::CK_DerivedToBase, clang::CK_DerivedToBaseMemberPointer, clang::CK_Dynamic, clang::CK_FloatingCast, clang::CK_FloatingComplexCast, clang::CK_FloatingComplexToBoolean, clang::CK_FloatingComplexToIntegralComplex, clang::CK_FloatingComplexToReal, clang::CK_FloatingRealToComplex, clang::CK_FloatingToBoolean, clang::CK_FloatingToIntegral, clang::CK_FunctionToPointerDecay, clang::CK_IntegralCast, clang::CK_IntegralComplexCast, clang::CK_IntegralComplexToBoolean, clang::CK_IntegralComplexToFloatingComplex, clang::CK_IntegralComplexToReal, clang::CK_IntegralRealToComplex, clang::CK_IntegralToBoolean, clang::CK_IntegralToFloating, clang::CK_IntegralToPointer, clang::CK_LValueBitCast, clang::CK_LValueToRValue, clang::CK_MemberPointerToBoolean, clang::CK_NonAtomicToAtomic, clang::CK_NoOp, clang::CK_NullToMemberPointer, clang::CK_NullToPointer, clang::CK_ObjCObjectLValueCast, clang::CK_PointerToBoolean, clang::CK_PointerToIntegral, clang::CK_ReinterpretMemberPointer, clang::CK_ToUnion, clang::CK_ToVoid, clang::CK_UncheckedDerivedToBase, clang::CK_UserDefinedConversion, clang::CK_VectorSplat, clang::CK_ZeroToOCLEvent, clang::ento::SValBuilder::conjureSymbolVal(), clang::ento::ExplodedNodeSet::end(), clang::ento::SValBuilder::evalCast(), clang::ento::StoreManager::evalDerivedToBase(), clang::ento::StoreManager::evalDynamicCast(), evalLoad(), clang::ento::StmtNodeBuilder::generateNode(), clang::ento::StmtNodeBuilder::generateSink(), clang::CastExpr::getCastKind(), getCheckerManager(), getContext(), clang::ento::ExplodedNode::getLocationContext(), clang::ASTContext::getPointerType(), clang::ento::ExplodedNode::getState(), getStoreManager(), clang::Expr::getType(), clang::Expr::isGLValue(), clang::Type::isReferenceType(), clang::ento::SVal::isUnknown(), clang::ento::SVal::isZeroConstant(), clang::ento::SValBuilder::makeNull(), and clang::ento::CheckerManager::runCheckersForPreStmt().

Referenced by Visit().

void ExprEngine::VisitCommonDeclRefExpr ( const Expr DR,
const NamedDecl D,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

Definition at line 712 of file ExprEngine.cpp.

References clang::ento::StmtNodeBuilder::generateNode(), getAnalysisManager(), and Node.

Referenced by Visit().

void ExprEngine::VisitCXXCatchStmt ( const CXXCatchStmt CS,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

Definition at line 177 of file ExprEngineCXX.cpp.

References clang::ento::ExplodedNodeSet::Add(), clang::ento::ExplodedNodeSet::begin(), clang::CXXConstructExpr::CK_Complete, clang::CXXConstructExpr::CK_Delegating, clang::CXXConstructExpr::CK_NonVirtualBase, clang::CXXConstructExpr::CK_VirtualBase, defaultEvalCall(), clang::ento::ExplodedNodeSet::end(), clang::ento::StoreManager::evalDerivedToBase(), clang::ento::StmtNodeBuilder::generateNode(), clang::ento::SVal::getAsRegion(), clang::ento::ProgramStateManager::getCallEventManager(), clang::StackFrameContext::getCallSite(), getCheckerManager(), clang::CXXConstructExpr::getConstructionKind(), clang::CXXConstructExpr::getConstructor(), getContext(), clang::LocationContext::getCurrentStackFrame(), clang::CallEventManager::getCXXConstructorCall(), clang::ento::SValBuilder::getCXXThis(), clang::LocationContext::getDecl(), clang::ento::ExplodedNode::getLocationContext(), getRegionForConstructedObject(), clang::ento::ExplodedNode::getState(), getStateManager(), getStoreManager(), getSValBuilder(), clang::Expr::getType(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), clang::FunctionDecl::isTrivial(), clang::ento::SValBuilder::makeZeroVal(), clang::ProgramPoint::PreStmtKind, clang::CXXConstructExpr::requiresZeroInitialization(), clang::ento::CheckerManager::runCheckersForPostCall(), clang::ento::CheckerManager::runCheckersForPostStmt(), clang::ento::CheckerManager::runCheckersForPreCall(), and clang::ento::CheckerManager::runCheckersForPreStmt().

Referenced by Visit().

void ExprEngine::VisitCXXDeleteExpr ( const CXXDeleteExpr CDE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCXXDestructor ( QualType  ObjectType,
const MemRegion Dest,
const Stmt S,
bool  IsBaseDtor,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCXXNewAllocatorCall ( const CXXNewExpr CNE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCXXNewExpr ( const CXXNewExpr CNE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitCXXThisExpr ( const CXXThisExpr TE,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitDeclStmt ( const DeclStmt DS,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitGCCAsmStmt ( const GCCAsmStmt A,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitGuardedExpr ( const Expr Ex,
const Expr L,
const Expr R,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitInitListExpr ( const InitListExpr E,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitLogicalExpr ( const BinaryOperator B,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitMemberExpr ( const MemberExpr M,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitMSAsmStmt ( const MSAsmStmt A,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

VisitMSAsmStmt - Transfer function logic for MS inline asm.

Definition at line 2383 of file ExprEngine.cpp.

References clang::ento::StmtNodeBuilder::generateNode(), and clang::ento::ExplodedNode::getState().

Referenced by Visit().

Transfer function logic for ObjCAtSynchronizedStmts.

Definition at line 39 of file ExprEngineObjC.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::runCheckersForPreStmt().

Referenced by Visit().

void ExprEngine::VisitObjCMessage ( const ObjCMessageExpr ME,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitOffsetOfExpr ( const OffsetOfExpr Ex,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitReturnStmt ( const ReturnStmt R,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)
void ExprEngine::VisitUnaryOperator ( const UnaryOperator B,
ExplodedNode Pred,
ExplodedNodeSet Dst 
)

wantsRegionChangeUpdate - Called by ProgramStateManager to determine if a region change should trigger a processRegionChanges update.

Implements clang::ento::SubEngine.

Definition at line 264 of file ExprEngine.cpp.

References getCheckerManager(), and clang::ento::CheckerManager::wantsRegionChangeUpdate().

Definition at line 316 of file ExprEngine.h.

References clang::ento::CoreEngine::wasBlocksExhausted().


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