aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-07 20:57:30 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-07 20:57:30 +0000
commite97ca065c91ff9ca2a2a42eb443eaa553c40441c (patch)
treed2736f95a3900f84b20876afc88b78ea0b21cacd
parent240f1f00dda1d481276ea872fe8f8851581a7e6b (diff)
Improved graph visualization of ExplodedGraphs to include source line and column
information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48031 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Analysis/GRExprEngine.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp
index 87c3bd74a0..aaef2f8cb0 100644
--- a/Analysis/GRExprEngine.cpp
+++ b/Analysis/GRExprEngine.cpp
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
+#include "clang/Basic/SourceManager.h"
#include "llvm/Support/Streams.h"
#ifndef NDEBUG
@@ -1563,6 +1564,7 @@ GRExprEngine::AssumeSymInt(ValueState* St, bool Assumption,
#ifndef NDEBUG
static GRExprEngine* GraphPrintCheckerState;
+static SourceManager* GraphPrintSourceManager;
namespace llvm {
template<>
@@ -1702,11 +1704,16 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRExprEngine::NodeTy*> :
break;
case ProgramPoint::PostStmtKind: {
- const PostStmt& L = cast<PostStmt>(Loc);
- Out << L.getStmt()->getStmtClassName() << ':'
- << (void*) L.getStmt() << ' ';
+ const PostStmt& L = cast<PostStmt>(Loc);
+ Stmt* S = L.getStmt();
+ SourceLocation SLoc = S->getLocStart();
+
+ Out << S->getStmtClassName() << ' ' << (void*) S << ' ';
+ S->printPretty(Out);
- L.getStmt()->printPretty(Out);
+ Out << "\\lline="
+ << GraphPrintSourceManager->getLineNumber(SLoc) << " col="
+ << GraphPrintSourceManager->getColumnNumber(SLoc) << "\\l";
if (GraphPrintCheckerState->isImplicitNullDeref(N))
Out << "\\|Implicit-Null Dereference.\\l";
@@ -1738,9 +1745,17 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRExprEngine::NodeTy*> :
<< E.getDst()->getBlockID() << ')';
if (Stmt* T = E.getSrc()->getTerminator()) {
+
+ SourceLocation SLoc = T->getLocStart();
+
Out << "\\|Terminator: ";
+
E.getSrc()->printTerminator(Out);
+ Out << "\\lline="
+ << GraphPrintSourceManager->getLineNumber(SLoc) << " col="
+ << GraphPrintSourceManager->getColumnNumber(SLoc);
+
if (isa<SwitchStmt>(T)) {
Stmt* Label = E.getDst()->getLabel();
@@ -1798,7 +1813,9 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRExprEngine::NodeTy*> :
void GRExprEngine::ViewGraph() {
#ifndef NDEBUG
GraphPrintCheckerState = this;
+ GraphPrintSourceManager = &getContext().getSourceManager();
llvm::ViewGraph(*G.roots_begin(), "GRExprEngine");
GraphPrintCheckerState = NULL;
+ GraphPrintSourceManager = NULL;
#endif
}