Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/include/llvm/Support/YAMLTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ class IO {
virtual NodeKind getNodeKind() = 0;

virtual void setError(const Twine &) = 0;
virtual std::error_code error() = 0;
virtual void setAllowUnknownKeys(bool Allow);

template <typename T>
Expand Down Expand Up @@ -1448,7 +1449,7 @@ class Input : public IO {
~Input() override;

// Check if there was an syntax or semantic error during parsing.
std::error_code error();
std::error_code error() override;

private:
bool outputting() const override;
Expand Down Expand Up @@ -1631,6 +1632,7 @@ class Output : public IO {
void scalarTag(std::string &) override;
NodeKind getNodeKind() override;
void setError(const Twine &message) override;
std::error_code error() override;
bool canElideEmptySequence() override;

// These are only used by operator<<. They could be private
Expand Down
5 changes: 4 additions & 1 deletion llvm/lib/ObjectYAML/ELFYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,11 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
// When the Type string does not have a "SHT_" prefix, we know it is not a
// description of a regular ELF output section.
TypeStr = getStringValue(IO, "Type");
if (TypeStr.starts_with("SHT_") || isInteger(TypeStr))
if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) {
IO.mapRequired("Type", Type);
if (IO.error())
Type = ELF::SHT_NULL;
}
}

if (TypeStr == "Fill") {
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Support/YAMLTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ void Output::scalarTag(std::string &Tag) {
void Output::setError(const Twine &message) {
}

std::error_code Output::error() { return {}; }

bool Output::canElideEmptySequence() {
// Normally, with an optional key/value where the value is an empty sequence,
// the whole key/value can be not written. But, that produces wrong yaml
Expand Down
Loading