diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-16 22:02:27 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-16 22:02:27 +0000 |
commit | 8c354758c2d39db87c77c723d81e34b4d967f762 (patch) | |
tree | 8dce26abb08e379017a229ec49091d4b122c9774 /include/clang/Analysis/ProgramPoint.h | |
parent | 72b505b7904b3c9320a1312998800ba76e4f5841 (diff) |
ProgramPoint:
- Added four new ProgramPoint types that subclass PostStmt for use in
GRExprEngine::EvalLocation:
- PostOutOfBoundsCheckFailed
- PostUndefLocationCheckFailed
- PostNullCheckFailed
- PostLocationChecksSucceed
These were created because of a horribly subtle caching bug in EvalLocation
where a node representing an "bug condition" in EvalLocation (e.g. a null
dereference) could be re-used as the "non-bug condition" because the Store did
not contain any information to differentiate between the two. The extra
program points just disables any accidental caching between EvalLocation and
its callers.
GRExprEngine:
- EvalLocation now returns a NodeTy* instead of GRState*. This should be used as the "vetted" predecessor for EvalLoad/EvalStore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/ProgramPoint.h')
-rw-r--r-- | include/clang/Analysis/ProgramPoint.h | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h index db3acf41a4..4e8b3814b1 100644 --- a/include/clang/Analysis/ProgramPoint.h +++ b/include/clang/Analysis/ProgramPoint.h @@ -27,7 +27,12 @@ class ProgramPoint { public: enum Kind { BlockEdgeKind=0, BlockEntranceKind, BlockExitKind, // Keep the following four together and in this order. - PostStmtKind, PostLoadKind, PostStoreKind, + PostStmtKind, + PostLocationChecksSucceedKind, + PostOutOfBoundsCheckFailedKind, + PostNullCheckFailedKind, + PostUndefLocationCheckFailedKind, + PostLoadKind, PostStoreKind, PostPurgeDeadSymbolsKind }; private: @@ -144,6 +149,46 @@ public: return k >= PostStmtKind && k <= PostPurgeDeadSymbolsKind; } }; + +class PostLocationChecksSucceed : public PostStmt { +public: + PostLocationChecksSucceed(const Stmt* S) + : PostStmt(S, PostLocationChecksSucceedKind) {} + + static bool classof(const ProgramPoint* Location) { + return Location->getKind() == PostLocationChecksSucceedKind; + } +}; + +class PostOutOfBoundsCheckFailed : public PostStmt { +public: + PostOutOfBoundsCheckFailed(const Stmt* S) + : PostStmt(S, PostOutOfBoundsCheckFailedKind) {} + + static bool classof(const ProgramPoint* Location) { + return Location->getKind() == PostOutOfBoundsCheckFailedKind; + } +}; + +class PostUndefLocationCheckFailed : public PostStmt { +public: + PostUndefLocationCheckFailed(const Stmt* S) + : PostStmt(S, PostUndefLocationCheckFailedKind) {} + + static bool classof(const ProgramPoint* Location) { + return Location->getKind() == PostUndefLocationCheckFailedKind; + } +}; + +class PostNullCheckFailed : public PostStmt { +public: + PostNullCheckFailed(const Stmt* S) + : PostStmt(S, PostNullCheckFailedKind) {} + + static bool classof(const ProgramPoint* Location) { + return Location->getKind() == PostNullCheckFailedKind; + } +}; class PostLoad : public PostStmt { public: @@ -156,7 +201,7 @@ public: class PostStore : public PostStmt { public: - PostStore(const Stmt* S) : PostStmt(S, PostLoadKind) {} + PostStore(const Stmt* S) : PostStmt(S, PostStoreKind) {} static bool classof(const ProgramPoint* Location) { return Location->getKind() == PostStoreKind; |