aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/ProgramPoint.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-29 21:04:26 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-29 21:04:26 +0000
commit1b8bd4d71c2098126041b4de4267175a82f0103c (patch)
tree2f4530dca8ccf37e2c6e9dfc019613a831957ebb /include/clang/Analysis/ProgramPoint.h
parent688e659cb57839b8318d566f08a879ca1c2bd1b4 (diff)
Major rewrite/refactoring of static analysis engine. We now use
EvalStore/EvalLoad to handle all loads/stores from symbolic memory, allowing us to do checks for null dereferences, etc., at any arbitrary load/store (these were missed checks before). This also resulted in some major cleanups, some conceptual, and others just in the structure of the code. This temporarily introduces a regression in the test suite (null-deref-ps.c) before I add a new LVal type for structure fields. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50443 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/ProgramPoint.h')
-rw-r--r--include/clang/Analysis/ProgramPoint.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index 5fc1fb651b..efd16b416d 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -25,8 +25,9 @@ namespace clang {
class ProgramPoint {
public:
- enum Kind { BlockEntranceKind=0, PostStmtKind=1, BlockExitKind=2,
- BlockEdgeSrcKind=3, BlockEdgeDstKind=4, BlockEdgeAuxKind=5 };
+ enum Kind { BlockEntranceKind=0, PostStmtKind=1, PostLoadKind=2,
+ BlockExitKind=3, BlockEdgeSrcKind=4, BlockEdgeDstKind=5,
+ BlockEdgeAuxKind=6 };
protected:
uintptr_t Data;
@@ -100,13 +101,25 @@ public:
class PostStmt : public ProgramPoint {
+protected:
+ PostStmt(const Stmt* S, Kind k) : ProgramPoint(S, k) {}
public:
PostStmt(const Stmt* S) : ProgramPoint(S, PostStmtKind) {}
-
+
Stmt* getStmt() const { return (Stmt*) getRawPtr(); }
static bool classof(const ProgramPoint* Location) {
- return Location->getKind() == PostStmtKind;
+ unsigned k = Location->getKind();
+ return k == PostStmtKind || k == PostLoadKind;
+ }
+};
+
+class PostLoad : public PostStmt {
+public:
+ PostLoad(const Stmt* S) : PostStmt(S, PostLoadKind) {}
+
+ static bool classof(const ProgramPoint* Location) {
+ return Location->getKind() == PostLoadKind;
}
};