Delete dead code. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 8 Aug 2014 16:49:35 +0000 (16:49 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 8 Aug 2014 16:49:35 +0000 (16:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215224 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Object/COFF.h
include/llvm/Object/ELFObjectFile.h
include/llvm/Object/MachO.h
include/llvm/Object/ObjectFile.h
lib/Object/COFFObjectFile.cpp
lib/Object/MachOObjectFile.cpp

index a0110cb253cceb62fccfa8aa2f7797be6bd3f257..1e8d2c18f3ac3cf605b281e87e9b20349b48a29b 100644 (file)
@@ -414,17 +414,10 @@ protected:
   getRelocationValueString(DataRefImpl Rel,
                            SmallVectorImpl<char> &Result) const override;
 
-  std::error_code getLibraryNext(DataRefImpl LibData,
-                                 LibraryRef &Result) const override;
-  std::error_code getLibraryPath(DataRefImpl LibData,
-                                 StringRef &Result) const override;
-
 public:
   COFFObjectFile(std::unique_ptr<MemoryBuffer> Object, std::error_code &EC);
   basic_symbol_iterator symbol_begin_impl() const override;
   basic_symbol_iterator symbol_end_impl() const override;
-  library_iterator needed_library_begin() const override;
-  library_iterator needed_library_end() const override;
   section_iterator section_begin() const override;
   section_iterator section_end() const override;
 
index 1b6661f815333062fb4158895f49cb2d9ce4ea8e..c36e1807138367f4d61b00494c65d08795c7c1aa 100644 (file)
@@ -71,11 +71,6 @@ protected:
   std::error_code getSymbolSection(DataRefImpl Symb,
                                    section_iterator &Res) const override;
 
-  std::error_code getLibraryNext(DataRefImpl Data,
-                                 LibraryRef &Result) const override;
-  std::error_code getLibraryPath(DataRefImpl Data,
-                                 StringRef &Res) const override;
-
   void moveSectionNext(DataRefImpl &Sec) const override;
   std::error_code getSectionName(DataRefImpl Sec,
                                  StringRef &Res) const override;
@@ -191,9 +186,6 @@ public:
   section_iterator section_begin() const override;
   section_iterator section_end() const override;
 
-  library_iterator needed_library_begin() const override;
-  library_iterator needed_library_end() const override;
-
   std::error_code getRelocationAddend(DataRefImpl Rel, int64_t &Res) const;
   std::error_code getSymbolVersion(SymbolRef Symb, StringRef &Version,
                                    bool &IsDefault) const;
@@ -837,44 +829,6 @@ StringRef ELFObjectFile<ELFT>::getLoadName() const {
   return "";
 }
 
-template <class ELFT>
-library_iterator ELFObjectFile<ELFT>::needed_library_begin() const {
-  Elf_Dyn_Iter DI = EF.begin_dynamic_table();
-  Elf_Dyn_Iter DE = EF.end_dynamic_table();
-
-  while (DI != DE && DI->getTag() != ELF::DT_SONAME)
-    ++DI;
-
-  return library_iterator(LibraryRef(toDRI(DI), this));
-}
-
-template <class ELFT>
-std::error_code ELFObjectFile<ELFT>::getLibraryNext(DataRefImpl Data,
-                                                    LibraryRef &Result) const {
-  Elf_Dyn_Iter DI = toELFDynIter(Data);
-  Elf_Dyn_Iter DE = EF.end_dynamic_table();
-
-  // Skip to the next DT_NEEDED entry.
-  do
-    ++DI;
-  while (DI != DE && DI->getTag() != ELF::DT_NEEDED);
-
-  Result = LibraryRef(toDRI(DI), this);
-  return object_error::success;
-}
-
-template <class ELFT>
-std::error_code ELFObjectFile<ELFT>::getLibraryPath(DataRefImpl Data,
-                                                    StringRef &Res) const {
-  Res = EF.getDynamicString(toELFDynIter(Data)->getVal());
-  return object_error::success;
-}
-
-template <class ELFT>
-library_iterator ELFObjectFile<ELFT>::needed_library_end() const {
-  return library_iterator(LibraryRef(toDRI(EF.end_dynamic_table()), this));
-}
-
 template <class ELFT>
 uint8_t ELFObjectFile<ELFT>::getBytesInAddress() const {
   return ELFT::Is64Bits ? 8 : 4;
index d9a5564088b128c4a640de05cf5c56db06b69360..808ab11b7657ed1db4791645301ea22e00e0b63d 100644 (file)
@@ -118,11 +118,6 @@ public:
   std::error_code getRelocationHidden(DataRefImpl Rel,
                                       bool &Result) const override;
 
-  std::error_code getLibraryNext(DataRefImpl LibData,
-                                 LibraryRef &Res) const override;
-  std::error_code getLibraryPath(DataRefImpl LibData,
-                                 StringRef &Res) const override;
-
   // MachO specific.
   std::error_code getLibraryShortNameByIndex(unsigned Index, StringRef &Res);
 
@@ -138,9 +133,6 @@ public:
   section_iterator section_begin() const override;
   section_iterator section_end() const override;
 
-  library_iterator needed_library_begin() const override;
-  library_iterator needed_library_end() const override;
-
   uint8_t getBytesInAddress() const override;
 
   StringRef getFileFormatName() const override;
index 64d64dcf56665837c3e00ce9ef61a42a141fd2cc..93e116a90b486bb4a33ae94692f46ba87c061e84 100644 (file)
@@ -178,30 +178,6 @@ public:
   }
 };
 
-/// LibraryRef - This is a value type class that represents a single library in
-/// the list of libraries needed by a shared or dynamic object.
-class LibraryRef {
-  friend class SectionRef;
-  DataRefImpl LibraryPimpl;
-  const ObjectFile *OwningObject;
-
-public:
-  LibraryRef() : OwningObject(nullptr) { }
-
-  LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner);
-
-  bool operator==(const LibraryRef &Other) const;
-  bool operator<(const LibraryRef &Other) const;
-
-  std::error_code getNext(LibraryRef &Result) const;
-
-  // Get the path to this library, as stored in the object file.
-  std::error_code getPath(StringRef &Result) const;
-
-  DataRefImpl getRawDataRefImpl() const;
-};
-typedef content_iterator<LibraryRef> library_iterator;
-
 /// ObjectFile - This class is the base class for all object file types.
 /// Concrete instances of this object are created by createObjectFile, which
 /// figures out which type to create.
