[llvm] dc89a91 - MCStreamer: Simplify with newFragment. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 19 12:40:40 PDT 2025


Author: Fangrui Song
Date: 2025-07-19T12:40:36-07:00
New Revision: dc89a910aa153ebf9d4fa57edeefe4bcec1d1014

URL: https://github.com/llvm/llvm-project/commit/dc89a910aa153ebf9d4fa57edeefe4bcec1d1014
DIFF: https://github.com/llvm/llvm-project/commit/dc89a910aa153ebf9d4fa57edeefe4bcec1d1014.diff

LOG: MCStreamer: Simplify with newFragment. NFC

Added: 
    

Modified: 
    llvm/lib/MC/MCMachOStreamer.cpp
    llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp
index 43598ef038b96..08d2b931858a6 100644
--- a/llvm/lib/MC/MCMachOStreamer.cpp
+++ b/llvm/lib/MC/MCMachOStreamer.cpp
@@ -161,7 +161,7 @@ void MCMachOStreamer::emitLabel(MCSymbol *Symbol, SMLoc Loc) {
   // We have to create a new fragment if this is an atom defining symbol,
   // fragments cannot span atoms.
   if (cast<MCSymbolMachO>(Symbol)->isSymbolLinkerVisible())
-    insert(getContext().allocFragment<MCFragment>());
+    newFragment();
 
   MCObjectStreamer::emitLabel(Symbol, Loc);
 

diff  --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
index 3d060c6f4a780..387d289e36f8a 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -567,7 +567,7 @@ void X86AsmBackend::emitInstructionEnd(MCObjectStreamer &OS,
   // DataFragment, so that we can get the size of instructions later in
   // MCAssembler::relaxBoundaryAlign. The easiest way is to insert a new empty
   // DataFragment.
-  OS.insert(OS.getContext().allocFragment<MCFragment>());
+  OS.newFragment();
 
   // Update the maximum alignment on the current section if necessary.
   MCSection *Sec = OS.getCurrentSectionOnly();


        


More information about the llvm-commits mailing list