[lld] r205552 - Remove "virtual" and add "override".

Rui Ueyama ruiu at google.com
Thu Apr 3 11:25:36 PDT 2014


Author: ruiu
Date: Thu Apr  3 13:25:36 2014
New Revision: 205552

URL: http://llvm.org/viewvc/llvm-project?rev=205552&view=rev
Log:
Remove "virtual" and add "override".

Seems clang-modernize couldn't add "override" to nested classes, so
doing it by hand. Also removed unused virtual member function that
is not overriding anything, that seems to have been added by mistake.

Modified:
    lld/trunk/include/lld/Core/File.h

Modified: lld/trunk/include/lld/Core/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/File.h?rev=205552&r1=205551&r2=205552&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/File.h (original)
+++ lld/trunk/include/lld/Core/File.h Thu Apr  3 13:25:36 2014
@@ -164,29 +164,29 @@ protected:
   template <typename T>
   class atom_collection_vector : public atom_collection<T> {
   public:
-    virtual atom_iterator<T> begin() const {
+    atom_iterator<T> begin() const override {
       auto *it = _atoms.empty() ? nullptr
                                 : reinterpret_cast<const void *>(_atoms.data());
       return atom_iterator<T>(*this, it);
     }
 
-    virtual atom_iterator<T> end() const{
+    atom_iterator<T> end() const override {
       auto *it = _atoms.empty() ? nullptr : reinterpret_cast<const void *>(
                                                 _atoms.data() + _atoms.size());
       return atom_iterator<T>(*this, it);
     }
 
-    virtual const T *deref(const void *it) const {
-      return *reinterpret_cast<const T* const*>(it);
+    const T *deref(const void *it) const override {
+      return *reinterpret_cast<const T *const *>(it);
     }
 
-    virtual void next(const void *&it) const {
-      const T *const *p = reinterpret_cast<const T *const*>(it);
+    void next(const void *&it) const override {
+      const T *const *p = reinterpret_cast<const T *const *>(it);
       ++p;
       it = reinterpret_cast<const void*>(p);
     }
 
-    virtual uint64_t size() const { return _atoms.size(); }
+    uint64_t size() const override { return _atoms.size(); }
 
     std::vector<const T *> _atoms;
   };
@@ -196,21 +196,17 @@ protected:
   template <typename T>
   class atom_collection_empty : public atom_collection<T> {
   public:
-    virtual atom_iterator<T> begin() const {
+    atom_iterator<T> begin() const override {
       return atom_iterator<T>(*this, nullptr);
     }
-    virtual atom_iterator<T> end() const{
+    atom_iterator<T> end() const override {
       return atom_iterator<T>(*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<DefinedAtom>       _noDefinedAtoms;





More information about the llvm-commits mailing list