[llvm] 8231176 - [obj2yaml] - Rename `Group` to `GroupSection`. NFC.
Georgii Rymar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 7 07:13:51 PDT 2020
Author: Georgii Rymar
Date: 2020-10-07T17:04:15+03:00
New Revision: 82311766d993f730506cb82471d7349a380a5df7
URL: https://github.com/llvm/llvm-project/commit/82311766d993f730506cb82471d7349a380a5df7
DIFF: https://github.com/llvm/llvm-project/commit/82311766d993f730506cb82471d7349a380a5df7.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/ObjectYAML/ELFYAML.h
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/tools/obj2yaml/elf2yaml.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h b/llvm/include/llvm/ObjectYAML/ELFYAML.h
index 17ba8f9fda21..0581b0b28b68 100644
--- a/llvm/include/llvm/ObjectYAML/ELFYAML.h
+++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h
@@ -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; }
};
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp
index 10f31555005f..559c45a56d71 100644
--- a/llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -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");
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index a86172418c1e..5e642d90ffc7 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -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())
diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp
index f5ad6a0a4499..2d09c34c093f 100644
--- a/llvm/tools/obj2yaml/elf2yaml.cpp
+++ b/llvm/tools/obj2yaml/elf2yaml.cpp
@@ -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);
More information about the llvm-commits
mailing list