summaryrefslogtreecommitdiff
path: root/src/context
diff options
context:
space:
mode:
authorMathias Preiner <mathias.preiner@gmail.com>2018-03-05 15:36:50 -0800
committerGitHub <noreply@github.com>2018-03-05 15:36:50 -0800
commit3d31caa30e094d337a4919b3d1e6ba9259e461b8 (patch)
treee99bc99c2ce450f7d0c4fa8c0938b24e886af996 /src/context
parenta2e78ec8dd5e935b6ef166154be7ee35bffc6d32 (diff)
Enable -Wsuggest-override by default. (#1643)
Adds missing override keywords.
Diffstat (limited to 'src/context')
-rw-r--r--src/context/cdhashmap.h14
-rw-r--r--src/context/cdinsert_hashmap.h39
-rw-r--r--src/context/cdlist.h25
-rw-r--r--src/context/cdo.h6
-rw-r--r--src/context/cdqueue.h6
-rw-r--r--src/context/cdtrail_hashmap.h34
6 files changed, 67 insertions, 57 deletions
diff --git a/src/context/cdhashmap.h b/src/context/cdhashmap.h
index 82aa90891..14832679d 100644
--- a/src/context/cdhashmap.h
+++ b/src/context/cdhashmap.h
@@ -111,11 +111,13 @@ class CDOhash_map : public ContextObj {
CDOhash_map* d_prev;
CDOhash_map* d_next;
- virtual ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
return new(pCMM) CDOhash_map(*this);
}
- virtual void restore(ContextObj* data) {
+ void restore(ContextObj* data) override
+ {
CDOhash_map* p = static_cast<CDOhash_map*>(data);
if(d_map != NULL) {
if(p->d_map == NULL) {
@@ -279,14 +281,10 @@ class CDHashMap : public ContextObj {
Context* d_context;
// Nothing to save; the elements take care of themselves
- virtual ContextObj* save(ContextMemoryManager* pCMM) {
- Unreachable();
- }
+ ContextObj* save(ContextMemoryManager* pCMM) override { Unreachable(); }
// Similarly, nothing to restore
- virtual void restore(ContextObj* data) {
- Unreachable();
- }
+ void restore(ContextObj* data) override { Unreachable(); }
// no copy or assignment
CDHashMap(const CDHashMap&) CVC4_UNDEFINED;
diff --git a/src/context/cdinsert_hashmap.h b/src/context/cdinsert_hashmap.h
index db679c1f7..9211ff7da 100644
--- a/src/context/cdinsert_hashmap.h
+++ b/src/context/cdinsert_hashmap.h
@@ -221,7 +221,8 @@ private:
* restored on a pop). The saved information is allocated using the
* ContextMemoryManager.
*/
- ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
ContextObj* data = new(pCMM) CDInsertHashMap<Key, Data, HashFcn>(*this);
Debug("CDInsertHashMap") << "save " << this
<< " at level " << this->getContext()->getLevel()
@@ -237,23 +238,25 @@ protected:
* of new pushFront calls have happened since saving.
* The d_insertMap is untouched and d_pushFronts is also kept.
*/
- void restore(ContextObj* data) {
- Debug("CDInsertHashMap") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " data == " << data
- << " d_insertMap == " << this->d_insertMap << std::endl;
- size_t oldSize = ((CDInsertHashMap<Key, Data, HashFcn>*)data)->d_size;
- size_t oldPushFronts = ((CDInsertHashMap<Key, Data, HashFcn>*)data)->d_pushFronts;
- Assert(oldPushFronts <= d_pushFronts);
-
- // The size to restore to.
- size_t restoreSize = oldSize + (d_pushFronts - oldPushFronts);
- d_insertMap->pop_to_size(restoreSize);
- d_size = restoreSize;
- Assert(d_insertMap->size() == d_size);
- Debug("CDInsertHashMap") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " size back to " << this->d_size << std::endl;
+ void restore(ContextObj* data) override
+ {
+ Debug("CDInsertHashMap")
+ << "restore " << this << " level " << this->getContext()->getLevel()
+ << " data == " << data << " d_insertMap == " << this->d_insertMap
+ << std::endl;
+ size_t oldSize = ((CDInsertHashMap<Key, Data, HashFcn>*)data)->d_size;
+ size_t oldPushFronts =
+ ((CDInsertHashMap<Key, Data, HashFcn>*)data)->d_pushFronts;
+ Assert(oldPushFronts <= d_pushFronts);
+
+ // The size to restore to.
+ size_t restoreSize = oldSize + (d_pushFronts - oldPushFronts);
+ d_insertMap->pop_to_size(restoreSize);
+ d_size = restoreSize;
+ Assert(d_insertMap->size() == d_size);
+ Debug("CDInsertHashMap")
+ << "restore " << this << " level " << this->getContext()->getLevel()
+ << " size back to " << this->d_size << std::endl;
}
public:
diff --git a/src/context/cdlist.h b/src/context/cdlist.h
index aeb6567a3..e5f9f2dda 100644
--- a/src/context/cdlist.h
+++ b/src/context/cdlist.h
@@ -165,7 +165,8 @@ private:
* restored on a pop). The saved information is allocated using the
* ContextMemoryManager.
*/
- ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
ContextObj* data = new(pCMM) CDList<T, CleanUp, Allocator>(*this);
Debug("cdlist") << "save " << this
<< " at level " << this->getContext()->getLevel()
@@ -182,17 +183,17 @@ protected:
* restores the previous size. Note that the list pointer and the
* allocated size are not changed.
*/
- void restore(ContextObj* data) {
- Debug("cdlist") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " data == " << data
- << " call dtor == " << this->d_callDestructor
- << " d_list == " << this->d_list << std::endl;
- truncateList(((CDList<T, CleanUp, Allocator>*)data)->d_size);
- Debug("cdlist") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " size back to " << this->d_size
- << " sizeAlloc at " << this->d_sizeAlloc << std::endl;
+ void restore(ContextObj* data) override
+ {
+ Debug("cdlist") << "restore " << this << " level "
+ << this->getContext()->getLevel() << " data == " << data
+ << " call dtor == " << this->d_callDestructor
+ << " d_list == " << this->d_list << std::endl;
+ truncateList(((CDList<T, CleanUp, Allocator>*)data)->d_size);
+ Debug("cdlist") << "restore " << this << " level "
+ << this->getContext()->getLevel() << " size back to "
+ << this->d_size << " sizeAlloc at " << this->d_sizeAlloc
+ << std::endl;
}
/**
diff --git a/src/context/cdo.h b/src/context/cdo.h
index 3142fe8ef..bac9eb360 100644
--- a/src/context/cdo.h
+++ b/src/context/cdo.h
@@ -57,7 +57,8 @@ protected:
* current data to a copy using the copy constructor. Memory is allocated
* using the ContextMemoryManager.
*/
- virtual ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
Debug("context") << "save cdo " << this;
ContextObj* p = new(pCMM) CDO<T>(*this);
Debug("context") << " to " << p << std::endl;
@@ -68,7 +69,8 @@ protected:
* Implementation of mandatory ContextObj method restore: simply copies the
* saved data back from the saved copy using operator= for T.
*/
- virtual void restore(ContextObj* pContextObj) {
+ void restore(ContextObj* pContextObj) override
+ {
//Debug("context") << "restore cdo " << this;
CDO<T>* p = static_cast<CDO<T>*>(pContextObj);
d_data = p->d_data;
diff --git a/src/context/cdqueue.h b/src/context/cdqueue.h
index 1df985b48..305e2de77 100644
--- a/src/context/cdqueue.h
+++ b/src/context/cdqueue.h
@@ -60,7 +60,8 @@ protected:
/** Implementation of mandatory ContextObj method save:
* We assume that the base class do the job inside their copy constructor.
*/
- ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
ContextObj* data = new(pCMM) CDQueue<T, CleanUp, Allocator>(*this);
// We save the d_size in d_lastsave and we should never destruct below this
// indices before the corresponding restore.
@@ -80,7 +81,8 @@ protected:
* restores the previous size, iter and lastsave indices. Note that
* the list pointer and the allocated size are not changed.
*/
- void restore(ContextObj* data) {
+ void restore(ContextObj* data) override
+ {
CDQueue<T, CleanUp, Allocator>* qdata = static_cast<CDQueue<T, CleanUp, Allocator>*>(data);
d_iter = qdata->d_iter;
d_lastsave = qdata->d_lastsave;
diff --git a/src/context/cdtrail_hashmap.h b/src/context/cdtrail_hashmap.h
index bbd71f8cd..771cea960 100644
--- a/src/context/cdtrail_hashmap.h
+++ b/src/context/cdtrail_hashmap.h
@@ -394,7 +394,8 @@ private:
* the current sizes to a copy using the copy constructor,
* The saved information is allocated using the ContextMemoryManager.
*/
- ContextObj* save(ContextMemoryManager* pCMM) {
+ ContextObj* save(ContextMemoryManager* pCMM) override
+ {
ContextObj* data = new(pCMM) CDTrailHashMap<Key, Data, HashFcn>(*this);
Debug("CDTrailHashMap") << "save " << this
<< " at level " << this->getContext()->getLevel()
@@ -409,20 +410,23 @@ protected:
* restores the previous size. Note that the list pointer and the
* allocated size are not changed.
*/
- void restore(ContextObj* data) {
- Debug("CDTrailHashMap") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " data == " << data
- << " d_trailMap == " << this->d_trailMap << std::endl;
- size_t oldSize = ((CDTrailHashMap<Key, Data, HashFcn>*)data)->d_trailSize;
- d_trailMap->pop_to_size(oldSize);
- d_trailSize = oldSize;
- Assert(d_trailMap->trailSize() == d_trailSize);
-
- d_prevTrailSize = ((CDTrailHashMap<Key, Data, HashFcn>*)data)->d_prevTrailSize;
- Debug("CDTrailHashMap") << "restore " << this
- << " level " << this->getContext()->getLevel()
- << " size back to " << this->d_trailSize << std::endl;
+ void restore(ContextObj* data) override
+ {
+ Debug("CDTrailHashMap") << "restore " << this << " level "
+ << this->getContext()->getLevel()
+ << " data == " << data
+ << " d_trailMap == " << this->d_trailMap
+ << std::endl;
+ size_t oldSize = ((CDTrailHashMap<Key, Data, HashFcn>*)data)->d_trailSize;
+ d_trailMap->pop_to_size(oldSize);
+ d_trailSize = oldSize;
+ Assert(d_trailMap->trailSize() == d_trailSize);
+
+ d_prevTrailSize =
+ ((CDTrailHashMap<Key, Data, HashFcn>*)data)->d_prevTrailSize;
+ Debug("CDTrailHashMap") << "restore " << this << " level "
+ << this->getContext()->getLevel() << " size back to "
+ << this->d_trailSize << std::endl;
}
/**
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback