[MC] Replace one nullable getCurrentSectionOnly with CurFrag

We will implement getCurrentSectionOnly with `CurFrag->getParent()`,
which is non-null. Eliminate a nullable use.
This commit is contained in:
Fangrui Song 2024-06-27 22:27:14 -07:00
parent fadc72235e
commit fcffb2c024
2 changed files with 4 additions and 3 deletions

View File

@ -628,8 +628,8 @@ void MCELFStreamer::finishImpl() {
}
// Ensure the last section gets aligned if necessary.
MCSection *CurSection = getCurrentSectionOnly();
setSectionAlignmentForBundling(getAssembler(), CurSection);
if (MCFragment *F = getCurrentFragment())
setSectionAlignmentForBundling(getAssembler(), F->getParent());
finalizeCGProfile();
emitFrames(nullptr);

View File

@ -143,7 +143,8 @@ void MCObjectStreamer::emitFrames(MCAsmBackend *MAB) {
}
MCFragment *MCObjectStreamer::getCurrentFragment() const {
assert(CurFrag->getParent() == getCurrentSection().first);
assert(!getCurrentSection().first ||
CurFrag->getParent() == getCurrentSection().first);
return CurFrag;
}