[llvm] 034d014 - [MC] Remove MCEncodedFragmentWithContents

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 22:44:56 PDT 2024


Author: Fangrui Song
Date: 2024-07-28T22:44:52-07:00
New Revision: 034d01422b5fd8f502ccb45ce95da108415a39a6

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

LOG: [MC] Remove MCEncodedFragmentWithContents

MCEncodedFragmentWithFixups can derive from MCEncodedFragment directly.
Follow-up to de5aa8d0060cbe286c9cbae90ca8f197b92a3956.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCFragment.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index d9c07e7ec2a8f..84f8e060320a1 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -170,29 +170,12 @@ class MCEncodedFragment : public MCFragment {
   }
 };
 
-/// Interface implemented by fragments that contain encoded instructions and/or
-/// data.
-///
-template<unsigned ContentsSize>
-class MCEncodedFragmentWithContents : public MCEncodedFragment {
-  SmallVector<char, ContentsSize> Contents;
-
-protected:
-  MCEncodedFragmentWithContents(MCFragment::FragmentType FType,
-                                bool HasInstructions)
-      : MCEncodedFragment(FType, HasInstructions) {}
-
-public:
-  SmallVectorImpl<char> &getContents() { return Contents; }
-  const SmallVectorImpl<char> &getContents() const { return Contents; }
-};
-
 /// Interface implemented by fragments that contain encoded instructions and/or
 /// data and also have fixups registered.
 ///
-template<unsigned ContentsSize, unsigned FixupsSize>
-class MCEncodedFragmentWithFixups :
-  public MCEncodedFragmentWithContents<ContentsSize> {
+template <unsigned ContentsSize, unsigned FixupsSize>
+class MCEncodedFragmentWithFixups : public MCEncodedFragment {
+  SmallVector<char, ContentsSize> Contents;
 
   /// The list of fixups in this fragment.
   SmallVector<MCFixup, FixupsSize> Fixups;
@@ -200,13 +183,16 @@ class MCEncodedFragmentWithFixups :
 protected:
   MCEncodedFragmentWithFixups(MCFragment::FragmentType FType,
                               bool HasInstructions)
-      : MCEncodedFragmentWithContents<ContentsSize>(FType, HasInstructions) {}
+      : 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; }
+
   SmallVectorImpl<MCFixup> &getFixups() { return Fixups; }
   const SmallVectorImpl<MCFixup> &getFixups() const { return Fixups; }
 


        


More information about the llvm-commits mailing list