aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/clang/Analysis/PathSensitive/BugReporter.h2
-rw-r--r--include/clang/Analysis/PathSensitive/GRCoreEngine.h14
-rw-r--r--include/clang/Analysis/PathSensitive/GRState.h4
-rw-r--r--include/clang/Analysis/ProgramPoint.h41
4 files changed, 34 insertions, 27 deletions
diff --git a/include/clang/Analysis/PathSensitive/BugReporter.h b/include/clang/Analysis/PathSensitive/BugReporter.h
index c90e5597b6..042564e0e0 100644
--- a/include/clang/Analysis/PathSensitive/BugReporter.h
+++ b/include/clang/Analysis/PathSensitive/BugReporter.h
@@ -101,7 +101,7 @@ public:
// object.
// FIXME: If we do need it, we can probably just make it private to
// BugReporter.
- Stmt* getStmt(BugReporter& BR) const;
+ const Stmt* getStmt(BugReporter& BR) const;
const std::string& getDescription() const { return Description; }
diff --git a/include/clang/Analysis/PathSensitive/GRCoreEngine.h b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
index 3d8b0ea18e..8fb2506fa1 100644
--- a/include/clang/Analysis/PathSensitive/GRCoreEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRCoreEngine.h
@@ -146,12 +146,12 @@ public:
ExplodedNodeImpl* Pred);
ExplodedNodeImpl*
- generateNodeImpl(Stmt* S, const void* State, ExplodedNodeImpl* Pred,
+ generateNodeImpl(const Stmt* S, const void* State, ExplodedNodeImpl* Pred,
ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
const void *tag = 0);
ExplodedNodeImpl*
- generateNodeImpl(Stmt* S, const void* State,
+ generateNodeImpl(const Stmt* S, const void* State,
ProgramPoint::Kind K = ProgramPoint::PostStmtKind,
const void *tag = 0) {
ExplodedNodeImpl* N = getLastNode();
@@ -160,7 +160,7 @@ public:
}
ExplodedNodeImpl*
- generateNodeImpl(Stmt* S, const void* State, const void *tag = 0) {
+ generateNodeImpl(const Stmt* S, const void* State, const void *tag = 0) {
ExplodedNodeImpl* N = getLastNode();
assert (N && "Predecessor of new node is infeasible.");
return generateNodeImpl(S, State, N, ProgramPoint::PostStmtKind, tag);
@@ -211,24 +211,24 @@ public:
return static_cast<NodeTy*>(NB.generateNodeImpl(PP, St, Pred));
}
- NodeTy* generateNode(Stmt* S, const StateTy* St, NodeTy* Pred,
+ NodeTy* generateNode(const 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, Tag));
}
- NodeTy* generateNode(Stmt* S, const StateTy* St, NodeTy* Pred) {
+ NodeTy* generateNode(const Stmt* S, const StateTy* St, NodeTy* Pred) {
return generateNode(S, St, Pred, PointKind);
}
- NodeTy* generateNode(Stmt* S, const StateTy* St, ProgramPoint::Kind K) {
+ NodeTy* generateNode(const Stmt* S, const StateTy* St, ProgramPoint::Kind K) {
HasGeneratedNode = true;
if (PurgingDeadSymbols) K = ProgramPoint::PostPurgeDeadSymbolsKind;
return static_cast<NodeTy*>(NB.generateNodeImpl(S, St, K, Tag));
}
- NodeTy* generateNode(Stmt* S, const StateTy* St) {
+ NodeTy* generateNode(const Stmt* S, const StateTy* St) {
return generateNode(S, St, PointKind);
}
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h
index 1551f961cf..e6e7960869 100644
--- a/include/clang/Analysis/PathSensitive/GRState.h
+++ b/include/clang/Analysis/PathSensitive/GRState.h
@@ -525,8 +525,8 @@ public:
const GRState* getPersistentState(GRState& Impl);
- bool isEqual(const GRState* state, Expr* Ex, const llvm::APSInt& V);
- bool isEqual(const GRState* state, Expr* Ex, uint64_t);
+ bool isEqual(const GRState* state, const Expr* Ex, const llvm::APSInt& V);
+ bool isEqual(const GRState* state, const Expr* Ex, uint64_t);
//==---------------------------------------------------------------------==//
// Generic Data Map methods.
diff --git a/include/clang/Analysis/ProgramPoint.h b/include/clang/Analysis/ProgramPoint.h
index a22fd25f28..8951e83a7c 100644
--- a/include/clang/Analysis/ProgramPoint.h
+++ b/include/clang/Analysis/ProgramPoint.h
@@ -130,40 +130,47 @@ public:
return Location->getKind() == BlockExitKind;
}
};
+
+class StmtPoint : public ProgramPoint {
+public:
+ StmtPoint(const Stmt *S, const void *p2, Kind k, const void *tag)
+ : ProgramPoint(S, p2, k, tag) {}
+
+ const Stmt *getStmt() const { return (const Stmt*) getData1(); }
+
+ template <typename T>
+ const T* getStmtAs() const { return llvm::dyn_cast<T>(getStmt()); }
+
+ static bool classof(const ProgramPoint* Location) {
+ unsigned k = Location->getKind();
+ return k >= PreStmtKind && k <= MaxPostStmtKind;
+ }
+};
-class PreStmt : public ProgramPoint {
+
+class PreStmt : public StmtPoint {
public:
PreStmt(const Stmt *S, const void *tag, const Stmt *SubStmt = 0)
- : ProgramPoint(S, SubStmt, PreStmtKind, tag) {}
+ : StmtPoint(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 StmtPoint {
protected:
PostStmt(const Stmt* S, Kind k, const void *tag = 0)
- : ProgramPoint(S, k, tag) {}
+ : StmtPoint(S, NULL, k, tag) {}
PostStmt(const Stmt* S, const void* data, Kind k, const void *tag =0)
- : ProgramPoint(S, data, k, tag) {}
+ : StmtPoint(S, data, k, tag) {}
public:
- PostStmt(const Stmt* S, const void *tag = 0)
- : ProgramPoint(S, PostStmtKind, tag) {}
-
-
- Stmt* getStmt() const { return (Stmt*) getData1(); }
-
- template <typename T>
- T* getStmtAs() const { return llvm::dyn_cast<T>(getStmt()); }
+ explicit PostStmt(const Stmt* S, const void *tag = 0)
+ : StmtPoint(S, NULL, PostStmtKind, tag) {}
static bool classof(const ProgramPoint* Location) {
unsigned k = Location->getKind();