Remove atom_collection_empty class.
authorRui Ueyama <ruiu@google.com>
Wed, 8 Apr 2015 21:59:00 +0000 (21:59 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 8 Apr 2015 21:59:00 +0000 (21:59 +0000)
llvm-svn: 234442

lld/include/lld/Core/File.h
lld/lib/Core/File.cpp

index cfb58eb..e43141b 100644 (file)
@@ -223,28 +223,10 @@ protected:
     std::vector<const T *> _atoms;
   };
 
-  /// \brief This is a convenience class for File subclasses which need to
-  /// return an empty collection.
-  template <typename T>
-  class atom_collection_empty : public atom_collection<T> {
-  public:
-    atom_iterator<T> begin() const override {
-      return atom_iterator<T>(*this, nullptr);
-    }
-    atom_iterator<T> end() const override {
-      return atom_iterator<T>(*this, nullptr);
-    }
-    const T *deref(const void *it) const override {
-      llvm_unreachable("empty collection should never be accessed");
-    }
-    void next(const void *&it) const override {}
-    uint64_t size() const override { return 0; }
-  };
-
-  static atom_collection_empty<DefinedAtom>       _noDefinedAtoms;
-  static atom_collection_empty<UndefinedAtom>     _noUndefinedAtoms;
-  static atom_collection_empty<SharedLibraryAtom> _noSharedLibraryAtoms;
-  static atom_collection_empty<AbsoluteAtom>      _noAbsoluteAtoms;
+  static atom_collection_vector<DefinedAtom>       _noDefinedAtoms;
+  static atom_collection_vector<UndefinedAtom>     _noUndefinedAtoms;
+  static atom_collection_vector<SharedLibraryAtom> _noSharedLibraryAtoms;
+  static atom_collection_vector<AbsoluteAtom>      _noAbsoluteAtoms;
   mutable llvm::BumpPtrAllocator                  _allocator;
 
 private:
index dbac86b..f07d2cc 100644 (file)
@@ -15,10 +15,10 @@ namespace lld {
 
 File::~File() {}
 
-File::atom_collection_empty<DefinedAtom>       File::_noDefinedAtoms;
-File::atom_collection_empty<UndefinedAtom>     File::_noUndefinedAtoms;
-File::atom_collection_empty<SharedLibraryAtom> File::_noSharedLibraryAtoms;
-File::atom_collection_empty<AbsoluteAtom>      File::_noAbsoluteAtoms;
+File::atom_collection_vector<DefinedAtom>       File::_noDefinedAtoms;
+File::atom_collection_vector<UndefinedAtom>     File::_noUndefinedAtoms;
+File::atom_collection_vector<SharedLibraryAtom> File::_noSharedLibraryAtoms;
+File::atom_collection_vector<AbsoluteAtom>      File::_noAbsoluteAtoms;
 
 std::error_code File::parse() {
   std::lock_guard<std::mutex> lock(_parseMutex);