[llvm] r215224 - Delete dead code. NFC.

João Matos ripzonetriton at gmail.com
Mon Aug 11 06:54:19 PDT 2014


Hi Rafael,

We were relying on this to figure out the dependencies of an ELF library.
>From what I was told, this code is actually somewhat buggy but my co-worker
was preparing to send a patch to the list when he noticed it was just
deleted.

Can this be reverted?



On Fri, Aug 8, 2014 at 5:49 PM, Rafael Espindola <rafael.espindola at gmail.com
> wrote:

> Author: rafael
> Date: Fri Aug  8 11:49:35 2014
> New Revision: 215224
>
> URL: http://llvm.org/viewvc/llvm-project?rev=215224&view=rev
> Log:
> Delete dead code. NFC.
>
> Modified:
>     llvm/trunk/include/llvm/Object/COFF.h
>     llvm/trunk/include/llvm/Object/ELFObjectFile.h
>     llvm/trunk/include/llvm/Object/MachO.h
>     llvm/trunk/include/llvm/Object/ObjectFile.h
>     llvm/trunk/lib/Object/COFFObjectFile.cpp
>     llvm/trunk/lib/Object/MachOObjectFile.cpp
>
> Modified: llvm/trunk/include/llvm/Object/COFF.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/COFF.h (original)
> +++ llvm/trunk/include/llvm/Object/COFF.h Fri Aug  8 11:49:35 2014
> @@ -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;
>
>
> Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
> +++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Fri Aug  8 11:49:35 2014
> @@ -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;
> @@ -838,44 +830,6 @@ StringRef ELFObjectFile<ELFT>::getLoadNa
>  }
>
>  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;
>  }
>
> Modified: llvm/trunk/include/llvm/Object/MachO.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/MachO.h (original)
> +++ llvm/trunk/include/llvm/Object/MachO.h Fri Aug  8 11:49:35 2014
> @@ -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;
>
> Modified: llvm/trunk/include/llvm/Object/ObjectFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ObjectFile.h?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/ObjectFile.h (original)
> +++ llvm/trunk/include/llvm/Object/ObjectFile.h Fri Aug  8 11:49:35 2014
> @@ -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::
>    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
>
> Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/COFFObjectFile.cpp Fri Aug  8 11:49:35 2014
> @@ -610,16 +610,6 @@ basic_symbol_iterator COFFObjectFile::sy
>    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
>    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;
>
> Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=215224&r1=215223&r2=215224&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/MachOObjectFile.cpp Fri Aug  8 11:49:35 2014
> @@ -1009,16 +1009,6 @@ std::error_code MachOObjectFile::getRelo
>    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::sectio
>    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;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
João Matos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140811/c22f58b2/attachment.html>


More information about the llvm-commits mailing list