Define a trivial method inline.

llvm-svn: 328685
This commit is contained in:
Rafael Espindola 2018-03-28 03:14:11 +00:00
parent 5a7ca96e2d
commit 92eba0e14a
2 changed files with 5 additions and 8 deletions

View File

@ -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 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");

View File

@ -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;