From 92eba0e14a2e33233e034c8b918b0144ee099baf Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 28 Mar 2018 03:14:11 +0000 Subject: [PATCH] Define a trivial method inline. llvm-svn: 328685 --- lld/ELF/InputSection.cpp | 9 ++------- lld/ELF/InputSection.h | 4 +++- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 9109ced45e8d..7b1342eca533 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -925,12 +925,6 @@ void MergeInputSection::splitIntoPieces() { getSectionPiece(Off)->Live = true; } -// Do binary search to get a section piece at a given input offset. -SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) { - auto *This = static_cast(this); - return const_cast(This->getSectionPiece(Offset)); -} - template static It fastUpperBound(It First, It Last, const T &Value, Compare Comp) { size_t Size = std::distance(First, Last); @@ -944,7 +938,8 @@ static It fastUpperBound(It First, It Last, const T &Value, Compare Comp) { return Comp(Value, *First) ? First : First + 1; } -const SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) const { +// Do binary search to get a section piece at a given input offset. +SectionPiece *MergeInputSection::getSectionPiece(uint64_t Offset) { if (Data.size() <= Offset) fatal(toString(this) + ": entry is past the end of the section"); diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index ab6158018092..714439b2dbf5 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -251,7 +251,9 @@ public: // Returns the SectionPiece at a given input section offset. SectionPiece *getSectionPiece(uint64_t Offset); - const SectionPiece *getSectionPiece(uint64_t Offset) const; + const SectionPiece *getSectionPiece(uint64_t Offset) const { + return const_cast(this)->getSectionPiece(Offset); + } SyntheticSection *getParent() const; -- GitLab