Skip to content

Commit 66518ad

Browse files
committed
[MC] Remove addFragment. NFC
This was introduced in dcb71c0 to help migrate away raw `operator new` and refactor the fragment representation. This is now unneeded after `MCStreamer::CurFrag` and `MCSection::CurFragList` refactoring.
1 parent e5aef72 commit 66518ad

File tree

4 files changed

+4
-19
lines changed

4 files changed

+4
-19
lines changed

llvm/include/llvm/MC/MCSection.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,6 @@ class MCSection {
198198
iterator end() const { return {}; }
199199
bool empty() const { return !CurFragList->Head; }
200200

201-
void addFragment(MCFragment &F) {
202-
// The formal layout order will be finalized in MCAssembler::layout.
203-
if (CurFragList->Tail) {
204-
CurFragList->Tail->Next = &F;
205-
F.setLayoutOrder(CurFragList->Tail->getLayoutOrder() + 1);
206-
} else {
207-
CurFragList->Head = &F;
208-
assert(F.getLayoutOrder() == 0);
209-
}
210-
CurFragList->Tail = &F;
211-
}
212-
213201
void dump() const;
214202

215203
virtual void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T,

llvm/lib/MC/MCContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ MCDataFragment *MCContext::allocInitialFragment(MCSection &Sec) {
201201
assert(!Sec.curFragList()->Head);
202202
auto *F = allocFragment<MCDataFragment>();
203203
F->setParent(&Sec);
204-
Sec.addFragment(*F);
204+
Sec.curFragList()->Head = F;
205+
Sec.curFragList()->Tail = F;
205206
return F;
206207
}
207208

llvm/lib/MC/MCMachOStreamer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,7 @@ void MCMachOStreamer::createAddrSigSection() {
596596
MCSection *AddrSigSection =
597597
Asm.getContext().getObjectFileInfo()->getAddrSigSection();
598598
changeSection(AddrSigSection);
599-
auto *Frag = getContext().allocFragment<MCDataFragment>();
600-
Frag->setParent(AddrSigSection);
601-
AddrSigSection->addFragment(*Frag);
599+
auto *Frag = cast<MCDataFragment>(AddrSigSection->curFragList()->Head);
602600
// We will generate a series of pointer-sized symbol relocations at offset
603601
// 0x0. Set the section size to be large enough to contain a single pointer
604602
// (instead of emitting a zero-sized section) so these relocations are

llvm/lib/MC/MCWinCOFFStreamer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,7 @@ void MCWinCOFFStreamer::emitCOFFSafeSEH(MCSymbol const *Symbol) {
205205
changeSection(SXData);
206206
SXData->ensureMinAlignment(Align(4));
207207

208-
auto *F = getContext().allocFragment<MCSymbolIdFragment>(Symbol);
209-
F->setParent(SXData);
210-
SXData->addFragment(*F);
208+
insert(getContext().allocFragment<MCSymbolIdFragment>(Symbol));
211209
getAssembler().registerSymbol(*Symbol);
212210
CSymbol->setIsSafeSEH();
213211

0 commit comments

Comments
 (0)