aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-10-23 03:10:39 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-10-23 03:10:39 +0000
commite1911afd2a79cb508bc81b30be49a0c8648a81b0 (patch)
tree1883de3eb6a8c524bf83c22c415b7f30fc24365c
parent4d8e5b803ecb0b891879aa64a09491b5824a5364 (diff)
Let StoreManager do different cast on arrays. BasicStore will just keep it intact.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58028 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/GRState.h4
-rw-r--r--include/clang/Analysis/PathSensitive/Store.h1
-rw-r--r--lib/Analysis/BasicStore.cpp2
-rw-r--r--lib/Analysis/GRExprEngine.cpp10
4 files changed, 15 insertions, 2 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h
index 87c180db55..95a439e636 100644
--- a/include/clang/Analysis/PathSensitive/GRState.h
+++ b/include/clang/Analysis/PathSensitive/GRState.h
@@ -405,6 +405,10 @@ public:
return SetSVal(St, Ex, V, isBlkExpr, Invalidate);
}
+
+ SVal ArrayToPointer(SVal Array) {
+ return StoreMgr->ArrayToPointer(Array);
+ }
// Methods that manipulate the GDM.
const GRState* addGDM(const GRState* St, void* Key, void* Data);
diff --git a/include/clang/Analysis/PathSensitive/Store.h b/include/clang/Analysis/PathSensitive/Store.h
index 5a93e0e5ea..f4f0415863 100644
--- a/include/clang/Analysis/PathSensitive/Store.h
+++ b/include/clang/Analysis/PathSensitive/Store.h
@@ -61,6 +61,7 @@ public:
virtual SVal getLValueElement(const GRState* St,
SVal Base, SVal Offset) = 0;
+ virtual SVal ArrayToPointer(SVal Array) = 0;
virtual Store
RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
diff --git a/lib/Analysis/BasicStore.cpp b/lib/Analysis/BasicStore.cpp
index cdecb19319..70631ac5bf 100644
--- a/lib/Analysis/BasicStore.cpp
+++ b/lib/Analysis/BasicStore.cpp
@@ -51,6 +51,8 @@ public:
SVal getLValueIvar(const GRState* St, const ObjCIvarDecl* D, SVal Base);
SVal getLValueField(const GRState* St, SVal Base, const FieldDecl* D);
SVal getLValueElement(const GRState* St, SVal Base, SVal Offset);
+
+ SVal ArrayToPointer(SVal Array) { return Array; }
virtual Store
RemoveDeadBindings(Store store, Stmt* Loc, const LiveVariables& Live,
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index ae474bef61..4d771fb366 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1503,9 +1503,15 @@ void GRExprEngine::VisitCast(Expr* CastE, Expr* Ex, NodeTy* Pred, NodeSet& Dst){
MakeNode(Dst, CastE, N, SetSVal(St, CastE, V));
continue;
}
-
+
+ // StoreManager casts array to different values.
+ if (ExTy->isArrayType()) {
+ V = StateMgr.ArrayToPointer(V);
+ MakeNode(Dst, CastE, N, SetSVal(St, CastE, V));
+ continue;
+ }
+
// All other cases.
-
MakeNode(Dst, CastE, N, SetSVal(St, CastE, EvalCast(V, CastE->getType())));
}
}