1 //= ProgramState.cpp - Path-Sensitive "State" for tracking values --*- C++ -*--= 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file implements ProgramState and ProgramStateManager. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" 14 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h" 15 #include "clang/Analysis/CFG.h" 16 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h" 17 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h" 18 #include "clang/StaticAnalyzer/Core/PathSensitive/SubEngine.h" 19 #include "clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h" 20 #include "llvm/Support/raw_ostream.h" 21 22 using namespace clang; 23 using namespace ento; 24 25 namespace clang { namespace ento { 26 /// Increments the number of times this state is referenced. 27 28 void ProgramStateRetain(const ProgramState *state) { 29 ++const_cast<ProgramState*>(state)->refCount; 30 } 31 32 /// Decrement the number of times this state is referenced. 33 void ProgramStateRelease(const ProgramState *state) { 34 assert(state->refCount > 0); 35 ProgramState *s = const_cast<ProgramState*>(state); 36 if (--s->refCount == 0) { 37 ProgramStateManager &Mgr = s->getStateManager(); 38 Mgr.StateSet.RemoveNode(s); 39 s->~ProgramState(); 40 Mgr.freeStates.push_back(s); 41 } 42 } 43 }} 44 45 ProgramState::ProgramState(ProgramStateManager *mgr, const Environment& env, 46 StoreRef st, GenericDataMap gdm) 47 : stateMgr(mgr), 48 Env(env), 49 store(st.getStore()), 50 GDM(gdm), 51 refCount(0) { 52 stateMgr->getStoreManager().incrementReferenceCount(store); 53 } 54 55 ProgramState::ProgramState(const ProgramState &RHS) 56 : llvm::FoldingSetNode(), 57 stateMgr(RHS.stateMgr), 58 Env(RHS.Env), 59 store(RHS.store), 60 GDM(RHS.GDM), 61 refCount(0) { 62 stateMgr->getStoreManager().incrementReferenceCount(store); 63 } 64 65 ProgramState::~ProgramState() { 66 if (store) 67 stateMgr->getStoreManager().decrementReferenceCount(store); 68 } 69 70 int64_t ProgramState::getID() const { 71 return getStateManager().Alloc.identifyKnownAlignedObject<ProgramState>(this); 72 } 73 74 ProgramStateManager::ProgramStateManager(ASTContext &Ctx, 75 StoreManagerCreator CreateSMgr, 76 ConstraintManagerCreator CreateCMgr, 77 llvm::BumpPtrAllocator &alloc, 78 SubEngine *SubEng) 79 : Eng(SubEng), EnvMgr(alloc), GDMFactory(alloc), 80 svalBuilder(createSimpleSValBuilder(alloc, Ctx, *this)), 81 CallEventMgr(new CallEventManager(alloc)), Alloc(alloc) { 82 StoreMgr = (*CreateSMgr)(*this); 83 ConstraintMgr = (*CreateCMgr)(*this, SubEng); 84 } 85 86 87 ProgramStateManager::~ProgramStateManager() { 88 for (GDMContextsTy::iterator I=GDMContexts.begin(), E=GDMContexts.end(); 89 I!=E; ++I) 90 I->second.second(I->second.first); 91 } 92 93 ProgramStateRef 94 ProgramStateManager::removeDeadBindings(ProgramStateRef state, 95 const StackFrameContext *LCtx, 96 SymbolReaper& SymReaper) { 97 98 // This code essentially performs a "mark-and-sweep" of the VariableBindings. 99 // The roots are any Block-level exprs and Decls that our liveness algorithm 100 // tells us are live. We then see what Decls they may reference, and keep 101 // those around. This code more than likely can be made faster, and the 102 // frequency of which this method is called should be experimented with 103 // for optimum performance. 104 ProgramState NewState = *state; 105 106 NewState.Env = EnvMgr.removeDeadBindings(NewState.Env, SymReaper, state); 107 108 // Clean up the store. 109 StoreRef newStore = StoreMgr->removeDeadBindings(NewState.getStore(), LCtx, 110 SymReaper); 111 NewState.setStore(newStore); 112 SymReaper.setReapedStore(newStore); 113 114 ProgramStateRef Result = getPersistentState(NewState); 115 return ConstraintMgr->removeDeadBindings(Result, SymReaper); 116 } 117 118 ProgramStateRef ProgramState::bindLoc(Loc LV, 119 SVal V, 120 const LocationContext *LCtx, 121 bool notifyChanges) const { 122 ProgramStateManager &Mgr = getStateManager(); 123 ProgramStateRef newState = makeWithStore(Mgr.StoreMgr->Bind(getStore(), 124 LV, V)); 125 const MemRegion *MR = LV.getAsRegion(); 126 if (MR && notifyChanges) 127 return Mgr.getOwningEngine().processRegionChange(newState, MR, LCtx); 128 129 return newState; 130 } 131 132 ProgramStateRef 133 ProgramState::bindDefaultInitial(SVal loc, SVal V, 134 const LocationContext *LCtx) const { 135 ProgramStateManager &Mgr = getStateManager(); 136 const MemRegion *R = loc.castAs<loc::MemRegionVal>().getRegion(); 137 const StoreRef &newStore = Mgr.StoreMgr->BindDefaultInitial(getStore(), R, V); 138 ProgramStateRef new_state = makeWithStore(newStore); 139 return Mgr.getOwningEngine().processRegionChange(new_state, R, LCtx); 140 } 141 142 ProgramStateRef 143 ProgramState::bindDefaultZero(SVal loc, const LocationContext *LCtx) const { 144 ProgramStateManager &Mgr = getStateManager(); 145 const MemRegion *R = loc.castAs<loc::MemRegionVal>().getRegion(); 146 const StoreRef &newStore = Mgr.StoreMgr->BindDefaultZero(getStore(), R); 147 ProgramStateRef new_state = makeWithStore(newStore); 148 return Mgr.getOwningEngine().processRegionChange(new_state, R, LCtx); 149 } 150 151 typedef ArrayRef<const MemRegion *> RegionList; 152 typedef ArrayRef<SVal> ValueList; 153 154 ProgramStateRef 155 ProgramState::invalidateRegions(RegionList Regions, 156 const Expr *E, unsigned Count, 157 const LocationContext *LCtx, 158 bool CausedByPointerEscape, 159 InvalidatedSymbols *IS, 160 const CallEvent *Call, 161 RegionAndSymbolInvalidationTraits *ITraits) const { 162 SmallVector<SVal, 8> Values; 163 for (RegionList::const_iterator I = Regions.begin(), 164 End = Regions.end(); I != End; ++I) 165 Values.push_back(loc::MemRegionVal(*I)); 166 167 return invalidateRegionsImpl(Values, E, Count, LCtx, CausedByPointerEscape, 168 IS, ITraits, Call); 169 } 170 171 ProgramStateRef 172 ProgramState::invalidateRegions(ValueList Values, 173 const Expr *E, unsigned Count, 174 const LocationContext *LCtx, 175 bool CausedByPointerEscape, 176 InvalidatedSymbols *IS, 177 const CallEvent *Call, 178 RegionAndSymbolInvalidationTraits *ITraits) const { 179 180 return invalidateRegionsImpl(Values, E, Count, LCtx, CausedByPointerEscape, 181 IS, ITraits, Call); 182 } 183 184 ProgramStateRef 185 ProgramState::invalidateRegionsImpl(ValueList Values, 186 const Expr *E, unsigned Count, 187 const LocationContext *LCtx, 188 bool CausedByPointerEscape, 189 InvalidatedSymbols *IS, 190 RegionAndSymbolInvalidationTraits *ITraits, 191 const CallEvent *Call) const { 192 ProgramStateManager &Mgr = getStateManager(); 193 SubEngine &Eng = Mgr.getOwningEngine(); 194 195 InvalidatedSymbols InvalidatedSyms; 196 if (!IS) 197 IS = &InvalidatedSyms; 198 199 RegionAndSymbolInvalidationTraits ITraitsLocal; 200 if (!ITraits) 201 ITraits = &ITraitsLocal; 202 203 StoreManager::InvalidatedRegions TopLevelInvalidated; 204 StoreManager::InvalidatedRegions Invalidated; 205 const StoreRef &newStore 206 = Mgr.StoreMgr->invalidateRegions(getStore(), Values, E, Count, LCtx, Call, 207 *IS, *ITraits, &TopLevelInvalidated, 208 &Invalidated); 209 210 ProgramStateRef newState = makeWithStore(newStore); 211 212 if (CausedByPointerEscape) { 213 newState = Eng.notifyCheckersOfPointerEscape(newState, IS, 214 TopLevelInvalidated, 215 Call, 216 *ITraits); 217 } 218 219 return Eng.processRegionChanges(newState, IS, TopLevelInvalidated, 220 Invalidated, LCtx, Call); 221 } 222 223 ProgramStateRef ProgramState::killBinding(Loc LV) const { 224 assert(!LV.getAs<loc::MemRegionVal>() && "Use invalidateRegion instead."); 225 226 Store OldStore = getStore(); 227 const StoreRef &newStore = 228 getStateManager().StoreMgr->killBinding(OldStore, LV); 229 230 if (newStore.getStore() == OldStore) 231 return this; 232 233 return makeWithStore(newStore); 234 } 235 236 ProgramStateRef 237 ProgramState::enterStackFrame(const CallEvent &Call, 238 const StackFrameContext *CalleeCtx) const { 239 const StoreRef &NewStore = 240 getStateManager().StoreMgr->enterStackFrame(getStore(), Call, CalleeCtx); 241 return makeWithStore(NewStore); 242 } 243 244 SVal ProgramState::getSValAsScalarOrLoc(const MemRegion *R) const { 245 // We only want to do fetches from regions that we can actually bind 246 // values. For example, SymbolicRegions of type 'id<...>' cannot 247 // have direct bindings (but their can be bindings on their subregions). 248 if (!R->isBoundable()) 249 return UnknownVal(); 250 251 if (const TypedValueRegion *TR = dyn_cast<TypedValueRegion>(R)) { 252 QualType T = TR->getValueType(); 253 if (Loc::isLocType(T) || T->isIntegralOrEnumerationType()) 254 return getSVal(R); 255 } 256 257 return UnknownVal(); 258 } 259 260 SVal ProgramState::getSVal(Loc location, QualType T) const { 261 SVal V = getRawSVal(location, T); 262 263 // If 'V' is a symbolic value that is *perfectly* constrained to 264 // be a constant value, use that value instead to lessen the burden 265 // on later analysis stages (so we have less symbolic values to reason 266 // about). 267 // We only go into this branch if we can convert the APSInt value we have 268 // to the type of T, which is not always the case (e.g. for void). 269 if (!T.isNull() && (T->isIntegralOrEnumerationType() || Loc::isLocType(T))) { 270 if (SymbolRef sym = V.getAsSymbol()) { 271 if (const llvm::APSInt *Int = getStateManager() 272 .getConstraintManager() 273 .getSymVal(this, sym)) { 274 // FIXME: Because we don't correctly model (yet) sign-extension 275 // and truncation of symbolic values, we need to convert 276 // the integer value to the correct signedness and bitwidth. 277 // 278 // This shows up in the following: 279 // 280 // char foo(); 281 // unsigned x = foo(); 282 // if (x == 54) 283 // ... 284 // 285 // The symbolic value stored to 'x' is actually the conjured 286 // symbol for the call to foo(); the type of that symbol is 'char', 287 // not unsigned. 288 const llvm::APSInt &NewV = getBasicVals().Convert(T, *Int); 289 290 if (V.getAs<Loc>()) 291 return loc::ConcreteInt(NewV); 292 else 293 return nonloc::ConcreteInt(NewV); 294 } 295 } 296 } 297 298 return V; 299 } 300 301 ProgramStateRef ProgramState::BindExpr(const Stmt *S, 302 const LocationContext *LCtx, 303 SVal V, bool Invalidate) const{ 304 Environment NewEnv = 305 getStateManager().EnvMgr.bindExpr(Env, EnvironmentEntry(S, LCtx), V, 306 Invalidate); 307 if (NewEnv == Env) 308 return this; 309 310 ProgramState NewSt = *this; 311 NewSt.Env = NewEnv; 312 return getStateManager().getPersistentState(NewSt); 313 } 314 315 ProgramStateRef ProgramState::assumeInBound(DefinedOrUnknownSVal Idx, 316 DefinedOrUnknownSVal UpperBound, 317 bool Assumption, 318 QualType indexTy) const { 319 if (Idx.isUnknown() || UpperBound.isUnknown()) 320 return this; 321 322 // Build an expression for 0 <= Idx < UpperBound. 323 // This is the same as Idx + MIN < UpperBound + MIN, if overflow is allowed. 324 // FIXME: This should probably be part of SValBuilder. 325 ProgramStateManager &SM = getStateManager(); 326 SValBuilder &svalBuilder = SM.getSValBuilder(); 327 ASTContext &Ctx = svalBuilder.getContext(); 328 329 // Get the offset: the minimum value of the array index type. 330 BasicValueFactory &BVF = svalBuilder.getBasicValueFactory(); 331 if (indexTy.isNull()) 332 indexTy = svalBuilder.getArrayIndexType(); 333 nonloc::ConcreteInt Min(BVF.getMinValue(indexTy)); 334 335 // Adjust the index. 336 SVal newIdx = svalBuilder.evalBinOpNN(this, BO_Add, 337 Idx.castAs<NonLoc>(), Min, indexTy); 338 if (newIdx.isUnknownOrUndef()) 339 return this; 340 341 // Adjust the upper bound. 342 SVal newBound = 343 svalBuilder.evalBinOpNN(this, BO_Add, UpperBound.castAs<NonLoc>(), 344 Min, indexTy); 345 346 if (newBound.isUnknownOrUndef()) 347 return this; 348 349 // Build the actual comparison. 350 SVal inBound = svalBuilder.evalBinOpNN(this, BO_LT, newIdx.castAs<NonLoc>(), 351 newBound.castAs<NonLoc>(), Ctx.IntTy); 352 if (inBound.isUnknownOrUndef()) 353 return this; 354 355 // Finally, let the constraint manager take care of it. 356 ConstraintManager &CM = SM.getConstraintManager(); 357 return CM.assume(this, inBound.castAs<DefinedSVal>(), Assumption); 358 } 359 360 ConditionTruthVal ProgramState::isNonNull(SVal V) const { 361 ConditionTruthVal IsNull = isNull(V); 362 if (IsNull.isUnderconstrained()) 363 return IsNull; 364 return ConditionTruthVal(!IsNull.getValue()); 365 } 366 367 ConditionTruthVal ProgramState::areEqual(SVal Lhs, SVal Rhs) const { 368 return stateMgr->getSValBuilder().areEqual(this, Lhs, Rhs); 369 } 370 371 ConditionTruthVal ProgramState::isNull(SVal V) const { 372 if (V.isZeroConstant()) 373 return true; 374 375 if (V.isConstant()) 376 return false; 377 378 SymbolRef Sym = V.getAsSymbol(/* IncludeBaseRegion */ true); 379 if (!Sym) 380 return ConditionTruthVal(); 381 382 return getStateManager().ConstraintMgr->isNull(this, Sym); 383 } 384 385 ProgramStateRef ProgramStateManager::getInitialState(const LocationContext *InitLoc) { 386 ProgramState State(this, 387 EnvMgr.getInitialEnvironment(), 388 StoreMgr->getInitialStore(InitLoc), 389 GDMFactory.getEmptyMap()); 390 391 return getPersistentState(State); 392 } 393 394 ProgramStateRef ProgramStateManager::getPersistentStateWithGDM( 395 ProgramStateRef FromState, 396 ProgramStateRef GDMState) { 397 ProgramState NewState(*FromState); 398 NewState.GDM = GDMState->GDM; 399 return getPersistentState(NewState); 400 } 401 402 ProgramStateRef ProgramStateManager::getPersistentState(ProgramState &State) { 403 404 llvm::FoldingSetNodeID ID; 405 State.Profile(ID); 406 void *InsertPos; 407 408 if (ProgramState *I = StateSet.FindNodeOrInsertPos(ID, InsertPos)) 409 return I; 410 411 ProgramState *newState = nullptr; 412 if (!freeStates.empty()) { 413 newState = freeStates.back(); 414 freeStates.pop_back(); 415 } 416 else { 417 newState = (ProgramState*) Alloc.Allocate<ProgramState>(); 418 } 419 new (newState) ProgramState(State); 420 StateSet.InsertNode(newState, InsertPos); 421 return newState; 422 } 423 424 ProgramStateRef ProgramState::makeWithStore(const StoreRef &store) const { 425 ProgramState NewSt(*this); 426 NewSt.setStore(store); 427 return getStateManager().getPersistentState(NewSt); 428 } 429 430 void ProgramState::setStore(const StoreRef &newStore) { 431 Store newStoreStore = newStore.getStore(); 432 if (newStoreStore) 433 stateMgr->getStoreManager().incrementReferenceCount(newStoreStore); 434 if (store) 435 stateMgr->getStoreManager().decrementReferenceCount(store); 436 store = newStoreStore; 437 } 438 439 //===----------------------------------------------------------------------===// 440 // State pretty-printing. 441 //===----------------------------------------------------------------------===// 442 443 void ProgramState::printJson(raw_ostream &Out, const LocationContext *LCtx, 444 const char *NL, const char *Sep, 445 unsigned int Space, bool IsDot) const { 446 // Print the store. 447 ProgramStateManager &Mgr = getStateManager(); 448 const ASTContext &Context = getStateManager().getContext(); 449 Mgr.getStoreManager().printJson(Out, getStore(), NL, Space, IsDot); 450 451 // Print out the environment. 452 Env.printJson(Out, Context, LCtx, NL, Space, IsDot); 453 454 // Print out the constraints. 455 Mgr.getConstraintManager().printJson(Out, this, NL, Space, IsDot); 456 457 // Print out the tracked dynamic types. 458 printDynamicTypeInfoJson(Out, this, NL, Space, IsDot); 459 460 // Print checker-specific data. 461 Mgr.getOwningEngine().printState(Out, this, LCtx, NL, Space, IsDot); 462 } 463 464 void ProgramState::printDOT(raw_ostream &Out, const LocationContext *LCtx, 465 unsigned int Space) const { 466 printJson(Out, LCtx, "\\l", "\\|", Space, /*IsDot=*/true); 467 } 468 469 LLVM_DUMP_METHOD void ProgramState::dump() const { 470 printJson(llvm::errs()); 471 } 472 473 AnalysisManager& ProgramState::getAnalysisManager() const { 474 return stateMgr->getOwningEngine().getAnalysisManager(); 475 } 476 477 //===----------------------------------------------------------------------===// 478 // Generic Data Map. 479 //===----------------------------------------------------------------------===// 480 481 void *const* ProgramState::FindGDM(void *K) const { 482 return GDM.lookup(K); 483 } 484 485 void* 486 ProgramStateManager::FindGDMContext(void *K, 487 void *(*CreateContext)(llvm::BumpPtrAllocator&), 488 void (*DeleteContext)(void*)) { 489 490 std::pair<void*, void (*)(void*)>& p = GDMContexts[K]; 491 if (!p.first) { 492 p.first = CreateContext(Alloc); 493 p.second = DeleteContext; 494 } 495 496 return p.first; 497 } 498 499 ProgramStateRef ProgramStateManager::addGDM(ProgramStateRef St, void *Key, void *Data){ 500 ProgramState::GenericDataMap M1 = St->getGDM(); 501 ProgramState::GenericDataMap M2 = GDMFactory.add(M1, Key, Data); 502 503 if (M1 == M2) 504 return St; 505 506 ProgramState NewSt = *St; 507 NewSt.GDM = M2; 508 return getPersistentState(NewSt); 509 } 510 511 ProgramStateRef ProgramStateManager::removeGDM(ProgramStateRef state, void *Key) { 512 ProgramState::GenericDataMap OldM = state->getGDM(); 513 ProgramState::GenericDataMap NewM = GDMFactory.remove(OldM, Key); 514 515 if (NewM == OldM) 516 return state; 517 518 ProgramState NewState = *state; 519 NewState.GDM = NewM; 520 return getPersistentState(NewState); 521 } 522 523 bool ScanReachableSymbols::scan(nonloc::LazyCompoundVal val) { 524 bool wasVisited = !visited.insert(val.getCVData()).second; 525 if (wasVisited) 526 return true; 527 528 StoreManager &StoreMgr = state->getStateManager().getStoreManager(); 529 // FIXME: We don't really want to use getBaseRegion() here because pointer 530 // arithmetic doesn't apply, but scanReachableSymbols only accepts base 531 // regions right now. 532 const MemRegion *R = val.getRegion()->getBaseRegion(); 533 return StoreMgr.scanReachableSymbols(val.getStore(), R, *this); 534 } 535 536 bool ScanReachableSymbols::scan(nonloc::CompoundVal val) { 537 for (nonloc::CompoundVal::iterator I=val.begin(), E=val.end(); I!=E; ++I) 538 if (!scan(*I)) 539 return false; 540 541 return true; 542 } 543 544 bool ScanReachableSymbols::scan(const SymExpr *sym) { 545 for (SymExpr::symbol_iterator SI = sym->symbol_begin(), 546 SE = sym->symbol_end(); 547 SI != SE; ++SI) { 548 bool wasVisited = !visited.insert(*SI).second; 549 if (wasVisited) 550 continue; 551 552 if (!visitor.VisitSymbol(*SI)) 553 return false; 554 } 555 556 return true; 557 } 558 559 bool ScanReachableSymbols::scan(SVal val) { 560 if (Optional<loc::MemRegionVal> X = val.getAs<loc::MemRegionVal>()) 561 return scan(X->getRegion()); 562 563 if (Optional<nonloc::LazyCompoundVal> X = 564 val.getAs<nonloc::LazyCompoundVal>()) 565 return scan(*X); 566 567 if (Optional<nonloc::LocAsInteger> X = val.getAs<nonloc::LocAsInteger>()) 568 return scan(X->getLoc()); 569 570 if (SymbolRef Sym = val.getAsSymbol()) 571 return scan(Sym); 572 573 if (const SymExpr *Sym = val.getAsSymbolicExpression()) 574 return scan(Sym); 575 576 if (Optional<nonloc::CompoundVal> X = val.getAs<nonloc::CompoundVal>()) 577 return scan(*X); 578 579 return true; 580 } 581 582 bool ScanReachableSymbols::scan(const MemRegion *R) { 583 if (isa<MemSpaceRegion>(R)) 584 return true; 585 586 bool wasVisited = !visited.insert(R).second; 587 if (wasVisited) 588 return true; 589 590 if (!visitor.VisitMemRegion(R)) 591 return false; 592 593 // If this is a symbolic region, visit the symbol for the region. 594 if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R)) 595 if (!visitor.VisitSymbol(SR->getSymbol())) 596 return false; 597 598 // If this is a subregion, also visit the parent regions. 599 if (const SubRegion *SR = dyn_cast<SubRegion>(R)) { 600 const MemRegion *Super = SR->getSuperRegion(); 601 if (!scan(Super)) 602 return false; 603 604 // When we reach the topmost region, scan all symbols in it. 605 if (isa<MemSpaceRegion>(Super)) { 606 StoreManager &StoreMgr = state->getStateManager().getStoreManager(); 607 if (!StoreMgr.scanReachableSymbols(state->getStore(), SR, *this)) 608 return false; 609 } 610 } 611 612 // Regions captured by a block are also implicitly reachable. 613 if (const BlockDataRegion *BDR = dyn_cast<BlockDataRegion>(R)) { 614 BlockDataRegion::referenced_vars_iterator I = BDR->referenced_vars_begin(), 615 E = BDR->referenced_vars_end(); 616 for ( ; I != E; ++I) { 617 if (!scan(I.getCapturedRegion())) 618 return false; 619 } 620 } 621 622 return true; 623 } 624 625 bool ProgramState::scanReachableSymbols(SVal val, SymbolVisitor& visitor) const { 626 ScanReachableSymbols S(this, visitor); 627 return S.scan(val); 628 } 629 630 bool ProgramState::scanReachableSymbols( 631 llvm::iterator_range<region_iterator> Reachable, 632 SymbolVisitor &visitor) const { 633 ScanReachableSymbols S(this, visitor); 634 for (const MemRegion *R : Reachable) { 635 if (!S.scan(R)) 636 return false; 637 } 638 return true; 639 } 640