1 //== MemRegion.cpp - Abstract memory regions for static analysis --*- C++ -*--//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines MemRegion and its subclasses. MemRegion defines a
11 // partially-typed abstraction of memory useful for path-sensitive dataflow
14 //===----------------------------------------------------------------------===//
16 #include "clang/Analysis/AnalysisContext.h"
17 #include "clang/Checker/PathSensitive/MemRegion.h"
18 #include "clang/AST/CharUnits.h"
19 #include "clang/AST/StmtVisitor.h"
20 #include "llvm/Support/raw_ostream.h"
22 using namespace clang;
24 //===----------------------------------------------------------------------===//
25 // MemRegion Construction.
26 //===----------------------------------------------------------------------===//
28 template<typename RegionTy> struct MemRegionManagerTrait;
30 template <typename RegionTy, typename A1>
31 RegionTy* MemRegionManager::getRegion(const A1 a1) {
33 const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
34 MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1);
36 llvm::FoldingSetNodeID ID;
37 RegionTy::ProfileRegion(ID, a1, superRegion);
39 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
43 R = (RegionTy*) A.Allocate<RegionTy>();
44 new (R) RegionTy(a1, superRegion);
45 Regions.InsertNode(R, InsertPos);
51 template <typename RegionTy, typename A1>
52 RegionTy* MemRegionManager::getSubRegion(const A1 a1,
53 const MemRegion *superRegion) {
54 llvm::FoldingSetNodeID ID;
55 RegionTy::ProfileRegion(ID, a1, superRegion);
57 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
61 R = (RegionTy*) A.Allocate<RegionTy>();
62 new (R) RegionTy(a1, superRegion);
63 Regions.InsertNode(R, InsertPos);
69 template <typename RegionTy, typename A1, typename A2>
70 RegionTy* MemRegionManager::getRegion(const A1 a1, const A2 a2) {
72 const typename MemRegionManagerTrait<RegionTy>::SuperRegionTy *superRegion =
73 MemRegionManagerTrait<RegionTy>::getSuperRegion(*this, a1, a2);
75 llvm::FoldingSetNodeID ID;
76 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
78 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
82 R = (RegionTy*) A.Allocate<RegionTy>();
83 new (R) RegionTy(a1, a2, superRegion);
84 Regions.InsertNode(R, InsertPos);
90 template <typename RegionTy, typename A1, typename A2>
91 RegionTy* MemRegionManager::getSubRegion(const A1 a1, const A2 a2,
92 const MemRegion *superRegion) {
94 llvm::FoldingSetNodeID ID;
95 RegionTy::ProfileRegion(ID, a1, a2, superRegion);
97 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
101 R = (RegionTy*) A.Allocate<RegionTy>();
102 new (R) RegionTy(a1, a2, superRegion);
103 Regions.InsertNode(R, InsertPos);
109 template <typename RegionTy, typename A1, typename A2, typename A3>
110 RegionTy* MemRegionManager::getSubRegion(const A1 a1, const A2 a2, const A3 a3,
111 const MemRegion *superRegion) {
113 llvm::FoldingSetNodeID ID;
114 RegionTy::ProfileRegion(ID, a1, a2, a3, superRegion);
116 RegionTy* R = cast_or_null<RegionTy>(Regions.FindNodeOrInsertPos(ID,
120 R = (RegionTy*) A.Allocate<RegionTy>();
121 new (R) RegionTy(a1, a2, a3, superRegion);
122 Regions.InsertNode(R, InsertPos);
128 //===----------------------------------------------------------------------===//
129 // Object destruction.
130 //===----------------------------------------------------------------------===//
132 MemRegion::~MemRegion() {}
134 MemRegionManager::~MemRegionManager() {
135 // All regions and their data are BumpPtrAllocated. No need to call
136 // their destructors.
139 //===----------------------------------------------------------------------===//
141 //===----------------------------------------------------------------------===//
143 bool SubRegion::isSubRegionOf(const MemRegion* R) const {
144 const MemRegion* r = getSuperRegion();
148 if (const SubRegion* sr = dyn_cast<SubRegion>(r))
149 r = sr->getSuperRegion();
156 MemRegionManager* SubRegion::getMemRegionManager() const {
157 const SubRegion* r = this;
159 const MemRegion *superRegion = r->getSuperRegion();
160 if (const SubRegion *sr = dyn_cast<SubRegion>(superRegion)) {
164 return superRegion->getMemRegionManager();
168 const StackFrameContext *VarRegion::getStackFrame() const {
169 const StackSpaceRegion *SSR = dyn_cast<StackSpaceRegion>(getMemorySpace());
170 return SSR ? SSR->getStackFrame() : NULL;
173 //===----------------------------------------------------------------------===//
174 // FoldingSet profiling.
175 //===----------------------------------------------------------------------===//
177 void MemSpaceRegion::Profile(llvm::FoldingSetNodeID& ID) const {
178 ID.AddInteger((unsigned)getKind());
181 void StackSpaceRegion::Profile(llvm::FoldingSetNodeID &ID) const {
182 ID.AddInteger((unsigned)getKind());
183 ID.AddPointer(getStackFrame());
186 void StringRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
187 const StringLiteral* Str,
188 const MemRegion* superRegion) {
189 ID.AddInteger((unsigned) StringRegionKind);
191 ID.AddPointer(superRegion);
194 void AllocaRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
195 const Expr* Ex, unsigned cnt,
197 ID.AddInteger((unsigned) AllocaRegionKind);
202 void AllocaRegion::Profile(llvm::FoldingSetNodeID& ID) const {
203 ProfileRegion(ID, Ex, Cnt, superRegion);
206 void CompoundLiteralRegion::Profile(llvm::FoldingSetNodeID& ID) const {
207 CompoundLiteralRegion::ProfileRegion(ID, CL, superRegion);
210 void CompoundLiteralRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
211 const CompoundLiteralExpr* CL,
212 const MemRegion* superRegion) {
213 ID.AddInteger((unsigned) CompoundLiteralRegionKind);
215 ID.AddPointer(superRegion);
218 void CXXThisRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
219 const PointerType *PT,
220 const MemRegion *sRegion) {
221 ID.AddInteger((unsigned) CXXThisRegionKind);
223 ID.AddPointer(sRegion);
226 void CXXThisRegion::Profile(llvm::FoldingSetNodeID &ID) const {
227 CXXThisRegion::ProfileRegion(ID, ThisPointerTy, superRegion);
230 void DeclRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, const Decl* D,
231 const MemRegion* superRegion, Kind k) {
232 ID.AddInteger((unsigned) k);
234 ID.AddPointer(superRegion);
237 void DeclRegion::Profile(llvm::FoldingSetNodeID& ID) const {
238 DeclRegion::ProfileRegion(ID, D, superRegion, getKind());
241 void VarRegion::Profile(llvm::FoldingSetNodeID &ID) const {
242 VarRegion::ProfileRegion(ID, getDecl(), superRegion);
245 void SymbolicRegion::ProfileRegion(llvm::FoldingSetNodeID& ID, SymbolRef sym,
246 const MemRegion *sreg) {
247 ID.AddInteger((unsigned) MemRegion::SymbolicRegionKind);
252 void SymbolicRegion::Profile(llvm::FoldingSetNodeID& ID) const {
253 SymbolicRegion::ProfileRegion(ID, sym, getSuperRegion());
256 void ElementRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
257 QualType ElementType, SVal Idx,
258 const MemRegion* superRegion) {
259 ID.AddInteger(MemRegion::ElementRegionKind);
261 ID.AddPointer(superRegion);
265 void ElementRegion::Profile(llvm::FoldingSetNodeID& ID) const {
266 ElementRegion::ProfileRegion(ID, ElementType, Index, superRegion);
269 void FunctionTextRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
270 const FunctionDecl *FD,
272 ID.AddInteger(MemRegion::FunctionTextRegionKind);
276 void FunctionTextRegion::Profile(llvm::FoldingSetNodeID& ID) const {
277 FunctionTextRegion::ProfileRegion(ID, FD, superRegion);
280 void BlockTextRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
281 const BlockDecl *BD, CanQualType,
282 const AnalysisContext *AC,
284 ID.AddInteger(MemRegion::BlockTextRegionKind);
288 void BlockTextRegion::Profile(llvm::FoldingSetNodeID& ID) const {
289 BlockTextRegion::ProfileRegion(ID, BD, locTy, AC, superRegion);
292 void BlockDataRegion::ProfileRegion(llvm::FoldingSetNodeID& ID,
293 const BlockTextRegion *BC,
294 const LocationContext *LC,
295 const MemRegion *sReg) {
296 ID.AddInteger(MemRegion::BlockDataRegionKind);
302 void BlockDataRegion::Profile(llvm::FoldingSetNodeID& ID) const {
303 BlockDataRegion::ProfileRegion(ID, BC, LC, getSuperRegion());
306 void CXXObjectRegion::ProfileRegion(llvm::FoldingSetNodeID &ID,
308 const MemRegion *sReg) {
313 void CXXObjectRegion::Profile(llvm::FoldingSetNodeID &ID) const {
314 ProfileRegion(ID, Ex, getSuperRegion());
317 //===----------------------------------------------------------------------===//
318 // Region pretty-printing.
319 //===----------------------------------------------------------------------===//
321 void MemRegion::dump() const {
322 dumpToStream(llvm::errs());
325 std::string MemRegion::getString() const {
327 llvm::raw_string_ostream os(s);
332 void MemRegion::dumpToStream(llvm::raw_ostream& os) const {
333 os << "<Unknown Region>";
336 void AllocaRegion::dumpToStream(llvm::raw_ostream& os) const {
337 os << "alloca{" << (void*) Ex << ',' << Cnt << '}';
340 void FunctionTextRegion::dumpToStream(llvm::raw_ostream& os) const {
341 os << "code{" << getDecl()->getDeclName().getAsString() << '}';
344 void BlockTextRegion::dumpToStream(llvm::raw_ostream& os) const {
345 os << "block_code{" << (void*) this << '}';
348 void BlockDataRegion::dumpToStream(llvm::raw_ostream& os) const {
349 os << "block_data{" << BC << '}';
353 void CompoundLiteralRegion::dumpToStream(llvm::raw_ostream& os) const {
354 // FIXME: More elaborate pretty-printing.
355 os << "{ " << (void*) CL << " }";
358 void CXXThisRegion::dumpToStream(llvm::raw_ostream &os) const {
362 void ElementRegion::dumpToStream(llvm::raw_ostream& os) const {
363 os << "element{" << superRegion << ','
364 << Index << ',' << getElementType().getAsString() << '}';
367 void FieldRegion::dumpToStream(llvm::raw_ostream& os) const {
368 os << superRegion << "->" << getDecl()->getNameAsString();
371 void ObjCIvarRegion::dumpToStream(llvm::raw_ostream& os) const {
372 os << "ivar{" << superRegion << ',' << getDecl()->getNameAsString() << '}';
375 void StringRegion::dumpToStream(llvm::raw_ostream& os) const {
376 Str->printPretty(os, 0, PrintingPolicy(getContext().getLangOptions()));
379 void SymbolicRegion::dumpToStream(llvm::raw_ostream& os) const {
380 os << "SymRegion{" << sym << '}';
383 void VarRegion::dumpToStream(llvm::raw_ostream& os) const {
384 os << cast<VarDecl>(D)->getNameAsString();
387 void RegionRawOffset::dump() const {
388 dumpToStream(llvm::errs());
391 void RegionRawOffset::dumpToStream(llvm::raw_ostream& os) const {
392 os << "raw_offset{" << getRegion() << ',' << getByteOffset() << '}';
395 //===----------------------------------------------------------------------===//
396 // MemRegionManager methods.
397 //===----------------------------------------------------------------------===//
399 template <typename REG>
400 const REG *MemRegionManager::LazyAllocate(REG*& region) {
402 region = (REG*) A.Allocate<REG>();
403 new (region) REG(this);
409 template <typename REG, typename ARG>
410 const REG *MemRegionManager::LazyAllocate(REG*& region, ARG a) {
412 region = (REG*) A.Allocate<REG>();
413 new (region) REG(this, a);
419 const StackLocalsSpaceRegion*
420 MemRegionManager::getStackLocalsRegion(const StackFrameContext *STC) {
422 if (STC == cachedStackLocalsFrame)
423 return cachedStackLocalsRegion;
424 cachedStackLocalsFrame = STC;
425 return LazyAllocate(cachedStackLocalsRegion, STC);
428 const StackArgumentsSpaceRegion *
429 MemRegionManager::getStackArgumentsRegion(const StackFrameContext *STC) {
431 if (STC == cachedStackArgumentsFrame)
432 return cachedStackArgumentsRegion;
434 cachedStackArgumentsFrame = STC;
435 return LazyAllocate(cachedStackArgumentsRegion, STC);
438 const GlobalsSpaceRegion *MemRegionManager::getGlobalsRegion() {
439 return LazyAllocate(globals);
442 const HeapSpaceRegion *MemRegionManager::getHeapRegion() {
443 return LazyAllocate(heap);
446 const MemSpaceRegion *MemRegionManager::getUnknownRegion() {
447 return LazyAllocate(unknown);
450 const MemSpaceRegion *MemRegionManager::getCodeRegion() {
451 return LazyAllocate(code);
454 //===----------------------------------------------------------------------===//
455 // Constructing regions.
456 //===----------------------------------------------------------------------===//
458 const StringRegion* MemRegionManager::getStringRegion(const StringLiteral* Str) {
459 return getSubRegion<StringRegion>(Str, getGlobalsRegion());
462 const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D,
463 const LocationContext *LC) {
464 const MemRegion *sReg = 0;
466 if (D->hasLocalStorage()) {
467 // FIXME: Once we implement scope handling, we will need to properly lookup
468 // 'D' to the proper LocationContext.
469 const DeclContext *DC = D->getDeclContext();
470 const StackFrameContext *STC = LC->getStackFrameForDeclContext(DC);
473 sReg = getUnknownRegion();
475 sReg = isa<ParmVarDecl>(D) || isa<ImplicitParamDecl>(D)
476 ? static_cast<const MemRegion*>(getStackArgumentsRegion(STC))
477 : static_cast<const MemRegion*>(getStackLocalsRegion(STC));
481 sReg = getGlobalsRegion();
484 return getSubRegion<VarRegion>(D, sReg);
487 const VarRegion *MemRegionManager::getVarRegion(const VarDecl *D,
488 const MemRegion *superR) {
489 return getSubRegion<VarRegion>(D, superR);
492 const BlockDataRegion *
493 MemRegionManager::getBlockDataRegion(const BlockTextRegion *BC,
494 const LocationContext *LC) {
495 const MemRegion *sReg = 0;
498 // FIXME: Once we implement scope handling, we want the parent region
500 const StackFrameContext *STC = LC->getCurrentStackFrame();
502 sReg = getStackLocalsRegion(STC);
505 // We allow 'LC' to be NULL for cases where want BlockDataRegions
506 // without context-sensitivity.
507 sReg = getUnknownRegion();
510 return getSubRegion<BlockDataRegion>(BC, LC, sReg);
513 const CompoundLiteralRegion*
514 MemRegionManager::getCompoundLiteralRegion(const CompoundLiteralExpr* CL,
515 const LocationContext *LC) {
517 const MemRegion *sReg = 0;
519 if (CL->isFileScope())
520 sReg = getGlobalsRegion();
522 const StackFrameContext *STC = LC->getCurrentStackFrame();
524 sReg = getStackLocalsRegion(STC);
527 return getSubRegion<CompoundLiteralRegion>(CL, sReg);
531 MemRegionManager::getElementRegion(QualType elementType, SVal Idx,
532 const MemRegion* superRegion,
535 QualType T = Ctx.getCanonicalType(elementType);
537 llvm::FoldingSetNodeID ID;
538 ElementRegion::ProfileRegion(ID, T, Idx, superRegion);
541 MemRegion* data = Regions.FindNodeOrInsertPos(ID, InsertPos);
542 ElementRegion* R = cast_or_null<ElementRegion>(data);
545 R = (ElementRegion*) A.Allocate<ElementRegion>();
546 new (R) ElementRegion(T, Idx, superRegion);
547 Regions.InsertNode(R, InsertPos);
553 const FunctionTextRegion *
554 MemRegionManager::getFunctionTextRegion(const FunctionDecl *FD) {
555 return getSubRegion<FunctionTextRegion>(FD, getCodeRegion());
558 const BlockTextRegion *
559 MemRegionManager::getBlockTextRegion(const BlockDecl *BD, CanQualType locTy,
560 AnalysisContext *AC) {
561 return getSubRegion<BlockTextRegion>(BD, locTy, AC, getCodeRegion());
565 /// getSymbolicRegion - Retrieve or create a "symbolic" memory region.
566 const SymbolicRegion *MemRegionManager::getSymbolicRegion(SymbolRef sym) {
567 return getSubRegion<SymbolicRegion>(sym, getUnknownRegion());
571 MemRegionManager::getFieldRegion(const FieldDecl* d,
572 const MemRegion* superRegion){
573 return getSubRegion<FieldRegion>(d, superRegion);
576 const ObjCIvarRegion*
577 MemRegionManager::getObjCIvarRegion(const ObjCIvarDecl* d,
578 const MemRegion* superRegion) {
579 return getSubRegion<ObjCIvarRegion>(d, superRegion);
582 const CXXObjectRegion*
583 MemRegionManager::getCXXObjectRegion(Expr const *E,
584 LocationContext const *LC) {
585 const StackFrameContext *SFC = LC->getCurrentStackFrame();
587 return getSubRegion<CXXObjectRegion>(E, getStackLocalsRegion(SFC));
591 MemRegionManager::getCXXThisRegion(QualType thisPointerTy,
592 const LocationContext *LC) {
593 const StackFrameContext *STC = LC->getCurrentStackFrame();
595 const PointerType *PT = thisPointerTy->getAs<PointerType>();
597 return getSubRegion<CXXThisRegion>(PT, getStackArgumentsRegion(STC));
601 MemRegionManager::getAllocaRegion(const Expr* E, unsigned cnt,
602 const LocationContext *LC) {
603 const StackFrameContext *STC = LC->getCurrentStackFrame();
605 return getSubRegion<AllocaRegion>(E, cnt, getStackLocalsRegion(STC));
608 const MemSpaceRegion *MemRegion::getMemorySpace() const {
609 const MemRegion *R = this;
610 const SubRegion* SR = dyn_cast<SubRegion>(this);
613 R = SR->getSuperRegion();
614 SR = dyn_cast<SubRegion>(R);
617 return dyn_cast<MemSpaceRegion>(R);
620 bool MemRegion::hasStackStorage() const {
621 return isa<StackSpaceRegion>(getMemorySpace());
624 bool MemRegion::hasStackNonParametersStorage() const {
625 return isa<StackLocalsSpaceRegion>(getMemorySpace());
628 bool MemRegion::hasStackParametersStorage() const {
629 return isa<StackArgumentsSpaceRegion>(getMemorySpace());
632 bool MemRegion::hasGlobalsOrParametersStorage() const {
633 const MemSpaceRegion *MS = getMemorySpace();
634 return isa<StackArgumentsSpaceRegion>(MS) ||
635 isa<GlobalsSpaceRegion>(MS);
638 // getBaseRegion strips away all elements and fields, and get the base region
640 const MemRegion *MemRegion::getBaseRegion() const {
641 const MemRegion *R = this;
643 if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
644 R = ER->getSuperRegion();
647 if (const FieldRegion *FR = dyn_cast<FieldRegion>(R)) {
648 R = FR->getSuperRegion();
656 //===----------------------------------------------------------------------===//
658 //===----------------------------------------------------------------------===//
660 const MemRegion *MemRegion::StripCasts() const {
661 const MemRegion *R = this;
663 if (const ElementRegion *ER = dyn_cast<ElementRegion>(R)) {
664 // FIXME: generalize. Essentially we want to strip away ElementRegions
665 // that were layered on a symbolic region because of casts. We only
666 // want to strip away ElementRegions, however, where the index is 0.
667 SVal index = ER->getIndex();
668 if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&index)) {
669 if (CI->getValue().getSExtValue() == 0) {
670 R = ER->getSuperRegion();
680 // FIXME: Merge with the implementation of the same method in Store.cpp
681 static bool IsCompleteType(ASTContext &Ctx, QualType Ty) {
682 if (const RecordType *RT = Ty->getAs<RecordType>()) {
683 const RecordDecl *D = RT->getDecl();
684 if (!D->getDefinition())
691 RegionRawOffset ElementRegion::getAsRawOffset() const {
692 CharUnits offset = CharUnits::Zero();
693 const ElementRegion *ER = this;
694 const MemRegion *superR = NULL;
695 ASTContext &C = getContext();
697 // FIXME: Handle multi-dimensional arrays.
700 superR = ER->getSuperRegion();
702 // FIXME: generalize to symbolic offsets.
703 SVal index = ER->getIndex();
704 if (nonloc::ConcreteInt *CI = dyn_cast<nonloc::ConcreteInt>(&index)) {
705 // Update the offset.
706 int64_t i = CI->getValue().getSExtValue();
709 QualType elemType = ER->getElementType();
711 // If we are pointing to an incomplete type, go no further.
712 if (!IsCompleteType(C, elemType)) {
717 CharUnits size = C.getTypeSizeInChars(elemType);
718 offset += (i * size);
721 // Go to the next ElementRegion (if any).
722 ER = dyn_cast<ElementRegion>(superR);
729 assert(superR && "super region cannot be NULL");
730 return RegionRawOffset(superR, offset.getQuantity());
733 //===----------------------------------------------------------------------===//
735 //===----------------------------------------------------------------------===//
737 void BlockDataRegion::LazyInitializeReferencedVars() {
741 AnalysisContext *AC = getCodeRegion()->getAnalysisContext();
742 AnalysisContext::referenced_decls_iterator I, E;
743 llvm::tie(I, E) = AC->getReferencedBlockVars(BC->getDecl());
746 ReferencedVars = (void*) 0x1;
750 MemRegionManager &MemMgr = *getMemRegionManager();
751 llvm::BumpPtrAllocator &A = MemMgr.getAllocator();
752 BumpVectorContext BC(A);
754 typedef BumpVector<const MemRegion*> VarVec;
755 VarVec *BV = (VarVec*) A.Allocate<VarVec>();
756 new (BV) VarVec(BC, E - I);
758 for ( ; I != E; ++I) {
759 const VarDecl *VD = *I;
760 const VarRegion *VR = 0;
762 if (!VD->getAttr<BlocksAttr>() && VD->hasLocalStorage())
763 VR = MemMgr.getVarRegion(VD, this);
766 VR = MemMgr.getVarRegion(VD, LC);
768 VR = MemMgr.getVarRegion(VD, MemMgr.getUnknownRegion());
773 BV->push_back(VR, BC);
779 BlockDataRegion::referenced_vars_iterator
780 BlockDataRegion::referenced_vars_begin() const {
781 const_cast<BlockDataRegion*>(this)->LazyInitializeReferencedVars();
783 BumpVector<const MemRegion*> *Vec =
784 static_cast<BumpVector<const MemRegion*>*>(ReferencedVars);
786 return BlockDataRegion::referenced_vars_iterator(Vec == (void*) 0x1 ?
787 NULL : Vec->begin());
790 BlockDataRegion::referenced_vars_iterator
791 BlockDataRegion::referenced_vars_end() const {
792 const_cast<BlockDataRegion*>(this)->LazyInitializeReferencedVars();
794 BumpVector<const MemRegion*> *Vec =
795 static_cast<BumpVector<const MemRegion*>*>(ReferencedVars);
797 return BlockDataRegion::referenced_vars_iterator(Vec == (void*) 0x1 ?