[lld] r328685 - Define a trivial method inline.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 20:14:11 PDT 2018


Author: rafael
Date: Tue Mar 27 20:14:11 2018
New Revision: 328685

URL: http://llvm.org/viewvc/llvm-project?rev=328685&view=rev
Log:
Define a trivial method inline.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=328685&r1=328684&r2=328685&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Mar 27 20:14:11 2018
@@ -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<const MergeInputSection *>(this);
-  return const_cast<SectionPiece *>(This->getSectionPiece(Offset));
-}
-
 template <class It, class T, class Compare>
 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 La
   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");
 

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=328685&r1=328684&r2=328685&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Tue Mar 27 20:14:11 2018
@@ -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<MergeInputSection *>(this)->getSectionPiece(Offset);
+  }
 
   SyntheticSection *getParent() const;
 




More information about the llvm-commits mailing list