[llvm] r206080 - Pull out a named variable for the cached section names to aid readability.
David Blaikie
dblaikie at gmail.com
Fri Apr 11 15:49:14 PDT 2014
Author: dblaikie
Date: Fri Apr 11 17:49:14 2014
New Revision: 206080
URL: http://llvm.org/viewvc/llvm-project?rev=206080&view=rev
Log:
Pull out a named variable for the cached section names to aid readability.
Based on a code review suggestion from Eric Christopher in r205990
Modified:
llvm/trunk/lib/MC/MCContext.cpp
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=206080&r1=206079&r2=206080&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Fri Apr 11 17:49:14 2014
@@ -241,7 +241,8 @@ void MCContext::renameELFSection(const M
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, unsigne
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 Sect
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;
More information about the llvm-commits
mailing list