aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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())));
}
}