diff --git a/lld/include/lld/Core/File.h b/lld/include/lld/Core/File.h index 45dbbfef903f..e32e58e48905 100644 --- a/lld/include/lld/Core/File.h +++ b/lld/include/lld/Core/File.h @@ -164,29 +164,29 @@ protected: template class atom_collection_vector : public atom_collection { public: - virtual atom_iterator begin() const { + atom_iterator begin() const override { auto *it = _atoms.empty() ? nullptr : reinterpret_cast(_atoms.data()); return atom_iterator(*this, it); } - virtual atom_iterator end() const{ + atom_iterator end() const override { auto *it = _atoms.empty() ? nullptr : reinterpret_cast( _atoms.data() + _atoms.size()); return atom_iterator(*this, it); } - virtual const T *deref(const void *it) const { - return *reinterpret_cast(it); + const T *deref(const void *it) const override { + return *reinterpret_cast(it); } - virtual void next(const void *&it) const { - const T *const *p = reinterpret_cast(it); + void next(const void *&it) const override { + const T *const *p = reinterpret_cast(it); ++p; it = reinterpret_cast(p); } - virtual uint64_t size() const { return _atoms.size(); } + uint64_t size() const override { return _atoms.size(); } std::vector _atoms; }; @@ -196,21 +196,17 @@ protected: template class atom_collection_empty : public atom_collection { public: - virtual atom_iterator begin() const { + atom_iterator begin() const override { return atom_iterator(*this, nullptr); } - virtual atom_iterator end() const{ + atom_iterator end() const override { return atom_iterator(*this, nullptr); } - virtual const T *deref(const void *it) const { + const T *deref(const void *it) const override { llvm_unreachable("empty collection should never be accessed"); } - virtual void next(const void *&it) const { - } - virtual void push_back(const T *element) { - llvm_unreachable("empty collection should never be grown"); - } - virtual uint64_t size() const { return 0; } + void next(const void *&it) const override {} + uint64_t size() const override { return 0; } }; static atom_collection_empty _noDefinedAtoms;