From: Brian Norris <banorris@uci.edu>
Date: Wed, 12 Sep 2012 00:54:29 +0000 (-0700)
Subject: cyclegraph: add non-NULL assertions
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ae25995a404cb06c3e89dd878c7abd763449cdb3;p=cdsspec-compiler.git

cyclegraph: add non-NULL assertions
---

diff --git a/cyclegraph.cc b/cyclegraph.cc
index 967b076..9256deb 100644
--- a/cyclegraph.cc
+++ b/cyclegraph.cc
@@ -1,5 +1,6 @@
 #include "cyclegraph.h"
 #include "action.h"
+#include "common.h"
 
 /** Initializes a CycleGraph object. */
 CycleGraph::CycleGraph() :
@@ -33,6 +34,9 @@ CycleNode * CycleGraph::getNode(const ModelAction *action) {
  * @param from The edge comes from this ModelAction
  */
 void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
+	ASSERT(from);
+	ASSERT(to);
+
 	CycleNode *fromnode=getNode(from);
 	CycleNode *tonode=getNode(to);
 
@@ -65,6 +69,9 @@ void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
  *  action can read from a given write.
  */
 void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
+	ASSERT(from);
+	ASSERT(rmw);
+
 	CycleNode *fromnode=getNode(from);
 	CycleNode *rmwnode=getNode(rmw);