Save a std::string.
The group names are always symbol names, so we can use a StringRef. llvm-svn: 233545
This commit is contained in:
parent
881497ac29
commit
d3ac79b3b4
|
@ -164,7 +164,7 @@ namespace llvm {
|
||||||
|
|
||||||
struct ELFSectionKey {
|
struct ELFSectionKey {
|
||||||
std::string SectionName;
|
std::string SectionName;
|
||||||
std::string GroupName;
|
StringRef GroupName;
|
||||||
ELFSectionKey(StringRef SectionName, StringRef GroupName)
|
ELFSectionKey(StringRef SectionName, StringRef GroupName)
|
||||||
: SectionName(SectionName), GroupName(GroupName) {}
|
: SectionName(SectionName), GroupName(GroupName) {}
|
||||||
bool operator<(const ELFSectionKey &Other) const {
|
bool operator<(const ELFSectionKey &Other) const {
|
||||||
|
@ -176,7 +176,7 @@ namespace llvm {
|
||||||
|
|
||||||
struct COFFSectionKey {
|
struct COFFSectionKey {
|
||||||
std::string SectionName;
|
std::string SectionName;
|
||||||
std::string GroupName;
|
StringRef GroupName;
|
||||||
int SelectionKey;
|
int SelectionKey;
|
||||||
COFFSectionKey(StringRef SectionName, StringRef GroupName,
|
COFFSectionKey(StringRef SectionName, StringRef GroupName,
|
||||||
int SelectionKey)
|
int SelectionKey)
|
||||||
|
|
|
@ -291,6 +291,12 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
||||||
unsigned Flags, unsigned EntrySize,
|
unsigned Flags, unsigned EntrySize,
|
||||||
StringRef Group, bool Unique,
|
StringRef Group, bool Unique,
|
||||||
const char *BeginSymName) {
|
const char *BeginSymName) {
|
||||||
|
MCSymbol *GroupSym = nullptr;
|
||||||
|
if (!Group.empty()) {
|
||||||
|
GroupSym = GetOrCreateSymbol(Group);
|
||||||
|
Group = GroupSym->getName();
|
||||||
|
}
|
||||||
|
|
||||||
// Do the lookup, if we have a hit, return it.
|
// Do the lookup, if we have a hit, return it.
|
||||||
auto IterBool = ELFUniquingMap.insert(
|
auto IterBool = ELFUniquingMap.insert(
|
||||||
std::make_pair(ELFSectionKey{Section, Group}, nullptr));
|
std::make_pair(ELFSectionKey{Section, Group}, nullptr));
|
||||||
|
@ -298,10 +304,6 @@ const MCSectionELF *MCContext::getELFSection(StringRef Section, unsigned Type,
|
||||||
if (!IterBool.second && !Unique)
|
if (!IterBool.second && !Unique)
|
||||||
return Entry.second;
|
return Entry.second;
|
||||||
|
|
||||||
MCSymbol *GroupSym = nullptr;
|
|
||||||
if (!Group.empty())
|
|
||||||
GroupSym = GetOrCreateSymbol(Group);
|
|
||||||
|
|
||||||
StringRef CachedName = Entry.first.SectionName;
|
StringRef CachedName = Entry.first.SectionName;
|
||||||
|
|
||||||
SectionKind Kind;
|
SectionKind Kind;
|
||||||
|
@ -340,18 +342,19 @@ const MCSectionCOFF *
|
||||||
MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
|
MCContext::getCOFFSection(StringRef Section, unsigned Characteristics,
|
||||||
SectionKind Kind, StringRef COMDATSymName,
|
SectionKind Kind, StringRef COMDATSymName,
|
||||||
int Selection, const char *BeginSymName) {
|
int Selection, const char *BeginSymName) {
|
||||||
// Do the lookup, if we have a hit, return it.
|
MCSymbol *COMDATSymbol = nullptr;
|
||||||
|
if (!COMDATSymName.empty()) {
|
||||||
|
COMDATSymbol = GetOrCreateSymbol(COMDATSymName);
|
||||||
|
COMDATSymName = COMDATSymbol->getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do the lookup, if we have a hit, return it.
|
||||||
COFFSectionKey T{Section, COMDATSymName, Selection};
|
COFFSectionKey T{Section, COMDATSymName, Selection};
|
||||||
auto IterBool = COFFUniquingMap.insert(std::make_pair(T, nullptr));
|
auto IterBool = COFFUniquingMap.insert(std::make_pair(T, nullptr));
|
||||||
auto Iter = IterBool.first;
|
auto Iter = IterBool.first;
|
||||||
if (!IterBool.second)
|
if (!IterBool.second)
|
||||||
return Iter->second;
|
return Iter->second;
|
||||||
|
|
||||||
MCSymbol *COMDATSymbol = nullptr;
|
|
||||||
if (!COMDATSymName.empty())
|
|
||||||
COMDATSymbol = GetOrCreateSymbol(COMDATSymName);
|
|
||||||
|
|
||||||
MCSymbol *Begin = nullptr;
|
MCSymbol *Begin = nullptr;
|
||||||
if (BeginSymName)
|
if (BeginSymName)
|
||||||
Begin = createTempSymbol(BeginSymName, false);
|
Begin = createTempSymbol(BeginSymName, false);
|
||||||
|
|
Loading…
Reference in New Issue