diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-28 05:48:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-28 05:48:54 +0000 |
commit | d82ef0e923a3a6c4710dfb884b55b0d52a9a201e (patch) | |
tree | e4455519e1655f54ea7767c3d9ca2cc11074dc76 /llvm/lib/MC/MCMachOStreamer.cpp | |
parent | 96abad185dadfa7c2d29472349300ce443a1ce04 (diff) | |
download | bcm5719-llvm-d82ef0e923a3a6c4710dfb884b55b0d52a9a201e.tar.gz bcm5719-llvm-d82ef0e923a3a6c4710dfb884b55b0d52a9a201e.zip |
llvm-mc: Factor getSectionData out of SwitchSection.
llvm-svn: 80344
Diffstat (limited to 'llvm/lib/MC/MCMachOStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCMachOStreamer.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCMachOStreamer.cpp b/llvm/lib/MC/MCMachOStreamer.cpp index e89f7d8dbd3..9f813fdc49e 100644 --- a/llvm/lib/MC/MCMachOStreamer.cpp +++ b/llvm/lib/MC/MCMachOStreamer.cpp @@ -63,6 +63,15 @@ private: 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 @@ void MCMachOStreamer::SwitchSection(const MCSection *Section) { // 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) { |