[llvm-commits] [llvm] r80344 - /llvm/trunk/lib/MC/MCMachOStreamer.cpp

Daniel Dunbar daniel at zuster.org
Thu Aug 27 22:48:54 PDT 2009


Author: ddunbar
Date: Fri Aug 28 00:48:54 2009
New Revision: 80344

URL: http://llvm.org/viewvc/llvm-project?rev=80344&view=rev
Log:
llvm-mc: Factor getSectionData out of SwitchSection.

Modified:
    llvm/trunk/lib/MC/MCMachOStreamer.cpp

Modified: llvm/trunk/lib/MC/MCMachOStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCMachOStreamer.cpp?rev=80344&r1=80343&r2=80344&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCMachOStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCMachOStreamer.cpp Fri Aug 28 00:48:54 2009
@@ -63,6 +63,15 @@
     return 0;
   }
 
+  MCSectionData &getSectionData(const MCSection &Section) {
+    MCSectionData *&Entry = SectionMap[&Section];
+
+    if (!Entry)
+      Entry = new MCSectionData(Section, &Assembler);
+
+    return *Entry;
+  }
+
   MCSymbolData &getSymbolData(MCSymbol &Symbol) {
     MCSymbolData *&Entry = SymbolMap[&Symbol];
 
@@ -135,14 +144,9 @@
   
   // If already in this section, then this is a noop.
   if (Section == CurSection) return;
-  
-  CurSection = Section;
-  MCSectionData *&Entry = SectionMap[Section];
 
-  if (!Entry)
-    Entry = new MCSectionData(*Section, &Assembler);
-
-  CurSectionData = Entry;
+  CurSection = Section;
+  CurSectionData = &getSectionData(*Section);
 }
 
 void MCMachOStreamer::EmitLabel(MCSymbol *Symbol) {





More information about the llvm-commits mailing list