Skip to content

Commit fcffb2c

Browse files
committed
[MC] Replace one nullable getCurrentSectionOnly with CurFrag
We will implement getCurrentSectionOnly with `CurFrag->getParent()`, which is non-null. Eliminate a nullable use.
1 parent fadc722 commit fcffb2c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/lib/MC/MCELFStreamer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,8 @@ void MCELFStreamer::finishImpl() {
628628
}
629629

630630
// Ensure the last section gets aligned if necessary.
631-
MCSection *CurSection = getCurrentSectionOnly();
632-
setSectionAlignmentForBundling(getAssembler(), CurSection);
631+
if (MCFragment *F = getCurrentFragment())
632+
setSectionAlignmentForBundling(getAssembler(), F->getParent());
633633

634634
finalizeCGProfile();
635635
emitFrames(nullptr);

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ void MCObjectStreamer::emitFrames(MCAsmBackend *MAB) {
143143
}
144144

145145
MCFragment *MCObjectStreamer::getCurrentFragment() const {
146-
assert(CurFrag->getParent() == getCurrentSection().first);
146+
assert(!getCurrentSection().first ||
147+
CurFrag->getParent() == getCurrentSection().first);
147148
return CurFrag;
148149
}
149150

0 commit comments

Comments
 (0)