forked from OSchip/llvm-project
Add 'PreStmt' program point. This will be used to represent checking for
preconditions (in GRExprEngine) before the statement itself is evaluated. llvm-svn: 76791
This commit is contained in:
parent
0af7e85bf7
commit
8a2cb9cede
|
@ -27,20 +27,21 @@ namespace clang {
|
||||||
|
|
||||||
class ProgramPoint {
|
class ProgramPoint {
|
||||||
public:
|
public:
|
||||||
enum Kind { BlockEdgeKind = 0x0,
|
enum Kind { BlockEdgeKind,
|
||||||
BlockEntranceKind = 0x1,
|
BlockEntranceKind,
|
||||||
BlockExitKind = 0x2,
|
BlockExitKind,
|
||||||
// Keep the following four together and in this order.
|
PreStmtKind,
|
||||||
PostStmtKind = 0x3,
|
// Keep the following together and in this order.
|
||||||
PostLocationChecksSucceedKind = 0x4,
|
PostStmtKind,
|
||||||
PostOutOfBoundsCheckFailedKind = 0x5,
|
PostLocationChecksSucceedKind,
|
||||||
PostNullCheckFailedKind = 0x6,
|
PostOutOfBoundsCheckFailedKind,
|
||||||
PostUndefLocationCheckFailedKind = 0x7,
|
PostNullCheckFailedKind,
|
||||||
PostLoadKind = 0x8,
|
PostUndefLocationCheckFailedKind,
|
||||||
PostStoreKind = 0x9,
|
PostLoadKind,
|
||||||
PostPurgeDeadSymbolsKind = 0x10,
|
PostStoreKind,
|
||||||
PostStmtCustomKind = 0x11,
|
PostPurgeDeadSymbolsKind,
|
||||||
PostLValueKind = 0x12,
|
PostStmtCustomKind,
|
||||||
|
PostLValueKind,
|
||||||
MinPostStmtKind = PostStmtKind,
|
MinPostStmtKind = PostStmtKind,
|
||||||
MaxPostStmtKind = PostLValueKind };
|
MaxPostStmtKind = PostLValueKind };
|
||||||
|
|
||||||
|
@ -130,9 +131,25 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PreStmt : public ProgramPoint {
|
||||||
|
public:
|
||||||
|
PreStmt(const Stmt *S, const void *tag, const Stmt *SubStmt = 0)
|
||||||
|
: ProgramPoint(S, SubStmt, PreStmtKind, tag) {}
|
||||||
|
|
||||||
|
const Stmt *getStmt() const { return (const Stmt*) getData1(); }
|
||||||
|
const Stmt *getSubStmt() const { return (const Stmt*) getData2(); }
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
const T* getStmtAs() const { return llvm::dyn_cast<T>(getStmt()); }
|
||||||
|
|
||||||
|
static bool classof(const ProgramPoint* Location) {
|
||||||
|
return Location->getKind() == PreStmtKind;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class PostStmt : public ProgramPoint {
|
class PostStmt : public ProgramPoint {
|
||||||
protected:
|
protected:
|
||||||
PostStmt(const Stmt* S, Kind k,const void *tag = 0)
|
PostStmt(const Stmt* S, Kind k, const void *tag = 0)
|
||||||
: ProgramPoint(S, k, tag) {}
|
: ProgramPoint(S, k, tag) {}
|
||||||
|
|
||||||
PostStmt(const Stmt* S, const void* data, Kind k, const void *tag =0)
|
PostStmt(const Stmt* S, const void* data, Kind k, const void *tag =0)
|
||||||
|
|
Loading…
Reference in New Issue