Insert MCSectionData into the section list directly in getOrCreateSectionData.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 20:39:23 +0000 (20:39 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 20:39:23 +0000 (20:39 +0000)
Removing the logic from the constructor will make it easier to merge
MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238155 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
lib/MC/MCAssembler.cpp

index ee7583e0e8286e72c69a457fbd7136d3d8c0657b..59f8e0ad41bb412feeddaddaa86e74c7d916bb7c 100644 (file)
@@ -566,7 +566,7 @@ private:
 public:
   // Only for use as sentinel.
   MCSectionData();
-  MCSectionData(MCSection &Section, MCAssembler *A = nullptr);
+  MCSectionData(MCSection &Section);
 
   MCSection &getSection() const { return *Section; }
 
@@ -971,8 +971,10 @@ public:
 
     if (Created)
       *Created = !Entry;
-    if (!Entry)
-      Entry = new MCSectionData(Section, this);
+    if (!Entry) {
+      Entry = new MCSectionData(Section);
+      Sections.push_back(Entry);
+    }
 
     return *Entry;
   }
index d7712f7fc9888de6ed777ba14508cb6d209626cf..2fa023ee120810cf90f5d1a2e7ae08132ec3afe3 100644 (file)
@@ -292,11 +292,7 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
 
 MCSectionData::MCSectionData() : Section(nullptr) {}
 
-MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)
-    : Section(&Section) {
-  if (A)
-    A->getSectionList().push_back(this);
-}
+MCSectionData::MCSectionData(MCSection &Section) : Section(&Section) {}
 
 MCSectionData::iterator
 MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {