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 | 91e7ee60faaf7867aebddbf4915e1422c6895337 (patch) | |
tree | 6dbcea291200e06762c90f09b053de31895f9e6d /lib/MC | |
parent | 3f952b45c4791659fe6b6addfdc2812f11a21a41 (diff) | |
download | external_llvm-91e7ee60faaf7867aebddbf4915e1422c6895337.zip external_llvm-91e7ee60faaf7867aebddbf4915e1422c6895337.tar.gz external_llvm-91e7ee60faaf7867aebddbf4915e1422c6895337.tar.bz2 |
llvm-mc: Factor getSectionData out of SwitchSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCMachOStreamer.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp index e89f7d8..9f813fd 100644 --- a/lib/MC/MCMachOStreamer.cpp +++ b/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) { |