[PATCH] D35193: [DWARF] - Remove unused code.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 09:57:47 PDT 2017


LGTM

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar created this revision.
>
> This was added in https://reviews.llvm.org/D32779, but I think it was unused from begining,
> because `Name` (prev 'name') variable is never accessed after `Obj.mapDebugSectionName()` call.
> Looks we can remove it.
>
>
> https://reviews.llvm.org/D35193
>
> Files:
>   include/llvm/Object/MachO.h
>   include/llvm/Object/ObjectFile.h
>   lib/DebugInfo/DWARF/DWARFContext.cpp
>   lib/Object/MachOObjectFile.cpp
>
>
> Index: lib/Object/MachOObjectFile.cpp
> ===================================================================
> --- lib/Object/MachOObjectFile.cpp
> +++ lib/Object/MachOObjectFile.cpp
> @@ -4335,9 +4335,3 @@
>    return make_error<GenericBinaryError>("Unrecognized MachO magic number",
>                                          object_error::invalid_file_type);
>  }
> -
> -StringRef MachOObjectFile::mapDebugSectionName(StringRef Name) const {
> -  return StringSwitch<StringRef>(Name)
> -      .Case("debug_str_offs", "debug_str_offsets")
> -      .Default(Name);
> -}
> Index: lib/DebugInfo/DWARF/DWARFContext.cpp
> ===================================================================
> --- lib/DebugInfo/DWARF/DWARFContext.cpp
> +++ lib/DebugInfo/DWARF/DWARFContext.cpp
> @@ -978,10 +978,6 @@
>        TypesDWOSections[Section].Data = Data;
>      }
>  
> -    // Map platform specific debug section names to DWARF standard section
> -    // names.
> -    Name = Obj.mapDebugSectionName(Name);
> -
>      if (RelocatedSection == Obj.section_end())
>        continue;
>  
> Index: include/llvm/Object/ObjectFile.h
> ===================================================================
> --- include/llvm/Object/ObjectFile.h
> +++ include/llvm/Object/ObjectFile.h
> @@ -293,9 +293,6 @@
>        return std::error_code();
>      }
>  
> -  /// Maps a debug section name to a standard DWARF section name.
> -  virtual StringRef mapDebugSectionName(StringRef Name) const { return Name; }
> -
>    /// True if this is a relocatable object (.o/.obj).
>    virtual bool isRelocatableObject() const = 0;
>  
> Index: include/llvm/Object/MachO.h
> ===================================================================
> --- include/llvm/Object/MachO.h
> +++ include/llvm/Object/MachO.h
> @@ -556,8 +556,6 @@
>  
>    bool isRelocatableObject() const override;
>  
> -  StringRef mapDebugSectionName(StringRef Name) const override;
> -
>    bool hasPageZeroSegment() const { return HasPageZeroSegment; }
>  
>    static bool classof(const Binary *v) {
>
>
> Index: lib/Object/MachOObjectFile.cpp
> ===================================================================
> --- lib/Object/MachOObjectFile.cpp
> +++ lib/Object/MachOObjectFile.cpp
> @@ -4335,9 +4335,3 @@
>    return make_error<GenericBinaryError>("Unrecognized MachO magic number",
>                                          object_error::invalid_file_type);
>  }
> -
> -StringRef MachOObjectFile::mapDebugSectionName(StringRef Name) const {
> -  return StringSwitch<StringRef>(Name)
> -      .Case("debug_str_offs", "debug_str_offsets")
> -      .Default(Name);
> -}
> Index: lib/DebugInfo/DWARF/DWARFContext.cpp
> ===================================================================
> --- lib/DebugInfo/DWARF/DWARFContext.cpp
> +++ lib/DebugInfo/DWARF/DWARFContext.cpp
> @@ -978,10 +978,6 @@
>        TypesDWOSections[Section].Data = Data;
>      }
>  
> -    // Map platform specific debug section names to DWARF standard section
> -    // names.
> -    Name = Obj.mapDebugSectionName(Name);
> -
>      if (RelocatedSection == Obj.section_end())
>        continue;
>  
> Index: include/llvm/Object/ObjectFile.h
> ===================================================================
> --- include/llvm/Object/ObjectFile.h
> +++ include/llvm/Object/ObjectFile.h
> @@ -293,9 +293,6 @@
>        return std::error_code();
>      }
>  
> -  /// Maps a debug section name to a standard DWARF section name.
> -  virtual StringRef mapDebugSectionName(StringRef Name) const { return Name; }
> -
>    /// True if this is a relocatable object (.o/.obj).
>    virtual bool isRelocatableObject() const = 0;
>  
> Index: include/llvm/Object/MachO.h
> ===================================================================
> --- include/llvm/Object/MachO.h
> +++ include/llvm/Object/MachO.h
> @@ -556,8 +556,6 @@
>  
>    bool isRelocatableObject() const override;
>  
> -  StringRef mapDebugSectionName(StringRef Name) const override;
> -
>    bool hasPageZeroSegment() const { return HasPageZeroSegment; }
>  
>    static bool classof(const Binary *v) {


More information about the llvm-commits mailing list