@@ -299,13 +275,6 @@ protected:
     return object_error::success;
   }
 
-  // Same for LibraryRef
-  friend class LibraryRef;
-  virtual std::error_code getLibraryNext(DataRefImpl Lib,
-                                         LibraryRef &Res) const = 0;
-  virtual std::error_code getLibraryPath(DataRefImpl Lib,
-                                         StringRef &Res) const = 0;
-
 public:
   typedef iterator_range<symbol_iterator> symbol_iterator_range;
   symbol_iterator_range symbols() const {
@@ -320,9 +289,6 @@ public:
     return section_iterator_range(section_begin(), section_end());
   }
 
-  virtual library_iterator needed_library_begin() const = 0;
-  virtual library_iterator needed_library_end() const = 0;
-
   /// @brief The number of bytes used to represent an address in this object
   ///        file format.
   virtual uint8_t getBytesInAddress() const = 0;
@@ -549,26 +515,6 @@ inline const ObjectFile *RelocationRef::getObjectFile() const {
   return OwningObject;
 }
 
-// Inline function definitions.
-inline LibraryRef::LibraryRef(DataRefImpl LibraryP, const ObjectFile *Owner)
-  : LibraryPimpl(LibraryP)
-  , OwningObject(Owner) {}
-
-inline bool LibraryRef::operator==(const LibraryRef &Other) const {
-  return LibraryPimpl == Other.LibraryPimpl;
-}
-
-inline bool LibraryRef::operator<(const LibraryRef &Other) const {
-  return LibraryPimpl < Other.LibraryPimpl;
-}
-
-inline std::error_code LibraryRef::getNext(LibraryRef &Result) const {
-  return OwningObject->getLibraryNext(LibraryPimpl, Result);
-}
-
-inline std::error_code LibraryRef::getPath(StringRef &Result) const {
-  return OwningObject->getLibraryPath(LibraryPimpl, Result);
-}
 
 } // end namespace object
 } // end namespace llvm
