diff options
author | Fangrui Song <i@maskray.me> | 2024-06-10 18:27:34 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-06-10 18:27:34 -0700 |
commit | cb63abca27e1813ae58ded466cd81ba3952ab888 (patch) | |
tree | da6ce3f868a1e7043f9125add495f8899ebfc224 /llvm/lib/MC/MachObjectWriter.cpp | |
parent | 8e12f31be5a98a66700dd3571e4e12465f05ad61 (diff) | |
download | llvm-cb63abca27e1813ae58ded466cd81ba3952ab888.zip llvm-cb63abca27e1813ae58ded466cd81ba3952ab888.tar.gz llvm-cb63abca27e1813ae58ded466cd81ba3952ab888.tar.bz2 |
[MC] Remove getFragmentList uses. NFC
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r-- | llvm/lib/MC/MachObjectWriter.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index d17e6e1..de8bde4 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -767,11 +767,9 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm, if (!Asm.CGProfile.empty()) { MCSection *CGProfileSection = Asm.getContext().getMachOSection( "__LLVM", "__cg_profile", 0, SectionKind::getMetadata()); - MCDataFragment *Frag = dyn_cast_or_null<MCDataFragment>( - &*CGProfileSection->getFragmentList().begin()); - assert(Frag && "call graph profile section not reserved"); - Frag->getContents().clear(); - raw_svector_ostream OS(Frag->getContents()); + auto &Frag = cast<MCDataFragment>(*CGProfileSection->begin()); + Frag.getContents().clear(); + raw_svector_ostream OS(Frag.getContents()); for (const MCAssembler::CGProfileEntry &CGPE : Asm.CGProfile) { uint32_t FromIndex = CGPE.From->getSymbol().getIndex(); uint32_t ToIndex = CGPE.To->getSymbol().getIndex(); |