From 776fc7207dec4959b4fa3e4bd7cb71cc38a19353 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 1 Feb 2013 17:47:57 -0800 Subject: [PATCH] cyclegraph: template-ize checkReachable() ModelChecker will need to query the mo_graph regarding the modification order of promised future writes. --- cyclegraph.cc | 7 ++++--- cyclegraph.h | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cyclegraph.cc b/cyclegraph.cc index 46b0d4a..54b9123 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -275,12 +275,13 @@ void CycleGraph::dumpGraphToFile(const char *filename) const #endif /** - * Checks whether one ModelAction can reach another. + * Checks whether one ModelAction can reach another ModelAction/Promise * @param from The ModelAction from which to begin exploration - * @param to The ModelAction to reach + * @param to The ModelAction or Promise to reach * @return True, @a from can reach @a to; otherwise, false */ -bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to) const +template +bool CycleGraph::checkReachable(const ModelAction *from, const T *to) const { CycleNode *fromnode = actionToNode.get(from); CycleNode *tonode = actionToNode.get(to); diff --git a/cyclegraph.h b/cyclegraph.h index c0bd7d6..c9c575a 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -33,7 +33,10 @@ class CycleGraph { bool checkForCycles() const; void addRMWEdge(const ModelAction *from, const ModelAction *rmw); bool checkPromise(const ModelAction *from, Promise *p) const; - bool checkReachable(const ModelAction *from, const ModelAction *to) const; + + template + bool checkReachable(const ModelAction *from, const T *to) const; + void startChanges(); void commitChanges(); void rollbackChanges(); -- 2.34.1