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/MCStreamer.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/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index c0879fd..91adc42 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -118,6 +118,12 @@ ArrayRef<MCDwarfFrameInfo> MCStreamer::getDwarfFrameInfos() const { return DwarfFrameInfos; } +MCFragment *MCStreamer::getCurrentFragment() const { + assert(!getCurrentSection().first || + CurFrag->getParent() == getCurrentSection().first); + return CurFrag; +} + void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {} void MCStreamer::addExplicitComment(const Twine &T) {} @@ -1218,7 +1224,9 @@ void MCStreamer::emitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) {} void MCStreamer::emitTBSSSymbol(MCSection *Section, MCSymbol *Symbol, uint64_t Size, Align ByteAlignment) {} -void MCStreamer::changeSection(MCSection *, uint32_t) {} +void MCStreamer::changeSection(MCSection *Section, uint32_t) { + CurFrag = &Section->getDummyFragment(); +} void MCStreamer::emitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {} void MCStreamer::emitBytes(StringRef Data) {} void MCStreamer::emitBinaryData(StringRef Data) { emitBytes(Data); } |