From: Rafael Espindola Date: Mon, 25 May 2015 20:39:23 +0000 (+0000) Subject: Insert MCSectionData into the section list directly in getOrCreateSectionData. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0d46e8a420d8c0dfa41e80497082adf9866e1e97;p=oota-llvm.git Insert MCSectionData into the section list directly in getOrCreateSectionData. 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 --- diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h index ee7583e0e82..59f8e0ad41b 100644 --- a/include/llvm/MC/MCAssembler.h +++ b/include/llvm/MC/MCAssembler.h @@ -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; } diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp index d7712f7fc98..2fa023ee120 100644 --- a/lib/MC/MCAssembler.cpp +++ b/lib/MC/MCAssembler.cpp @@ -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) {