[llvm] 8742477 - [MC] Remove the Parent parameter from MCFragment ctor callers. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 22:48:00 PDT 2024
Author: Fangrui Song
Date: 2024-06-21T22:47:55-07:00
New Revision: 87424778ef554e3d50a6b15f7a9c8b0d35368031
URL: https://github.com/llvm/llvm-project/commit/87424778ef554e3d50a6b15f7a9c8b0d35368031
DIFF: https://github.com/llvm/llvm-project/commit/87424778ef554e3d50a6b15f7a9c8b0d35368031.diff
LOG: [MC] Remove the Parent parameter from MCFragment ctor callers. NFC
Added:
Modified:
llvm/include/llvm/MC/MCFragment.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCSection.cpp
llvm/lib/MC/MCSymbol.cpp
llvm/lib/MC/MCWinCOFFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index 555730828b462..dbf309cc5383d 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -107,7 +107,7 @@ class MCFragment {
class MCDummyFragment : public MCFragment {
public:
- explicit MCDummyFragment(MCSection *Sec) : MCFragment(FT_Dummy, false, Sec) {}
+ explicit MCDummyFragment() : MCFragment(FT_Dummy, false) {}
static bool classof(const MCFragment *F) { return F->getKind() == FT_Dummy; }
};
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 17f09001b184a..6927556e678b1 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -829,7 +829,8 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
Sec->setLayoutOrder(i);
// Chain together fragments from all subsections.
- MCDummyFragment Dummy(Sec);
+ MCDummyFragment Dummy;
+ Dummy.setParent(Sec);
MCFragment *Tail = &Dummy;
for (auto &[_, List] : Sec->Subsections) {
if (!List.Head)
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 35521ddab4777..23e56a97f179f 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -567,8 +567,7 @@ void MCObjectStreamer::emitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
const MCSymbol *Label,
SMLoc Loc) {
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, Loc);
- insert(getContext().allocFragment<MCDwarfCallFrameFragment>(*AddrDelta,
- nullptr));
+ insert(getContext().allocFragment<MCDwarfCallFrameFragment>(*AddrDelta));
}
void MCObjectStreamer::emitCVLocDirective(unsigned FunctionId, unsigned FileNo,
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 85f6492af20f5..0bf641c4427eb 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -23,8 +23,9 @@ using namespace llvm;
MCSection::MCSection(SectionVariant V, StringRef Name, bool IsText,
MCSymbol *Begin)
: Begin(Begin), BundleGroupBeforeFirstInst(false), HasInstructions(false),
- HasLayout(false), IsRegistered(false), IsText(IsText),
- DummyFragment(this), Name(Name), Variant(V) {
+ HasLayout(false), IsRegistered(false), IsText(IsText), Name(Name),
+ Variant(V) {
+ DummyFragment.setParent(this);
// The initial subsection number is 0. Create a fragment list.
CurFragList = &Subsections.emplace_back(0u, FragList{}).second;
}
diff --git a/llvm/lib/MC/MCSymbol.cpp b/llvm/lib/MC/MCSymbol.cpp
index 867a472377ca4..2a709f4aef80c 100644
--- a/llvm/lib/MC/MCSymbol.cpp
+++ b/llvm/lib/MC/MCSymbol.cpp
@@ -22,7 +22,7 @@
using namespace llvm;
// Only the address of this fragment is ever actually used.
-static MCDummyFragment SentinelFragment(nullptr);
+static MCDummyFragment SentinelFragment;
// Sentinel value for the absolute pseudo fragment.
MCFragment *MCSymbol::AbsolutePseudoFragment = &SentinelFragment;
diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp
index 5732b29b85d94..6022c47f1220e 100644
--- a/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -212,9 +212,7 @@ void MCWinCOFFStreamer::emitCOFFSymbolIndex(MCSymbol const *Symbol) {
getAssembler().registerSection(*Sec);
Sec->ensureMinAlignment(Align(4));
- getContext().allocFragment<MCSymbolIdFragment>(Symbol,
- getCurrentSectionOnly());
-
+ insert(getContext().allocFragment<MCSymbolIdFragment>(Symbol));
getAssembler().registerSymbol(*Symbol);
}
More information about the llvm-commits
mailing list