summaryrefslogtreecommitdiffstats
path: root/clang/Analysis/GRConstants.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-01-30 23:24:39 +0000
committerTed Kremenek <kremenek@apple.com>2008-01-30 23:24:39 +0000
commit2531fce319dd676c29da3877048038137995cef4 (patch)
tree0f187659e8a1290586abd6d521a7f6d0c3b0c6d8 /clang/Analysis/GRConstants.cpp
parenta50d98565fc59255858b950d3d4f39a9f7b1bd24 (diff)
downloadbcm5719-llvm-2531fce319dd676c29da3877048038137995cef4.tar.gz
bcm5719-llvm-2531fce319dd676c29da3877048038137995cef4.zip
We now delay adding nodes created by GRBranchNodeBuilder to the analysis
worklist until the dstor of GRBranchNodeBuilderImpl. This way clients can mark creates nodes as "sinks" before they are added to the worklist. llvm-svn: 46582
Diffstat (limited to 'clang/Analysis/GRConstants.cpp')
-rw-r--r--clang/Analysis/GRConstants.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/Analysis/GRConstants.cpp b/clang/Analysis/GRConstants.cpp
index 6d5bdbd1199..36ad5fe20a8 100644
--- a/clang/Analysis/GRConstants.cpp
+++ b/clang/Analysis/GRConstants.cpp
@@ -842,6 +842,10 @@ public:
return St;
}
+
+ bool isUninitControlFlow(const NodeTy* N) const {
+ return N->isSink() && UninitBranches.count(const_cast<NodeTy*>(N)) != 0;
+ }
/// ProcessStmt - Called by GREngine. Used to generate new successor
/// nodes by processing the 'effects' of a block-level statement.
@@ -1474,6 +1478,8 @@ StateTy GRConstants::Assume(StateTy St, NonLValue Cond, bool Assumption,
//===----------------------------------------------------------------------===//
#ifndef NDEBUG
+static GRConstants* GraphPrintCheckerState;
+
namespace llvm {
template<>
struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
@@ -1566,6 +1572,10 @@ struct VISIBILITY_HIDDEN DOTGraphTraits<GRConstants::NodeTy*> :
Out << "\\l";
}
+
+ if (GraphPrintCheckerState->isUninitControlFlow(N)) {
+ Out << "\\|Control-flow based on\\lUninitialized value.\\l";
+ }
}
}
@@ -1587,7 +1597,9 @@ void RunGRConstants(CFG& cfg, FunctionDecl& FD, ASTContext& Ctx) {
GREngine<GRConstants> Engine(cfg, FD, Ctx);
Engine.ExecuteWorkList();
#ifndef NDEBUG
+ GraphPrintCheckerState = &Engine.getCheckerState();
llvm::ViewGraph(*Engine.getGraph().roots_begin(),"GRConstants");
+ GraphPrintCheckerState = NULL;
#endif
}
} // end clang namespace
OpenPOWER on IntegriCloud