summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-04-11 22:49:14 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-04-11 22:49:14 +0000
commitb60e61c15fce38f031576adb7bd2d78b3382a916 (patch)
treece680d2d5263b3d6453dafde3340317853be18d8 /llvm/lib/MC/MCContext.cpp
parentb9a0551862fbfc63064faa7859c3a251209f21da (diff)
downloadbcm5719-llvm-b60e61c15fce38f031576adb7bd2d78b3382a916.tar.gz
bcm5719-llvm-b60e61c15fce38f031576adb7bd2d78b3382a916.zip
Pull out a named variable for the cached section names to aid readability.
Based on a code review suggestion from Eric Christopher in r205990 llvm-svn: 206080
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r--llvm/lib/MC/MCContext.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 36e6b565adb..4152d6344e9 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -241,7 +241,8 @@ void MCContext::renameELFSection(const MCSectionELF *Section, StringRef Name) {
auto I =
ELFUniquingMap.insert(std::make_pair(SectionGroupPair(Name, GroupName),
Section)).first;
- const_cast<MCSectionELF*>(Section)->setSectionName(I->first.first);
+ StringRef CachedName = I->first.first;
+ const_cast<MCSectionELF*>(Section)->setSectionName(CachedName);
}
const MCSectionELF *MCContext::
@@ -262,8 +263,9 @@ getELFSection(StringRef Section, unsigned Type, unsigned Flags,
if (!Group.empty())
GroupSym = GetOrCreateSymbol(Group);
- MCSectionELF *Result = new (*this) MCSectionELF(
- Entry.first.first, Type, Flags, Kind, EntrySize, GroupSym);
+ StringRef CachedName = Entry.first.first;
+ MCSectionELF *Result = new (*this)
+ MCSectionELF(CachedName, Type, Flags, Kind, EntrySize, GroupSym);
Entry.second = Result;
return Result;
}
@@ -291,9 +293,9 @@ MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
if (!COMDATSymName.empty())
COMDATSymbol = GetOrCreateSymbol(COMDATSymName);
- MCSectionCOFF *Result =
- new (*this) MCSectionCOFF(Iter->first.first, Characteristics,
- COMDATSymbol, Selection, Assoc, Kind);
+ StringRef CachedName = Iter->first.first;
+ MCSectionCOFF *Result = new (*this) MCSectionCOFF(
+ CachedName, Characteristics, COMDATSymbol, Selection, Assoc, Kind);
Iter->second = Result;
return Result;
OpenPOWER on IntegriCloud