Skip to content

Commit 36cadb6

Browse files
committed
MCAssembler: Simplify getSectionAddressSize
The tail fragment must be of type FT_Data. Reduce a computeFragmentSize use.
1 parent c987950 commit 36cadb6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/MC/MCAssembler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,9 @@ const MCSymbol *MCAssembler::getBaseSymbol(const MCSymbol &Symbol) const {
353353
}
354354

355355
uint64_t MCAssembler::getSectionAddressSize(const MCSection &Sec) const {
356-
assert(HasLayout);
357-
// The size is the last fragment's end offset.
358356
const MCFragment &F = *Sec.curFragList()->Tail;
359-
return getFragmentOffset(F) + computeFragmentSize(F);
357+
assert(HasLayout && F.getKind() == MCFragment::FT_Data);
358+
return getFragmentOffset(F) + F.getSize();
360359
}
361360

362361
uint64_t MCAssembler::getSectionFileSize(const MCSection &Sec) const {

0 commit comments

Comments
 (0)