diff options
author | Fangrui Song <i@maskray.me> | 2024-06-27 22:37:36 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-06-27 22:37:37 -0700 |
commit | db48f1a1764023f8efeb055e343b967d1eb37d19 (patch) | |
tree | 39f6a4fdb655fa3a42cb1f6e6553d3d71434d92c /llvm/lib/MC/MCELFStreamer.cpp | |
parent | 52216349b6faf41351f4bd370439031c416b8f9b (diff) | |
download | llvm-db48f1a1764023f8efeb055e343b967d1eb37d19.zip llvm-db48f1a1764023f8efeb055e343b967d1eb37d19.tar.gz llvm-db48f1a1764023f8efeb055e343b967d1eb37d19.tar.bz2 |
[MC] Remove nullable getCurrentSectionOnly use from AsmParser
We will implement getCurrentSectionOnly with `CurFrag->getParent()`,
which is non-null. Eliminate a nullable use.
Diffstat (limited to 'llvm/lib/MC/MCELFStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCELFStreamer.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp index b88a572..6d30f2e 100644 --- a/llvm/lib/MC/MCELFStreamer.cpp +++ b/llvm/lib/MC/MCELFStreamer.cpp @@ -107,13 +107,14 @@ static void setSectionAlignmentForBundling(const MCAssembler &Assembler, } void MCELFStreamer::changeSection(MCSection *Section, uint32_t Subsection) { - MCSection *CurSection = getCurrentSectionOnly(); - if (CurSection && isBundleLocked()) - report_fatal_error("Unterminated .bundle_lock when changing a section"); - MCAssembler &Asm = getAssembler(); - // Ensure the previous section gets aligned if necessary. - setSectionAlignmentForBundling(Asm, CurSection); + if (auto *F = getCurrentFragment()) { + if (isBundleLocked()) + report_fatal_error("Unterminated .bundle_lock when changing a section"); + + // Ensure the previous section gets aligned if necessary. + setSectionAlignmentForBundling(Asm, F->getParent()); + } auto *SectionELF = static_cast<const MCSectionELF *>(Section); const MCSymbol *Grp = SectionELF->getGroup(); if (Grp) |