aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-09-20 01:50:34 +0000
committerTed Kremenek <kremenek@apple.com>2008-09-20 01:50:34 +0000
commit82bae3f6bf7bc4733d9c87659b266e23ad55f420 (patch)
tree67128374104d12a089da5e63e36c585089786321 /include/clang/Analysis
parent5472249ee4281673c63db466c8670f269803469a (diff)
Add PostStore, a new ProgramPoint to distinguish between 'stores' and other PostStmts.
GRExprEngine: Use PostStore in EvalStore. Use a second version of EvalStore in EvalBinaryOperator to associate the store with the expression on the LHS. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56383 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis')
-rw-r--r--include/clang/Analysis/PathSensitive/GRCoreEngine.h24
-rw-r--r--include/clang/Analysis/PathSensitive/GRExprEngine.h3
-rw-r--r--include/clang/Analysis/ProgramPoint.h14
3 files changed, 30 insertions, 11 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
index 2211f3a4d9..74311249b3 100644
--- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
@@ -179,7 +179,8 @@ private:
public:
GRStmtNodeBuilder(GRStmtNodeBuilderImpl& nb, StateManagerTy& mgr) :
NB(nb), Mgr(mgr), Auditor(0), PurgingDeadSymbols(false),
- BuildSinks(false), HasGeneratedNode(false) {
+ BuildSinks(false), HasGeneratedNode(false),
+ PointKind(ProgramPoint::PostStmtKind) {
CleanedState = getLastNode()->getState();
}
@@ -192,24 +193,28 @@ public:
return static_cast<NodeTy*>(NB.getLastNode());
}
- NodeTy*
- generateNode(Stmt* S, const StateTy* St, NodeTy* Pred,
- ProgramPoint::Kind K = ProgramPoint::PostStmtKind) {
-
+ NodeTy* generateNode(Stmt* S, const StateTy* St, NodeTy* Pred,
+ ProgramPoint::Kind K) {
HasGeneratedNode = true;
if (PurgingDeadSymbols) K = ProgramPoint::PostPurgeDeadSymbolsKind;
return static_cast<NodeTy*>(NB.generateNodeImpl(S, St, Pred, K));
}
- NodeTy*
- generateNode(Stmt* S, const StateTy* St,
- ProgramPoint::Kind K = ProgramPoint::PostStmtKind) {
-
+ NodeTy* generateNode(Stmt* S, const StateTy* St, NodeTy* Pred) {
+ return generateNode(S, St, Pred, PointKind);
+ }
+
+ NodeTy* generateNode(Stmt* S, const StateTy* St, ProgramPoint::Kind K) {
HasGeneratedNode = true;
if (PurgingDeadSymbols) K = ProgramPoint::PostPurgeDeadSymbolsKind;
return static_cast<NodeTy*>(NB.generateNodeImpl(S, St, K));
}
+ NodeTy* generateNode(Stmt* S, const StateTy* St) {
+ return generateNode(S, St, PointKind);
+ }
+
+
GRBlockCounter getBlockCounter() const {
return NB.getBlockCounter();
}
@@ -269,6 +274,7 @@ public:
bool PurgingDeadSymbols;
bool BuildSinks;
bool HasGeneratedNode;
+ ProgramPoint::Kind PointKind;
};
class GRBranchNodeBuilderImpl {
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h
index 1a288c24af..5b713d9c18 100644
--- a/include/clang/Analysis/PathSensitive/GRExprEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h
@@ -618,6 +618,9 @@ protected:
void EvalStore(NodeSet& Dst, Expr* E, NodeTy* Pred, const GRState* St,
RVal TargetLV, RVal Val);
+ void EvalStore(NodeSet& Dst, Expr* E, Expr* StoreE, NodeTy* Pred,
+ const GRState* St, RVal TargetLV, RVal Val);
+
// FIXME: The "CheckOnly" option exists only because Array and Field
// loads aren't fully implemented. Eventually this option will go away.
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index 0ea5365692..db3acf41a4 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -26,8 +26,9 @@ namespace clang {
class ProgramPoint {
public:
enum Kind { BlockEdgeKind=0, BlockEntranceKind, BlockExitKind,
- // Keep the following three together and in this order.
- PostStmtKind, PostLoadKind, PostPurgeDeadSymbolsKind };
+ // Keep the following four together and in this order.
+ PostStmtKind, PostLoadKind, PostStoreKind,
+ PostPurgeDeadSymbolsKind };
private:
std::pair<uintptr_t,uintptr_t> Data;
@@ -153,6 +154,15 @@ public:
}
};
+class PostStore : public PostStmt {
+public:
+ PostStore(const Stmt* S) : PostStmt(S, PostLoadKind) {}
+
+ static bool classof(const ProgramPoint* Location) {
+ return Location->getKind() == PostStoreKind;
+ }
+};
+
class PostPurgeDeadSymbols : public PostStmt {
public:
PostPurgeDeadSymbols(const Stmt* S) : PostStmt(S, PostPurgeDeadSymbolsKind) {}