index 55f275163605d91166f376f02c8021ffe9d9b438..29ea0a1a79c33315c636c3e124ae2c40f6b10f2d 100644 (file)
@@ -610,16 +610,6 @@ basic_symbol_iterator COFFObjectFile::symbol_end_impl() const {
   return basic_symbol_iterator(SymbolRef(Ret, this));
 }
 
-library_iterator COFFObjectFile::needed_library_begin() const {
-  // TODO: implement
-  report_fatal_error("Libraries needed unimplemented in COFFObjectFile");
-}
-
-library_iterator COFFObjectFile::needed_library_end() const {
-  // TODO: implement
-  report_fatal_error("Libraries needed unimplemented in COFFObjectFile");
-}
-
 import_directory_iterator COFFObjectFile::import_directory_begin() const {
   return import_directory_iterator(
       ImportDirectoryEntryRef(ImportDirectory, 0, this));
@@ -989,16 +979,6 @@ COFFObjectFile::getRelocationValueString(DataRefImpl Rel,
   return object_error::success;
 }
 
-std::error_code COFFObjectFile::getLibraryNext(DataRefImpl LibData,
-                                               LibraryRef &Result) const {
-  report_fatal_error("getLibraryNext not implemented in COFFObjectFile");
-}
-
-std::error_code COFFObjectFile::getLibraryPath(DataRefImpl LibData,
-                                               StringRef &Result) const {
-  report_fatal_error("getLibraryPath not implemented in COFFObjectFile");
-}
-
 bool ImportDirectoryEntryRef::
 operator==(const ImportDirectoryEntryRef &Other) const {
   return ImportTable == Other.ImportTable && Index == Other.Index;
index f5764921e4a4e2dafd2dc4025bd819f97e0a566e..8e19eb5631d8ac4845ead2c7d923e759e24ffc6a 100644 (file)
@@ -1009,16 +1009,6 @@ std::error_code MachOObjectFile::getRelocationHidden(DataRefImpl Rel,
   return object_error::success;
 }
 
-std::error_code MachOObjectFile::getLibraryNext(DataRefImpl LibData,
-                                                LibraryRef &Res) const {
-  report_fatal_error("Needed libraries unimplemented in MachOObjectFile");
-}
-
-std::error_code MachOObjectFile::getLibraryPath(DataRefImpl LibData,
-                                                StringRef &Res) const {
-  report_fatal_error("Needed libraries unimplemented in MachOObjectFile");
-}
-
 //
 // guessLibraryShortName() is passed a name of a dynamic library and returns a
 // guess on what the short name is.  Then name is returned as a substring of the
@@ -1246,16 +1236,6 @@ section_iterator MachOObjectFile::section_end() const {
   return section_iterator(SectionRef(DRI, this));
 }
 
-library_iterator MachOObjectFile::needed_library_begin() const {
-  // TODO: implement
-  report_fatal_error("Needed libraries unimplemented in MachOObjectFile");
-}
-
-library_iterator MachOObjectFile::needed_library_end() const {
-  // TODO: implement
-  report_fatal_error("Needed libraries unimplemented in MachOObjectFile");
-}
-
 uint8_t MachOObjectFile::getBytesInAddress() const {
   return is64Bit() ? 8 : 4;
 }