aboutsummaryrefslogtreecommitdiff
path: root/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'Analysis')
-rw-r--r--Analysis/GRExprEngine.cpp40
-rw-r--r--Analysis/GRSimpleVals.cpp30
-rw-r--r--Analysis/GRSimpleVals.h1
3 files changed, 39 insertions, 32 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp
index d9f1826bd7..4418afddb6 100644
--- a/Analysis/GRExprEngine.cpp
+++ b/Analysis/GRExprEngine.cpp
@@ -14,7 +14,9 @@
//===----------------------------------------------------------------------===//
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
-#include "GRSimpleVals.h"
+#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
+
+#include "llvm/Support/Streams.h"
using namespace clang;
using llvm::dyn_cast;
@@ -1004,7 +1006,7 @@ GRExprEngine::AssumeSymInt(StateTy St, bool Assumption,
}
//===----------------------------------------------------------------------===//
-// Driver.
+// Visualization.
//===----------------------------------------------------------------------===//
#ifndef NDEBUG
@@ -1210,36 +1212,10 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRExprEngine::NodeTy*> :
} // end llvm namespace
#endif
-namespace clang {
-void RunGRConstants(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx,
- Diagnostic& Diag) {
-
- GRCoreEngine<GRExprEngine> Engine(cfg, FD, Ctx);
- GRExprEngine* CheckerState = &Engine.getCheckerState();
- GRSimpleVals GRSV;
- CheckerState->setTransferFunctions(GRSV);
-
- // Execute the worklist algorithm.
- Engine.ExecuteWorkList();
-
- // Look for explicit-Null dereferences and warn about them.
-
-
- for (GRExprEngine::null_iterator I=CheckerState->null_begin(),
- E=CheckerState->null_end(); I!=E; ++I) {
-
- const PostStmt& L = cast<PostStmt>((*I)->getLocation());
- Expr* E = cast<Expr>(L.getStmt());
-
- Diag.Report(FullSourceLoc(E->getExprLoc(), Ctx.getSourceManager()),
- diag::chkr_null_deref_after_check);
- }
-
-
+void GRExprEngine::ViewGraph() {
#ifndef NDEBUG
- GraphPrintCheckerState = CheckerState;
- llvm::ViewGraph(*Engine.getGraph().roots_begin(),"GRExprEngine");
+ GraphPrintCheckerState = this;
+ llvm::ViewGraph(*G.roots_begin(), "GRExprEngine");
GraphPrintCheckerState = NULL;
-#endif
+#endif
}
-} // end clang namespace
diff --git a/Analysis/GRSimpleVals.cpp b/Analysis/GRSimpleVals.cpp
index 200c9a39c6..490ed7f31e 100644
--- a/Analysis/GRSimpleVals.cpp
+++ b/Analysis/GRSimpleVals.cpp
@@ -14,9 +14,39 @@
//===----------------------------------------------------------------------===//
#include "GRSimpleVals.h"
+#include "clang/Basic/Diagnostic.h"
using namespace clang;
+namespace clang {
+ void RunGRSimpleVals(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx,
+ Diagnostic& Diag) {
+
+ GRCoreEngine<GRExprEngine> Engine(cfg, FD, Ctx);
+ GRExprEngine* CheckerState = &Engine.getCheckerState();
+ GRSimpleVals GRSV;
+ CheckerState->setTransferFunctions(GRSV);
+
+ // Execute the worklist algorithm.
+ Engine.ExecuteWorkList();
+
+ // Look for explicit-Null dereferences and warn about them.
+ for (GRExprEngine::null_iterator I=CheckerState->null_begin(),
+ E=CheckerState->null_end(); I!=E; ++I) {
+
+ const PostStmt& L = cast<PostStmt>((*I)->getLocation());
+ Expr* E = cast<Expr>(L.getStmt());
+
+ Diag.Report(FullSourceLoc(E->getExprLoc(), Ctx.getSourceManager()),
+ diag::chkr_null_deref_after_check);
+ }
+
+#ifndef NDEBUG
+ CheckerState->ViewGraph();
+#endif
+ }
+} // end clang namespace
+
//===----------------------------------------------------------------------===//
// Transfer function for Casts.
//===----------------------------------------------------------------------===//
diff --git a/Analysis/GRSimpleVals.h b/Analysis/GRSimpleVals.h
index 1ed69688b8..0f517fe5eb 100644
--- a/Analysis/GRSimpleVals.h
+++ b/Analysis/GRSimpleVals.h
@@ -17,6 +17,7 @@
#define LLVM_CLANG_ANALYSIS_GRSIMPLEVALS
#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
+#include "clang/Analysis/PathSensitive/GRExprEngine.h"
namespace clang {