1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[obj2yaml] - Rename Group to GroupSection. NFC.

The `Group` class represents a group section and it is
named inconsistently with other sections which all has
the "Section" suffix. It is sometimes confusing,
this patch addresses the issue.

Differential revision: https://reviews.llvm.org/D88892
This commit is contained in:
Georgii Rymar 2020-10-06 16:04:15 +03:00
parent 67f382cd89
commit 331305b3b2
4 changed files with 14 additions and 12 deletions

View File

@ -444,13 +444,13 @@ struct VerdefSection : Section {
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Verdef; }
};
struct Group : Section {
struct GroupSection : Section {
// Members of a group contain a flag and a list of section indices
// that are part of the group.
std::vector<SectionOrType> Members;
Optional<StringRef> Signature; /* Info */
Group() : Section(ChunkKind::Group) {}
GroupSection() : Section(ChunkKind::Group) {}
static bool classof(const Chunk *S) { return S->Kind == ChunkKind::Group; }
};

View File

@ -245,7 +245,8 @@ template <class ELFT> class ELFState {
void writeSectionContent(Elf_Shdr &SHeader,
const ELFYAML::RelrSection &Section,
ContiguousBlobAccumulator &CBA);
void writeSectionContent(Elf_Shdr &SHeader, const ELFYAML::Group &Group,
void writeSectionContent(Elf_Shdr &SHeader,
const ELFYAML::GroupSection &Group,
ContiguousBlobAccumulator &CBA);
void writeSectionContent(Elf_Shdr &SHeader,
const ELFYAML::SymtabShndxSection &Shndx,
@ -697,7 +698,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
writeSectionContent(SHeader, *S, CBA);
} else if (auto S = dyn_cast<ELFYAML::RelrSection>(Sec)) {
writeSectionContent(SHeader, *S, CBA);
} else if (auto S = dyn_cast<ELFYAML::Group>(Sec)) {
} else if (auto S = dyn_cast<ELFYAML::GroupSection>(Sec)) {
writeSectionContent(SHeader, *S, CBA);
} else if (auto S = dyn_cast<ELFYAML::ARMIndexTableSection>(Sec)) {
writeSectionContent(SHeader, *S, CBA);
@ -1237,7 +1238,7 @@ void ELFState<ELFT>::writeSectionContent(
template <class ELFT>
void ELFState<ELFT>::writeSectionContent(Elf_Shdr &SHeader,
const ELFYAML::Group &Section,
const ELFYAML::GroupSection &Section,
ContiguousBlobAccumulator &CBA) {
assert(Section.Type == llvm::ELF::SHT_GROUP &&
"Section type is not SHT_GROUP");

View File

@ -1214,7 +1214,7 @@ static void sectionMapping(IO &IO, ELFYAML::RelrSection &Section) {
IO.mapOptional("Content", Section.Content);
}
static void groupSectionMapping(IO &IO, ELFYAML::Group &Group) {
static void groupSectionMapping(IO &IO, ELFYAML::GroupSection &Group) {
commonSectionMapping(IO, Group);
IO.mapOptional("Info", Group.Signature);
IO.mapRequired("Members", Group.Members);
@ -1353,8 +1353,8 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
break;
case ELF::SHT_GROUP:
if (!IO.outputting())
Section.reset(new ELFYAML::Group());
groupSectionMapping(IO, *cast<ELFYAML::Group>(Section.get()));
Section.reset(new ELFYAML::GroupSection());
groupSectionMapping(IO, *cast<ELFYAML::GroupSection>(Section.get()));
break;
case ELF::SHT_NOBITS:
if (!IO.outputting())

View File

@ -94,7 +94,7 @@ class ELFDumper {
Expected<ELFYAML::VerdefSection *> dumpVerdefSection(const Elf_Shdr *Shdr);
Expected<ELFYAML::SymverSection *> dumpSymverSection(const Elf_Shdr *Shdr);
Expected<ELFYAML::VerneedSection *> dumpVerneedSection(const Elf_Shdr *Shdr);
Expected<ELFYAML::Group *> dumpGroup(const Elf_Shdr *Shdr);
Expected<ELFYAML::GroupSection *> dumpGroupSection(const Elf_Shdr *Shdr);
Expected<ELFYAML::ARMIndexTableSection *>
dumpARMIndexTableSection(const Elf_Shdr *Shdr);
Expected<ELFYAML::MipsABIFlags *> dumpMipsABIFlags(const Elf_Shdr *Shdr);
@ -480,7 +480,7 @@ ELFDumper<ELFT>::dumpSections() {
case ELF::SHT_RELR:
return [this](const Elf_Shdr *S) { return dumpRelrSection(S); };
case ELF::SHT_GROUP:
return [this](const Elf_Shdr *S) { return dumpGroup(S); };
return [this](const Elf_Shdr *S) { return dumpGroupSection(S); };
case ELF::SHT_NOBITS:
return [this](const Elf_Shdr *S) { return dumpNoBitsSection(S); };
case ELF::SHT_NOTE:
@ -1323,8 +1323,9 @@ Expected<StringRef> ELFDumper<ELFT>::getSymbolName(uint32_t SymtabNdx,
}
template <class ELFT>
Expected<ELFYAML::Group *> ELFDumper<ELFT>::dumpGroup(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::Group>();
Expected<ELFYAML::GroupSection *>
ELFDumper<ELFT>::dumpGroupSection(const Elf_Shdr *Shdr) {
auto S = std::make_unique<ELFYAML::GroupSection>();
if (Error E = dumpCommonSection(Shdr, *S))
return std::move(E);