[llvm] c193124 - [MC] Remove fixup_begin/fixup_end

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 00:01:48 PST 2024


Author: Fangrui Song
Date: 2024-12-22T00:01:42-08:00
New Revision: c1931241b088164bc96345f9dffae024affd3f56

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

LOG: [MC] Remove fixup_begin/fixup_end

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCFragment.h
    llvm/lib/MC/MCAssembler.cpp
    llvm/lib/MC/MCFragment.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index a1426c5f1c9e61..b0a39ffaccccef 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -190,10 +190,6 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
       : MCEncodedFragment(FType, HasInstructions) {}
 
 public:
-
-  using const_fixup_iterator = SmallVectorImpl<MCFixup>::const_iterator;
-  using fixup_iterator = SmallVectorImpl<MCFixup>::iterator;
-
   SmallVectorImpl<char> &getContents() { return Contents; }
   const SmallVectorImpl<char> &getContents() const { return Contents; }
 
@@ -204,12 +200,6 @@ class MCEncodedFragmentWithFixups : public MCEncodedFragment {
   SmallVectorImpl<MCFixup> &getFixups() { return Fixups; }
   const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }
 
-  fixup_iterator fixup_begin() { return Fixups.begin(); }
-  const_fixup_iterator fixup_begin() const { return Fixups.begin(); }
-
-  fixup_iterator fixup_end() { return Fixups.end(); }
-  const_fixup_iterator fixup_end() const { return Fixups.end(); }
-
   static bool classof(const MCFragment *F) {
     MCFragment::FragmentType Kind = F->getKind();
     return Kind == MCFragment::FT_Relaxable || Kind == MCFragment::FT_Data ||

diff  --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 55139dae7b1d71..3c18d0832efcc7 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -829,7 +829,7 @@ void MCAssembler::writeSectionData(raw_ostream &OS,
         // into a virtual section. This is to support clients which use standard
         // directives to fill the contents of virtual sections.
         const MCDataFragment &DF = cast<MCDataFragment>(F);
-        if (DF.fixup_begin() != DF.fixup_end())
+        if (DF.getFixups().size())
           getContext().reportError(SMLoc(), Sec->getVirtualSectionKind() +
                                                 " section '" + Sec->getName() +
                                                 "' cannot have fixups");

diff  --git a/llvm/lib/MC/MCFragment.cpp b/llvm/lib/MC/MCFragment.cpp
index df1017d1d5c800..bf8f8322a8a9df 100644
--- a/llvm/lib/MC/MCFragment.cpp
+++ b/llvm/lib/MC/MCFragment.cpp
@@ -150,14 +150,10 @@ LLVM_DUMP_METHOD void MCFragment::dump() const {
     }
     OS << "] (" << Contents.size() << " bytes)";
 
-    if (DF->fixup_begin() != DF->fixup_end()) {
+    if (DF->getFixups().size()) {
       OS << ",\n       ";
       OS << " Fixups:[";
-      for (MCDataFragment::const_fixup_iterator it = DF->fixup_begin(),
-             ie = DF->fixup_end(); it != ie; ++it) {
-        if (it != DF->fixup_begin()) OS << ",\n                ";
-        OS << *it;
-      }
+      interleave(DF->getFixups(), OS, ",\n                ");
       OS << "]";
     }
     break;


        


More information about the llvm-commits mailing list