Skip to content
Snippets Groups Projects
Commit 36d8db42 authored by Rui Ueyama's avatar Rui Ueyama
Browse files

Rename P -> Pieces.

Conventionally, an array of SectionPieces is named Pieces.
It is better to follow the convention.

llvm-svn: 315543
parent d925f983
No related branches found
No related tags found
No related merge requests found
...@@ -752,37 +752,34 @@ namespace { ...@@ -752,37 +752,34 @@ namespace {
class OffsetGetter { class OffsetGetter {
public: public:
explicit OffsetGetter(InputSectionBase &Sec) { explicit OffsetGetter(InputSectionBase &Sec) {
if (auto *Eh = dyn_cast<EhInputSection>(&Sec)) { if (auto *Eh = dyn_cast<EhInputSection>(&Sec))
P = Eh->Pieces; Pieces = Eh->Pieces;
Size = Eh->Pieces.size();
}
} }
// Translates offsets in input sections to offsets in output sections. // Translates offsets in input sections to offsets in output sections.
// Given offset must increase monotonically. We assume that P is // Given offset must increase monotonically. We assume that Piece is
// sorted by InputOff. // sorted by InputOff.
uint64_t get(uint64_t Off) { uint64_t get(uint64_t Off) {
if (P.empty()) if (Pieces.empty())
return Off; return Off;
while (I != Size && P[I].InputOff + P[I].Size <= Off) while (I != Pieces.size() && Pieces[I].InputOff + Pieces[I].Size <= Off)
++I; ++I;
if (I == Size) if (I == Pieces.size())
return Off; return Off;
// P must be contiguous, so there must be no holes in between. // Pieces must be contiguous, so there must be no holes in between.
assert(P[I].InputOff <= Off && "Relocation not in any piece"); assert(Pieces[I].InputOff <= Off && "Relocation not in any piece");
// Offset -1 means that the piece is dead (i.e. garbage collected). // Offset -1 means that the piece is dead (i.e. garbage collected).
if (P[I].OutputOff == -1) if (Pieces[I].OutputOff == -1)
return -1; return -1;
return P[I].OutputOff + Off - P[I].InputOff; return Pieces[I].OutputOff + Off - Pieces[I].InputOff;
} }
private: private:
ArrayRef<EhSectionPiece> P; ArrayRef<EhSectionPiece> Pieces;
size_t I = 0; size_t I = 0;
size_t Size;
}; };
} // namespace } // namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment