void CoreEngine::dispatchWorkItem(ExplodedNode* Pred, ProgramPoint Loc, const WorkListUnit& WU) { // Dispatch on the location type. switch (Loc.getKind()) { case ProgramPoint::BlockEdgeKind: HandleBlockEdge(cast<BlockEdge>(Loc), Pred); break; case ProgramPoint::BlockEntranceKind: HandleBlockEntrance(cast<BlockEntrance>(Loc), Pred); break; case ProgramPoint::BlockExitKind: assert (false && "BlockExit location never occur in forward analysis."); break; case ProgramPoint::CallEnterKind: { CallEnter CEnter = cast<CallEnter>(Loc); if (AnalyzedCallees) if (const CallExpr* CE = dyn_cast_or_null<CallExpr>(CEnter.getCallExpr())) if (const Decl *CD = CE->getCalleeDecl()) AnalyzedCallees->insert(CD); SubEng.processCallEnter(CEnter, Pred); break; } case ProgramPoint::CallExitBeginKind: SubEng.processCallExit(Pred); break; case ProgramPoint::EpsilonKind: { assert(Pred->hasSinglePred() && "Assume epsilon has exactly one predecessor by construction"); ExplodedNode *PNode = Pred->getFirstPred(); dispatchWorkItem(Pred, PNode->getLocation(), WU); break; } default: assert(isa<PostStmt>(Loc) || isa<PostInitializer>(Loc) || isa<CallExitEnd>(Loc)); HandlePostStmt(WU.getBlock(), WU.getIndex(), Pred); break; } }
void CoreEngine::dispatchWorkItem(ExplodedNode* Pred, ProgramPoint Loc, const WorkListUnit& WU) { // Dispatch on the location type. switch (Loc.getKind()) { case ProgramPoint::BlockEdgeKind: HandleBlockEdge(Loc.castAs<BlockEdge>(), Pred); break; case ProgramPoint::BlockEntranceKind: HandleBlockEntrance(Loc.castAs<BlockEntrance>(), Pred); break; case ProgramPoint::BlockExitKind: assert (false && "BlockExit location never occur in forward analysis."); break; case ProgramPoint::CallEnterKind: { CallEnter CEnter = Loc.castAs<CallEnter>(); SubEng.processCallEnter(CEnter, Pred); break; } case ProgramPoint::CallExitBeginKind: SubEng.processCallExit(Pred); break; case ProgramPoint::EpsilonKind: { assert(Pred->hasSinglePred() && "Assume epsilon has exactly one predecessor by construction"); ExplodedNode *PNode = Pred->getFirstPred(); dispatchWorkItem(Pred, PNode->getLocation(), WU); break; } default: assert(Loc.getAs<PostStmt>() || Loc.getAs<PostInitializer>() || Loc.getAs<PostImplicitCall>() || Loc.getAs<CallExitEnd>()); HandlePostStmt(WU.getBlock(), WU.getIndex(), Pred); break; } }
virtual bool visit(const WorkListUnit &U) { ProgramPoint P = U.getNode()->getLocation(); const CFGBlock *B = 0; if (Optional<StmtPoint> SP = P.getAs<StmtPoint>()) { B = CBM->getBlock(SP->getStmt()); } else if (Optional<BlockEdge> BE = P.getAs<BlockEdge>()) { B = BE->getDst(); } else if (Optional<BlockEntrance> BEnt = P.getAs<BlockEntrance>()) { B = BEnt->getBlock(); } else if (Optional<BlockExit> BExit = P.getAs<BlockExit>()) { B = BExit->getBlock(); } if (!B) return true; return B == TargetBlock || CRA.isReachable(B, TargetBlock); }
virtual bool visit(const WorkListUnit &U) { ProgramPoint P = U.getNode()->getLocation(); const CFGBlock *B = 0; if (StmtPoint *SP = dyn_cast<StmtPoint>(&P)) { B = CBM->getBlock(SP->getStmt()); } else if (BlockEdge *BE = dyn_cast<BlockEdge>(&P)) { B = BE->getDst(); } else if (BlockEntrance *BEnt = dyn_cast<BlockEntrance>(&P)) { B = BEnt->getBlock(); } else if (BlockExit *BExit = dyn_cast<BlockExit>(&P)) { B = BExit->getBlock(); } if (!B) return true; return B == TargetBlock || CRA.isReachable(B, TargetBlock); }