OSDN Git Service

Simplify.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 12 May 2010 21:47:55 +0000 (21:47 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 12 May 2010 21:47:55 +0000 (21:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103651 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCAssembler.cpp

index 106a0ed..7bcce2e 100644 (file)
@@ -459,11 +459,9 @@ void MCAssembler::LayoutSection(MCAsmLayout &Layout,
     // Unless this section is virtual (where we are allowed to adjust the offset
     // freely), the padding goes in the previous section.
     if (!IsVirtual) {
-      // Find the previous non-virtual section.
-      iterator it = &SD;
-      assert(it != begin() && "Invalid initial section address!");
-      for (--it; getBackend().isVirtualSection(it->getSection()); --it) ;
-      Layout.setSectionFileSize(&*it, Layout.getSectionFileSize(&*it) + Pad);
+      assert(SectionOrderIndex && "Invalid initial section address!");
+      MCSectionData *Prev = Layout.getSectionOrder()[SectionOrderIndex - 1];
+      Layout.setSectionFileSize(Prev, Layout.getSectionFileSize(Prev) + Pad);
     }
 
     StartAddress += Pad;