diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-11-11 03:26:34 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-11-11 03:26:34 +0000 |
commit | b4b817d704287836b52b34369009e682f208aa2b (patch) | |
tree | 2b7898371d40dd14735954712fd2344baa2a7b63 /include/clang/Analysis/ProgramPoint.h | |
parent | 09b6d0e7931bf72674e4d752bd66b566cc01fe05 (diff) |
Refactor DereferenceChecker to use only the new Checker API instead of
the old builder API. This percolated a bunch of changes up to the
Checker class (where CheckLocation has been renamed VisitLocation) and
GRExprEngine. ProgramPoint now has the notion of a "LocationCheck"
point (with PreLoad and PreStore respectively), and a bunch of the old
ProgramPoints that are no longer used have been removed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/ProgramPoint.h')
-rw-r--r-- | include/clang/Analysis/ProgramPoint.h | 64 |
1 files changed, 25 insertions, 39 deletions
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index 7aaae9c866..75ae83f0a6 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -33,13 +33,10 @@ public: BlockEntranceKind, BlockExitKind, PreStmtKind, - // Keep the following together and in this order. PostStmtKind, - PostLocationChecksSucceedKind, - PostOutOfBoundsCheckFailedKind, - PostNullCheckFailedKind, - PostUndefLocationCheckFailedKind, + PreLoadKind, PostLoadKind, + PreStoreKind, PostStoreKind, PostPurgeDeadSymbolsKind, PostStmtCustomKind, @@ -194,17 +191,6 @@ public: } }; -class PostLocationChecksSucceed : public PostStmt { -public: - PostLocationChecksSucceed(const Stmt* S, const LocationContext *L, - const void *tag = 0) - : PostStmt(S, PostLocationChecksSucceedKind, L, tag) {} - - static bool classof(const ProgramPoint* Location) { - return Location->getKind() == PostLocationChecksSucceedKind; - } -}; - class PostStmtCustom : public PostStmt { public: PostStmtCustom(const Stmt* S, @@ -226,36 +212,36 @@ public: } }; -class PostOutOfBoundsCheckFailed : public PostStmt { -public: - PostOutOfBoundsCheckFailed(const Stmt* S, const LocationContext *L, - const void *tag = 0) - : PostStmt(S, PostOutOfBoundsCheckFailedKind, L, tag) {} - - static bool classof(const ProgramPoint* Location) { - return Location->getKind() == PostOutOfBoundsCheckFailedKind; + +class LocationCheck : public StmtPoint { +protected: + LocationCheck(const Stmt *S, const LocationContext *L, + ProgramPoint::Kind K, const void *tag) + : StmtPoint(S, NULL, K, L, tag) {} + + static bool classof(const ProgramPoint *location) { + unsigned k = location->getKind(); + return k == PreLoadKind || PreStoreKind; } }; - -class PostUndefLocationCheckFailed : public PostStmt { + +class PreLoad : public LocationCheck { public: - PostUndefLocationCheckFailed(const Stmt* S, const LocationContext *L, - const void *tag = 0) - : PostStmt(S, PostUndefLocationCheckFailedKind, L, tag) {} - - static bool classof(const ProgramPoint* Location) { - return Location->getKind() == PostUndefLocationCheckFailedKind; + PreLoad(const Stmt *S, const LocationContext *L, const void *tag = 0) + : LocationCheck(S, L, PreLoadKind, tag) {} + + static bool classof(const ProgramPoint *location) { + return location->getKind() == PreLoadKind; } }; -class PostNullCheckFailed : public PostStmt { +class PreStore : public LocationCheck { public: - PostNullCheckFailed(const Stmt* S, const LocationContext *L, - const void *tag = 0) - : PostStmt(S, PostNullCheckFailedKind, L, tag) {} - - static bool classof(const ProgramPoint* Location) { - return Location->getKind() == PostNullCheckFailedKind; + PreStore(const Stmt *S, const LocationContext *L, const void *tag = 0) + : LocationCheck(S, L, PreStoreKind, tag) {} + + static bool classof(const ProgramPoint *location) { + return location->getKind() == PreStoreKind; } }; |