[llvm] eaf816f - [MC] Remove unneeded nullness check from getOrCreateDataFragment. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 20:13:19 PDT 2024


Author: Fangrui Song
Date: 2024-06-27T20:13:10-07:00
New Revision: eaf816f6cbd7282c1d7a1cacacccd0775e9e3c61

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

LOG: [MC] Remove unneeded nullness check from getOrCreateDataFragment. NFC

`getCurrentFragment()` no longer returns null after
7423bf78eb53d81ce0c7b3a38e39a56341ca2a89.

Added: 
    

Modified: 
    llvm/lib/MC/MCObjectStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 99ac7f4643745..b8ed1d6f7b216 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -168,7 +168,7 @@ static bool canReuseDataFragment(const MCDataFragment &F,
 
 MCDataFragment *
 MCObjectStreamer::getOrCreateDataFragment(const MCSubtargetInfo *STI) {
-  MCDataFragment *F = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
+  auto *F = dyn_cast<MCDataFragment>(getCurrentFragment());
   if (!F || !canReuseDataFragment(*F, *Assembler, STI)) {
     F = getContext().allocFragment<MCDataFragment>();
     insert(F);


        


More information about the llvm-commits mailing list