Skip to content

Commit

Permalink
[yaml2obj] - Implement BBAddrMapSection::getEntries(). NFC.
Browse files Browse the repository at this point in the history
This allows to use the generic fields validation
mechanism that we have.

The behavior (i.e. an error reported) remains the same.
  • Loading branch information
Georgii Rymar committed Nov 9, 2020
1 parent 053110b commit c9d036a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 4 additions & 0 deletions llvm/include/llvm/ObjectYAML/ELFYAML.h
Expand Up @@ -256,6 +256,10 @@ struct BBAddrMapSection : Section {

BBAddrMapSection() : Section(ChunkKind::BBAddrMap) {}

std::vector<std::pair<StringRef, bool>> getEntries() const override {
return {{"Entries", Entries.hasValue()}};
};

static bool classof(const Chunk *S) {
return S->Kind == ChunkKind::BBAddrMap;
}
Expand Down
6 changes: 0 additions & 6 deletions llvm/lib/ObjectYAML/ELFYAML.cpp
Expand Up @@ -1497,12 +1497,6 @@ std::string MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::validate(
return "";
}

if (const auto *BBAM = dyn_cast<ELFYAML::BBAddrMapSection>(C.get())) {
if ((BBAM->Content || BBAM->Size) && BBAM->Entries)
return "\"Entries\" cannot be used with \"Content\" or \"Size\"";
return "";
}

return "";
}

Expand Down

0 comments on commit c9d036a

Please sign in to comment.