ExprEngineCallAndReturn.cpp revision e90d3f847dcce76237078b67db8895eb7a24189e
1//=-- ExprEngineCallAndReturn.cpp - Support for call/return -----*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines ExprEngine's support for calls and returns. 11// 12//===----------------------------------------------------------------------===// 13 14#define DEBUG_TYPE "ExprEngine" 15 16#include "clang/Analysis/Analyses/LiveVariables.h" 17#include "clang/StaticAnalyzer/Core/CheckerManager.h" 18#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" 19#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" 20#include "clang/AST/DeclCXX.h" 21#include "llvm/ADT/SmallSet.h" 22#include "llvm/ADT/Statistic.h" 23#include "llvm/Support/SaveAndRestore.h" 24 25#define CXX_INLINING_ENABLED 1 26 27using namespace clang; 28using namespace ento; 29 30STATISTIC(NumOfDynamicDispatchPathSplits, 31 "The # of times we split the path due to imprecise dynamic dispatch info"); 32 33void ExprEngine::processCallEnter(CallEnter CE, ExplodedNode *Pred) { 34 // Get the entry block in the CFG of the callee. 35 const StackFrameContext *calleeCtx = CE.getCalleeContext(); 36 const CFG *CalleeCFG = calleeCtx->getCFG(); 37 const CFGBlock *Entry = &(CalleeCFG->getEntry()); 38 39 // Validate the CFG. 40 assert(Entry->empty()); 41 assert(Entry->succ_size() == 1); 42 43 // Get the solitary sucessor. 44 const CFGBlock *Succ = *(Entry->succ_begin()); 45 46 // Construct an edge representing the starting location in the callee. 47 BlockEdge Loc(Entry, Succ, calleeCtx); 48 49 ProgramStateRef state = Pred->getState(); 50 51 // Construct a new node and add it to the worklist. 52 bool isNew; 53 ExplodedNode *Node = G.getNode(Loc, state, false, &isNew); 54 Node->addPredecessor(Pred, G); 55 if (isNew) 56 Engine.getWorkList()->enqueue(Node); 57} 58 59// Find the last statement on the path to the exploded node and the 60// corresponding Block. 61static std::pair<const Stmt*, 62 const CFGBlock*> getLastStmt(const ExplodedNode *Node) { 63 const Stmt *S = 0; 64 const StackFrameContext *SF = 65 Node->getLocation().getLocationContext()->getCurrentStackFrame(); 66 67 // Back up through the ExplodedGraph until we reach a statement node. 68 while (Node) { 69 const ProgramPoint &PP = Node->getLocation(); 70 71 if (const StmtPoint *SP = dyn_cast<StmtPoint>(&PP)) { 72 S = SP->getStmt(); 73 break; 74 } else if (const CallExitEnd *CEE = dyn_cast<CallExitEnd>(&PP)) { 75 S = CEE->getCalleeContext()->getCallSite(); 76 if (S) 77 break; 78 // If we have an implicit call, we'll probably end up with a 79 // StmtPoint inside the callee, which is acceptable. 80 // (It's possible a function ONLY contains implicit calls -- such as an 81 // implicitly-generated destructor -- so we shouldn't just skip back to 82 // the CallEnter node and keep going.) 83 } else if (const CallEnter *CE = dyn_cast<CallEnter>(&PP)) { 84 // If we reached the CallEnter for this function, it has no statements. 85 if (CE->getCalleeContext() == SF) 86 break; 87 } 88 89 Node = *Node->pred_begin(); 90 } 91 92 const CFGBlock *Blk = 0; 93 if (S) { 94 // Now, get the enclosing basic block. 95 while (Node && Node->pred_size() >=1 ) { 96 const ProgramPoint &PP = Node->getLocation(); 97 if (isa<BlockEdge>(PP) && 98 (PP.getLocationContext()->getCurrentStackFrame() == SF)) { 99 BlockEdge &EPP = cast<BlockEdge>(PP); 100 Blk = EPP.getDst(); 101 break; 102 } 103 Node = *Node->pred_begin(); 104 } 105 } 106 107 return std::pair<const Stmt*, const CFGBlock*>(S, Blk); 108} 109 110/// The call exit is simulated with a sequence of nodes, which occur between 111/// CallExitBegin and CallExitEnd. The following operations occur between the 112/// two program points: 113/// 1. CallExitBegin (triggers the start of call exit sequence) 114/// 2. Bind the return value 115/// 3. Run Remove dead bindings to clean up the dead symbols from the callee. 116/// 4. CallExitEnd (switch to the caller context) 117/// 5. PostStmt<CallExpr> 118void ExprEngine::processCallExit(ExplodedNode *CEBNode) { 119 // Step 1 CEBNode was generated before the call. 120 121 const StackFrameContext *calleeCtx = 122 CEBNode->getLocationContext()->getCurrentStackFrame(); 123 124 // The parent context might not be a stack frame, so make sure we 125 // look up the first enclosing stack frame. 126 const StackFrameContext *callerCtx = 127 calleeCtx->getParent()->getCurrentStackFrame(); 128 129 const Stmt *CE = calleeCtx->getCallSite(); 130 ProgramStateRef state = CEBNode->getState(); 131 // Find the last statement in the function and the corresponding basic block. 132 const Stmt *LastSt = 0; 133 const CFGBlock *Blk = 0; 134 llvm::tie(LastSt, Blk) = getLastStmt(CEBNode); 135 136 // Step 2: generate node with bound return value: CEBNode -> BindedRetNode. 137 138 // If the callee returns an expression, bind its value to CallExpr. 139 if (CE) { 140 if (const ReturnStmt *RS = dyn_cast_or_null<ReturnStmt>(LastSt)) { 141 const LocationContext *LCtx = CEBNode->getLocationContext(); 142 SVal V = state->getSVal(RS, LCtx); 143 state = state->BindExpr(CE, callerCtx, V); 144 } 145 146 // Bind the constructed object value to CXXConstructExpr. 147 if (const CXXConstructExpr *CCE = dyn_cast<CXXConstructExpr>(CE)) { 148 loc::MemRegionVal This = 149 svalBuilder.getCXXThis(CCE->getConstructor()->getParent(), calleeCtx); 150 SVal ThisV = state->getSVal(This); 151 152 // Always bind the region to the CXXConstructExpr. 153 state = state->BindExpr(CCE, callerCtx, ThisV); 154 } 155 } 156 157 // Step 3: BindedRetNode -> CleanedNodes 158 // If we can find a statement and a block in the inlined function, run remove 159 // dead bindings before returning from the call. This is important to ensure 160 // that we report the issues such as leaks in the stack contexts in which 161 // they occurred. 162 ExplodedNodeSet CleanedNodes; 163 if (LastSt && Blk) { 164 static SimpleProgramPointTag retValBind("ExprEngine : Bind Return Value"); 165 PostStmt Loc(LastSt, calleeCtx, &retValBind); 166 bool isNew; 167 ExplodedNode *BindedRetNode = G.getNode(Loc, state, false, &isNew); 168 BindedRetNode->addPredecessor(CEBNode, G); 169 if (!isNew) 170 return; 171 172 NodeBuilderContext Ctx(getCoreEngine(), Blk, BindedRetNode); 173 currentBuilderContext = &Ctx; 174 // Here, we call the Symbol Reaper with 0 statement and caller location 175 // context, telling it to clean up everything in the callee's context 176 // (and it's children). We use LastStmt as a diagnostic statement, which 177 // which the PreStmtPurge Dead point will be associated. 178 removeDead(BindedRetNode, CleanedNodes, 0, callerCtx, LastSt, 179 ProgramPoint::PostStmtPurgeDeadSymbolsKind); 180 currentBuilderContext = 0; 181 } else { 182 CleanedNodes.Add(CEBNode); 183 } 184 185 for (ExplodedNodeSet::iterator I = CleanedNodes.begin(), 186 E = CleanedNodes.end(); I != E; ++I) { 187 188 // Step 4: Generate the CallExit and leave the callee's context. 189 // CleanedNodes -> CEENode 190 CallExitEnd Loc(calleeCtx, callerCtx); 191 bool isNew; 192 ProgramStateRef CEEState = (*I == CEBNode) ? state : (*I)->getState(); 193 ExplodedNode *CEENode = G.getNode(Loc, CEEState, false, &isNew); 194 CEENode->addPredecessor(*I, G); 195 if (!isNew) 196 return; 197 198 // Step 5: Perform the post-condition check of the CallExpr and enqueue the 199 // result onto the work list. 200 // CEENode -> Dst -> WorkList 201 NodeBuilderContext Ctx(Engine, calleeCtx->getCallSiteBlock(), CEENode); 202 SaveAndRestore<const NodeBuilderContext*> NBCSave(currentBuilderContext, 203 &Ctx); 204 SaveAndRestore<unsigned> CBISave(currentStmtIdx, calleeCtx->getIndex()); 205 206 CallEventManager &CEMgr = getStateManager().getCallEventManager(); 207 CallEventRef<> Call = CEMgr.getCaller(calleeCtx, CEEState); 208 209 ExplodedNodeSet DstPostCall; 210 getCheckerManager().runCheckersForPostCall(DstPostCall, CEENode, *Call, 211 *this, true); 212 213 ExplodedNodeSet Dst; 214 if (isa<ObjCMethodCall>(Call)) { 215 getCheckerManager().runCheckersForPostObjCMessage(Dst, DstPostCall, 216 cast<ObjCMethodCall>(*Call), 217 *this, true); 218 } else if (CE) { 219 getCheckerManager().runCheckersForPostStmt(Dst, DstPostCall, CE, 220 *this, true); 221 } else { 222 Dst.insert(DstPostCall); 223 } 224 225 // Enqueue the next element in the block. 226 for (ExplodedNodeSet::iterator PSI = Dst.begin(), PSE = Dst.end(); 227 PSI != PSE; ++PSI) { 228 Engine.getWorkList()->enqueue(*PSI, calleeCtx->getCallSiteBlock(), 229 calleeCtx->getIndex()+1); 230 } 231 } 232} 233 234static unsigned getNumberStackFrames(const LocationContext *LCtx) { 235 unsigned count = 0; 236 while (LCtx) { 237 if (isa<StackFrameContext>(LCtx)) 238 ++count; 239 LCtx = LCtx->getParent(); 240 } 241 return count; 242} 243 244// Determine if we should inline the call. 245bool ExprEngine::shouldInlineDecl(const Decl *D, ExplodedNode *Pred) { 246 AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(D); 247 const CFG *CalleeCFG = CalleeADC->getCFG(); 248 249 // It is possible that the CFG cannot be constructed. 250 // Be safe, and check if the CalleeCFG is valid. 251 if (!CalleeCFG) 252 return false; 253 254 if (getNumberStackFrames(Pred->getLocationContext()) 255 == AMgr.InlineMaxStackDepth) 256 return false; 257 258 if (Engine.FunctionSummaries->hasReachedMaxBlockCount(D)) 259 return false; 260 261 if (CalleeCFG->getNumBlockIDs() > AMgr.InlineMaxFunctionSize) 262 return false; 263 264 // Do not inline variadic calls (for now). 265 if (const BlockDecl *BD = dyn_cast<BlockDecl>(D)) { 266 if (BD->isVariadic()) 267 return false; 268 } 269 else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { 270 if (FD->isVariadic()) 271 return false; 272 } 273 274 // It is possible that the live variables analysis cannot be 275 // run. If so, bail out. 276 if (!CalleeADC->getAnalysis<RelaxedLiveVariables>()) 277 return false; 278 279 return true; 280} 281 282/// The GDM component containing the dynamic dispatch bifurcation info. When 283/// the exact type of the receiver is not known, we want to explore both paths - 284/// one on which we do inline it and the other one on which we don't. This is 285/// done to ensure we do not drop coverage. 286/// This is the map from the receiver region to a bool, specifying either we 287/// consider this region's information precise or not along the given path. 288namespace clang { 289namespace ento { 290struct DynamicDispatchBifurcationMap {}; 291typedef llvm::ImmutableMap<const MemRegion*, 292 int> DynamicDispatchBifur; 293template<> struct ProgramStateTrait<DynamicDispatchBifurcationMap> 294 : public ProgramStatePartialTrait<DynamicDispatchBifur> { 295 static void *GDMIndex() { static int index; return &index; } 296}; 297}} 298 299bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D, 300 NodeBuilder &Bldr, ExplodedNode *Pred, 301 ProgramStateRef State) { 302 assert(D); 303 304 const LocationContext *CurLC = Pred->getLocationContext(); 305 const StackFrameContext *CallerSFC = CurLC->getCurrentStackFrame(); 306 const LocationContext *ParentOfCallee = 0; 307 308 // FIXME: Refactor this check into a hypothetical CallEvent::canInline. 309 switch (Call.getKind()) { 310 case CE_Function: 311 break; 312 case CE_CXXMember: 313 case CE_CXXMemberOperator: 314 if (!CXX_INLINING_ENABLED) 315 return false; 316 break; 317 case CE_CXXConstructor: { 318 if (!CXX_INLINING_ENABLED) 319 return false; 320 321 // Only inline constructors and destructors if we built the CFGs for them 322 // properly. 323 const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext(); 324 if (!ADC->getCFGBuildOptions().AddImplicitDtors || 325 !ADC->getCFGBuildOptions().AddInitializers) 326 return false; 327 328 const CXXConstructorCall &Ctor = cast<CXXConstructorCall>(Call); 329 330 // FIXME: We don't handle constructors or destructors for arrays properly. 331 const MemRegion *Target = Ctor.getCXXThisVal().getAsRegion(); 332 if (Target && isa<ElementRegion>(Target)) 333 return false; 334 335 // FIXME: This is a hack. We don't handle temporary destructors 336 // right now, so we shouldn't inline their constructors. 337 const CXXConstructExpr *CtorExpr = Ctor.getOriginExpr(); 338 if (CtorExpr->getConstructionKind() == CXXConstructExpr::CK_Complete) 339 if (!Target || !isa<DeclRegion>(Target)) 340 return false; 341 342 break; 343 } 344 case CE_CXXDestructor: { 345 if (!CXX_INLINING_ENABLED) 346 return false; 347 348 // Only inline constructors and destructors if we built the CFGs for them 349 // properly. 350 const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext(); 351 if (!ADC->getCFGBuildOptions().AddImplicitDtors || 352 !ADC->getCFGBuildOptions().AddInitializers) 353 return false; 354 355 const CXXDestructorCall &Dtor = cast<CXXDestructorCall>(Call); 356 357 // FIXME: We don't handle constructors or destructors for arrays properly. 358 const MemRegion *Target = Dtor.getCXXThisVal().getAsRegion(); 359 if (Target && isa<ElementRegion>(Target)) 360 return false; 361 362 break; 363 } 364 case CE_CXXAllocator: 365 if (!CXX_INLINING_ENABLED) 366 return false; 367 368 // Do not inline allocators until we model deallocators. 369 // This is unfortunate, but basically necessary for smart pointers and such. 370 return false; 371 case CE_Block: { 372 const BlockDataRegion *BR = cast<BlockCall>(Call).getBlockRegion(); 373 assert(BR && "If we have the block definition we should have its region"); 374 AnalysisDeclContext *BlockCtx = AMgr.getAnalysisDeclContext(D); 375 ParentOfCallee = BlockCtx->getBlockInvocationContext(CallerSFC, 376 cast<BlockDecl>(D), 377 BR); 378 break; 379 } 380 case CE_ObjCMessage: 381 if (!(getAnalysisManager().IPAMode == DynamicDispatch || 382 getAnalysisManager().IPAMode == DynamicDispatchBifurcate)) 383 return false; 384 break; 385 } 386 387 if (!shouldInlineDecl(D, Pred)) 388 return false; 389 390 if (!ParentOfCallee) 391 ParentOfCallee = CallerSFC; 392 393 // This may be NULL, but that's fine. 394 const Expr *CallE = Call.getOriginExpr(); 395 396 // Construct a new stack frame for the callee. 397 AnalysisDeclContext *CalleeADC = AMgr.getAnalysisDeclContext(D); 398 const StackFrameContext *CalleeSFC = 399 CalleeADC->getStackFrame(ParentOfCallee, CallE, 400 currentBuilderContext->getBlock(), 401 currentStmtIdx); 402 403 CallEnter Loc(CallE, CalleeSFC, CurLC); 404 405 // Construct a new state which contains the mapping from actual to 406 // formal arguments. 407 State = State->enterStackFrame(Call, CalleeSFC); 408 409 bool isNew; 410 if (ExplodedNode *N = G.getNode(Loc, State, false, &isNew)) { 411 N->addPredecessor(Pred, G); 412 if (isNew) 413 Engine.getWorkList()->enqueue(N); 414 } 415 416 // If we decided to inline the call, the successor has been manually 417 // added onto the work list so remove it from the node builder. 418 Bldr.takeNodes(Pred); 419 420 return true; 421} 422 423static ProgramStateRef getInlineFailedState(ProgramStateRef State, 424 const Stmt *CallE) { 425 void *ReplayState = State->get<ReplayWithoutInlining>(); 426 if (!ReplayState) 427 return 0; 428 429 assert(ReplayState == (const void*)CallE && "Backtracked to the wrong call."); 430 (void)CallE; 431 432 return State->remove<ReplayWithoutInlining>(); 433} 434 435void ExprEngine::VisitCallExpr(const CallExpr *CE, ExplodedNode *Pred, 436 ExplodedNodeSet &dst) { 437 // Perform the previsit of the CallExpr. 438 ExplodedNodeSet dstPreVisit; 439 getCheckerManager().runCheckersForPreStmt(dstPreVisit, Pred, CE, *this); 440 441 // Get the call in its initial state. We use this as a template to perform 442 // all the checks. 443 CallEventManager &CEMgr = getStateManager().getCallEventManager(); 444 CallEventRef<SimpleCall> CallTemplate 445 = CEMgr.getSimpleCall(CE, Pred->getState(), Pred->getLocationContext()); 446 447 // Evaluate the function call. We try each of the checkers 448 // to see if the can evaluate the function call. 449 ExplodedNodeSet dstCallEvaluated; 450 for (ExplodedNodeSet::iterator I = dstPreVisit.begin(), E = dstPreVisit.end(); 451 I != E; ++I) { 452 evalCall(dstCallEvaluated, *I, *CallTemplate); 453 } 454 455 // Finally, perform the post-condition check of the CallExpr and store 456 // the created nodes in 'Dst'. 457 // Note that if the call was inlined, dstCallEvaluated will be empty. 458 // The post-CallExpr check will occur in processCallExit. 459 getCheckerManager().runCheckersForPostStmt(dst, dstCallEvaluated, CE, 460 *this); 461} 462 463void ExprEngine::evalCall(ExplodedNodeSet &Dst, ExplodedNode *Pred, 464 const SimpleCall &Call) { 465 // WARNING: At this time, the state attached to 'Call' may be older than the 466 // state in 'Pred'. This is a minor optimization since CheckerManager will 467 // use an updated CallEvent instance when calling checkers, but if 'Call' is 468 // ever used directly in this function all callers should be updated to pass 469 // the most recent state. (It is probably not worth doing the work here since 470 // for some callers this will not be necessary.) 471 472 // Run any pre-call checks using the generic call interface. 473 ExplodedNodeSet dstPreVisit; 474 getCheckerManager().runCheckersForPreCall(dstPreVisit, Pred, Call, *this); 475 476 // Actually evaluate the function call. We try each of the checkers 477 // to see if the can evaluate the function call, and get a callback at 478 // defaultEvalCall if all of them fail. 479 ExplodedNodeSet dstCallEvaluated; 480 getCheckerManager().runCheckersForEvalCall(dstCallEvaluated, dstPreVisit, 481 Call, *this); 482 483 // Finally, run any post-call checks. 484 getCheckerManager().runCheckersForPostCall(Dst, dstCallEvaluated, 485 Call, *this); 486} 487 488ProgramStateRef ExprEngine::bindReturnValue(const CallEvent &Call, 489 const LocationContext *LCtx, 490 ProgramStateRef State) { 491 const Expr *E = Call.getOriginExpr(); 492 if (!E) 493 return State; 494 495 // Some method families have known return values. 496 if (const ObjCMethodCall *Msg = dyn_cast<ObjCMethodCall>(&Call)) { 497 switch (Msg->getMethodFamily()) { 498 default: 499 break; 500 case OMF_autorelease: 501 case OMF_retain: 502 case OMF_self: { 503 // These methods return their receivers. 504 return State->BindExpr(E, LCtx, Msg->getReceiverSVal()); 505 } 506 } 507 } else if (const CXXConstructorCall *C = dyn_cast<CXXConstructorCall>(&Call)){ 508 return State->BindExpr(E, LCtx, C->getCXXThisVal()); 509 } 510 511 // Conjure a symbol if the return value is unknown. 512 QualType ResultTy = Call.getResultType(); 513 SValBuilder &SVB = getSValBuilder(); 514 unsigned Count = currentBuilderContext->getCurrentBlockCount(); 515 SVal R = SVB.getConjuredSymbolVal(0, E, LCtx, ResultTy, Count); 516 return State->BindExpr(E, LCtx, R); 517} 518 519// Conservatively evaluate call by invalidating regions and binding 520// a conjured return value. 521void ExprEngine::conservativeEvalCall(const CallEvent &Call, NodeBuilder &Bldr, 522 ExplodedNode *Pred, ProgramStateRef State) { 523 unsigned Count = currentBuilderContext->getCurrentBlockCount(); 524 State = Call.invalidateRegions(Count, State); 525 State = bindReturnValue(Call, Pred->getLocationContext(), State); 526 527 // And make the result node. 528 Bldr.generateNode(Call.getProgramPoint(), State, Pred); 529} 530 531void ExprEngine::defaultEvalCall(NodeBuilder &Bldr, ExplodedNode *Pred, 532 const CallEvent &CallTemplate) { 533 // Make sure we have the most recent state attached to the call. 534 ProgramStateRef State = Pred->getState(); 535 CallEventRef<> Call = CallTemplate.cloneWithState(State); 536 537 // Try to inline the call. 538 // The origin expression here is just used as a kind of checksum; 539 // this should still be safe even for CallEvents that don't come from exprs. 540 const Expr *E = Call->getOriginExpr(); 541 ProgramStateRef InlinedFailedState = getInlineFailedState(State, E); 542 543 if (InlinedFailedState) { 544 // If we already tried once and failed, make sure we don't retry later. 545 State = InlinedFailedState; 546 } else if (getAnalysisManager().shouldInlineCall()) { 547 RuntimeDefinition RD = Call->getRuntimeDefinition(); 548 const Decl *D = RD.Decl; 549 if (D) { 550 // Explore with and without inlining the call. 551 const MemRegion *BifurReg = RD.Reg; 552 if (BifurReg && 553 getAnalysisManager().IPAMode == DynamicDispatchBifurcate) { 554 BifurcateCall(BifurReg, *Call, D, Bldr, Pred); 555 return; 556 } else { 557 // We are not bifurcating and we do have a Decl, so just inline. 558 if (inlineCall(*Call, D, Bldr, Pred, State)) 559 return; 560 } 561 } 562 } 563 564 // If we can't inline it, handle the return value and invalidate the regions. 565 conservativeEvalCall(*Call, Bldr, Pred, State); 566} 567 568void ExprEngine::BifurcateCall(const MemRegion *BifurReg, 569 const CallEvent &Call, const Decl *D, 570 NodeBuilder &Bldr, ExplodedNode *Pred) { 571 assert(BifurReg); 572 573 // Check if we've performed the split already - note, we only want 574 // to split the path once per memory region. 575 ProgramStateRef State = Pred->getState(); 576 DynamicDispatchBifur BM = State->get<DynamicDispatchBifurcationMap>(); 577 for (DynamicDispatchBifur::iterator I = BM.begin(), 578 E = BM.end(); I != E; ++I) { 579 if (I->first == BifurReg) { 580 // If we are on "inline path", keep inlining if possible. 581 if (I->second == true) 582 if (inlineCall(Call, D, Bldr, Pred, State)) 583 return; 584 // If inline failed, or we are on the path where we assume we 585 // don't have enough info about the receiver to inline, conjure the 586 // return value and invalidate the regions. 587 conservativeEvalCall(Call, Bldr, Pred, State); 588 return; 589 } 590 } 591 592 // If we got here, this is the first time we process a message to this 593 // region, so split the path. 594 ProgramStateRef IState = 595 State->set<DynamicDispatchBifurcationMap>(BifurReg, true); 596 inlineCall(Call, D, Bldr, Pred, IState); 597 598 ProgramStateRef NoIState = 599 State->set<DynamicDispatchBifurcationMap>(BifurReg, false); 600 conservativeEvalCall(Call, Bldr, Pred, NoIState); 601 602 NumOfDynamicDispatchPathSplits++; 603 return; 604} 605 606 607void ExprEngine::VisitReturnStmt(const ReturnStmt *RS, ExplodedNode *Pred, 608 ExplodedNodeSet &Dst) { 609 610 ExplodedNodeSet dstPreVisit; 611 getCheckerManager().runCheckersForPreStmt(dstPreVisit, Pred, RS, *this); 612 613 StmtNodeBuilder B(dstPreVisit, Dst, *currentBuilderContext); 614 615 if (RS->getRetValue()) { 616 for (ExplodedNodeSet::iterator it = dstPreVisit.begin(), 617 ei = dstPreVisit.end(); it != ei; ++it) { 618 B.generateNode(RS, *it, (*it)->getState()); 619 } 620 } 621} 622