Refine MemRegions for blocks. Add a new region called
'BlockDataRegion' to distinguish between the code associated with a
block (which is represented by 'BlockTextRegion') and an instance of a
block, which includes both code and data. 'BlockDataRegion' has an
associated LocationContext, which can be used to eventually model the
lifetime of a block object once LocationContexts can represent scopes
(and iterations around a loop, etc.).
llvm-svn: 89900
diff --git a/clang/lib/Analysis/ValueManager.cpp b/clang/lib/Analysis/ValueManager.cpp
index 37df443..22a8211 100644
--- a/clang/lib/Analysis/ValueManager.cpp
+++ b/clang/lib/Analysis/ValueManager.cpp
@@ -142,9 +142,11 @@
return loc::MemRegionVal(R);
}
-DefinedSVal ValueManager::getBlockPointer(const BlockDecl *BD,
- CanQualType locTy) {
- CodeTextRegion *R = MemMgr.getBlockTextRegion(BD, locTy);
- return loc::MemRegionVal(R);
+DefinedSVal ValueManager::getBlockPointer(const BlockDecl *D,
+ CanQualType locTy,
+ const LocationContext *LC) {
+ BlockTextRegion *BC = MemMgr.getBlockTextRegion(D, locTy);
+ BlockDataRegion *BD = MemMgr.getBlockDataRegion(BC, LC);
+ return loc::MemRegionVal(BD);
}