aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-07 15:20:13 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-07 15:20:13 +0000
commit7e593360e6c11d3b6285b4dc89ab4c6f851f5832 (patch)
tree115fdfc41f4f00ba2322d10d8d7686f22d342d7e
parent19227e32af1f903541214ef24f693688e67c58d6 (diff)
Added some more opcode pretty-printing.
Minor cleanups with generating nodes for NULL-pointer dereferences. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46851 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Analysis/GRConstants.cpp13
-rw-r--r--Analysis/RValues.cpp4
2 files changed, 10 insertions, 7 deletions
diff --git a/Analysis/GRConstants.cpp b/Analysis/GRConstants.cpp
index 84b0debb61..858ed9360a 100644
--- a/Analysis/GRConstants.cpp
+++ b/Analysis/GRConstants.cpp
@@ -260,8 +260,7 @@ public:
StateTy AssumeSymInt(StateTy St, bool Assumption, const SymIntConstraint& C,
bool& isFeasible);
- NodeTy* Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St,
- bool AlwaysMakeNode = false);
+ NodeTy* Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St);
/// Nodify - This version of Nodify is used to batch process a set of states.
/// The states are not guaranteed to be unique.
@@ -582,11 +581,10 @@ GRConstants::StateTy GRConstants::RemoveDeadBindings(Stmt* Loc, StateTy M) {
}
GRConstants::NodeTy*
-GRConstants::Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St,
- bool AlwaysMakeNode) {
+GRConstants::Nodify(NodeSet& Dst, Stmt* S, NodeTy* Pred, StateTy St) {
// If the state hasn't changed, don't generate a new node.
- if (!AlwaysMakeNode && St == Pred->getState())
+ if (St == Pred->getState())
return NULL;
NodeTy* N = Builder->generateNode(S, St, Pred);
@@ -807,7 +805,10 @@ void GRConstants::VisitUnaryOperator(UnaryOperator* U,
StateTy StNull = Assume(St, L1, false, isFeasibleNull);
if (isFeasibleNull) {
- NodeTy* NullNode = Nodify(Dst, U, N1, StNull, true);
+ // We don't use "Nodify" here because the node will be a sink
+ // and we have no intention of processing it later.
+ NodeTy* NullNode = Builder->generateNode(U, StNull, N1);
+
if (NullNode) {
NullNode->markAsSink();
diff --git a/Analysis/RValues.cpp b/Analysis/RValues.cpp
index d0f60fbe63..387a30cf63 100644
--- a/Analysis/RValues.cpp
+++ b/Analysis/RValues.cpp
@@ -525,7 +525,9 @@ void RValue::print(std::ostream& Out) const {
}
static void printOpcode(std::ostream& Out, BinaryOperator::Opcode Op) {
- switch (Op) {
+ switch (Op) {
+ case BinaryOperator::Add: Out << "+" ; break;
+ case BinaryOperator::Sub: Out << "-" ; break;
case BinaryOperator::EQ: Out << "=="; break;
case BinaryOperator::NE: Out << "!="; break;
default: assert(false && "Not yet implemented.");