From: Brian Norris Date: Fri, 6 Jul 2012 23:08:34 +0000 (-0700) Subject: add more const qualifiers X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=1745637aab8a1d85eb605b9ef9e92d4fbb437633 add more const qualifiers --- diff --git a/action.cc b/action.cc index 6627714e..68a34aad 100644 --- a/action.cc +++ b/action.cc @@ -115,7 +115,7 @@ bool ModelAction::is_synchronizing(const ModelAction *act) const return false; } -void ModelAction::create_cv(ModelAction *parent) +void ModelAction::create_cv(const ModelAction *parent) { ASSERT(cv == NULL); @@ -125,7 +125,7 @@ void ModelAction::create_cv(ModelAction *parent) cv = new ClockVector(NULL, this); } -void ModelAction::read_from(ModelAction *act) +void ModelAction::read_from(const ModelAction *act) { ASSERT(cv); if (act->is_release() && this->is_acquire()) @@ -139,7 +139,7 @@ void ModelAction::read_from(ModelAction *act) * @return true if this action's thread has synchronized with act's thread * since the execution of act, false otherwise. */ -bool ModelAction::happens_before(ModelAction *act) +bool ModelAction::happens_before(const ModelAction *act) const { return act->cv->synchronized_since(this); } diff --git a/action.h b/action.h index 0200111d..c84381dc 100644 --- a/action.h +++ b/action.h @@ -58,11 +58,11 @@ public: bool same_thread(const ModelAction *act) const; bool is_synchronizing(const ModelAction *act) const; - void create_cv(ModelAction *parent = NULL); + void create_cv(const ModelAction *parent = NULL); ClockVector * get_cv() const { return cv; } - void read_from(ModelAction *act); + void read_from(const ModelAction *act); - bool happens_before(ModelAction *act); + bool happens_before(const ModelAction *act) const; inline bool operator <(const ModelAction& act) const { return get_seq_number() < act.get_seq_number(); diff --git a/clockvector.cc b/clockvector.cc index e0ced522..cfd99c66 100644 --- a/clockvector.cc +++ b/clockvector.cc @@ -75,7 +75,7 @@ void ClockVector::merge(ClockVector *cv) * thread, false otherwise. That is, this function returns: *
act <= cv[act->tid] */ -bool ClockVector::synchronized_since(ModelAction *act) const +bool ClockVector::synchronized_since(const ModelAction *act) const { int i = id_to_int(act->get_tid()); diff --git a/clockvector.h b/clockvector.h index 82f1e377..1428886c 100644 --- a/clockvector.h +++ b/clockvector.h @@ -17,7 +17,7 @@ public: ClockVector(ClockVector *parent = NULL, ModelAction *act = NULL); ~ClockVector(); void merge(ClockVector *cv); - bool synchronized_since(ModelAction *act) const; + bool synchronized_since(const ModelAction *act) const; void print() const; modelclock_t getClock(thread_id_t thread);