cyclegraph: add non-NULL assertions
authorBrian Norris <banorris@uci.edu>
Wed, 12 Sep 2012 00:54:29 +0000 (17:54 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 12 Sep 2012 00:56:46 +0000 (17:56 -0700)
cyclegraph.cc

index 967b0763abbdcdba0ec35cdd2608cb0fa94caa13..9256deb936be5ae69cb376efc60e7ced207222b5 100644 (file)
@@ -1,5 +1,6 @@
 #include "cyclegraph.h"
 #include "action.h"
 #include "cyclegraph.h"
 #include "action.h"
+#include "common.h"
 
 /** Initializes a CycleGraph object. */
 CycleGraph::CycleGraph() :
 
 /** 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) {
  * @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);
 
        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) {
  *  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);
 
        CycleNode *fromnode=getNode(from);
        CycleNode *rmwnode=getNode(rmw);