[lld] r276338 - Really fix invalid EhSectionPiece access.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 21 14:15:32 PDT 2016
Author: rafael
Date: Thu Jul 21 16:15:32 2016
New Revision: 276338
URL: http://llvm.org/viewvc/llvm-project?rev=276338&view=rev
Log:
Really fix invalid EhSectionPiece access.
I wonder what is the most idiomatic way to write this.
Modified:
lld/trunk/ELF/Relocations.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=276338&r1=276337&r2=276338&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Thu Jul 21 16:15:32 2016
@@ -525,12 +525,12 @@ static void scanRelocs(InputSectionBase<
ArrayRef<uint8_t> SectionData = C.getSectionData();
const uint8_t *Buf = SectionData.begin();
- SectionPiece *PieceI = nullptr;
- SectionPiece *PieceE = nullptr;
- if (auto *Eh = dyn_cast<EhInputSection<ELFT>>(&C)) {
- PieceI = &*Eh->Pieces.begin();
- PieceE = PieceI + Eh->Pieces.size();
- }
+ ArrayRef<EhSectionPiece> Pieces;
+ if (auto *Eh = dyn_cast<EhInputSection<ELFT>>(&C))
+ Pieces = Eh->Pieces;
+
+ ArrayRef<EhSectionPiece>::iterator PieceI = Pieces.begin();
+ ArrayRef<EhSectionPiece>::iterator PieceE = Pieces.end();
for (auto I = Rels.begin(), E = Rels.end(); I != E; ++I) {
const RelTy &RI = *I;
More information about the llvm-commits
mailing list