[llvm] 9486c35 - [ARM] Simplify ElfMappingSymbolInfo. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 21:51:21 PDT 2024


Author: Fangrui Song
Date: 2024-06-21T21:51:16-07:00
New Revision: 9486c35ecac59a451aaa923f47087e834f478dfb

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

LOG: [ARM] Simplify ElfMappingSymbolInfo. NFC

Added: 
    

Modified: 
    llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
index afd7dccbeca9b..72d739cfca2a8 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
@@ -487,7 +487,7 @@ class ARMELFStreamer : public MCELFStreamer {
       LastEMSInfo = std::move(LastMappingSymbol->second);
       return;
     }
-    LastEMSInfo.reset(new ElfMappingSymbolInfo(SMLoc(), nullptr, 0));
+    LastEMSInfo.reset(new ElfMappingSymbolInfo);
   }
 
   /// This function is the one used to emit instruction data into the ELF
@@ -555,7 +555,7 @@ class ARMELFStreamer : public MCELFStreamer {
     if (!LastEMSInfo->hasInfo())
       return;
     ElfMappingSymbolInfo *EMS = LastEMSInfo.get();
-    EmitMappingSymbol("$d", EMS->Loc, EMS->F, EMS->Offset);
+    EmitMappingSymbol("$d", SMLoc(), EMS->F, EMS->Offset);
     EMS->resetInfo();
   }
 
@@ -625,17 +625,14 @@ class ARMELFStreamer : public MCELFStreamer {
   };
 
   struct ElfMappingSymbolInfo {
-    explicit ElfMappingSymbolInfo(SMLoc Loc, MCFragment *F, uint64_t O)
-        : Loc(Loc), F(F), Offset(O), State(EMS_None) {}
     void resetInfo() {
       F = nullptr;
       Offset = 0;
     }
     bool hasInfo() { return F != nullptr; }
-    SMLoc Loc;
-    MCFragment *F;
-    uint64_t Offset;
-    ElfMappingSymbol State;
+    MCFragment *F = nullptr;
+    uint64_t Offset = 0;
+    ElfMappingSymbol State = EMS_None;
   };
 
   void emitDataMappingSymbol() {
@@ -648,7 +645,6 @@ class ARMELFStreamer : public MCELFStreamer {
       auto *DF = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
       if (!DF)
         return;
-      EMS->Loc = SMLoc();
       EMS->F = getCurrentFragment();
       EMS->Offset = DF->getContents().size();
       LastEMSInfo->State = EMS_Data;


        


More information about the llvm-commits mailing list