aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngine.cpp
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-11-16 04:07:26 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-11-16 04:07:26 +0000
commitdc0a25d9bff956cdbe54ea0bfc8fbbe3ceb4eb92 (patch)
tree8f8e8291fd6f3ef7fc0d350f1b9679fbd7c766d0 /lib/Analysis/GRExprEngine.cpp
parent10cac6f7115b59a466bb8d2d51cdddeb38aadc37 (diff)
Enhances SCA to process untyped region to typed region conversion.
- RegionView and RegionViewMap is introduced to assist back-mapping from super region to subregions. - GDM is used to carry RegionView information. - AnonTypedRegion is added to represent a typed region introduced by pointer casting. Later AnonTypedRegion can be used in other similar cases, e.g., malloc()'ed region. - The specific conversion is delegated to store manager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r--lib/Analysis/GRExprEngine.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index 55fbf1874a..e002c13637 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1692,6 +1692,21 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
continue;
}
+ // Check for casts from AllocaRegion pointer to typed pointer.
+ if (isa<loc::MemRegionVal>(V)) {
+ assert(Loc::IsLocType(T));
+ assert(Loc::IsLocType(ExTy));
+
+ // Delegate to store manager.
+ const GRState* NewSt = getStoreManager().CastRegion(St, V, T, CastE);
+
+ // If no new region is created, fall through to the default case.
+ if (NewSt != St) {
+ MakeNode(Dst, CastE, N, NewSt);
+ continue;
+ }
+ }
+
// All other cases.
MakeNode(Dst, CastE, N, BindExpr(St, CastE, EvalCast(V, CastE->getType())));
}