Skip to content

Commit a1558db

Browse files
committed
error()
Created using spr 1.3.4
1 parent 1576e59 commit a1558db

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

llvm/include/llvm/Support/YAMLTraits.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ class IO {
819819
virtual NodeKind getNodeKind() = 0;
820820

821821
virtual void setError(const Twine &) = 0;
822+
virtual std::error_code error() = 0;
822823
virtual void setAllowUnknownKeys(bool Allow);
823824

824825
template <typename T>
@@ -1448,7 +1449,7 @@ class Input : public IO {
14481449
~Input() override;
14491450

14501451
// Check if there was an syntax or semantic error during parsing.
1451-
std::error_code error();
1452+
std::error_code error() override;
14521453

14531454
private:
14541455
bool outputting() const override;
@@ -1631,6 +1632,7 @@ class Output : public IO {
16311632
void scalarTag(std::string &) override;
16321633
NodeKind getNodeKind() override;
16331634
void setError(const Twine &message) override;
1635+
std::error_code error() override;
16341636
bool canElideEmptySequence() override;
16351637

16361638
// These are only used by operator<<. They could be private

llvm/lib/ObjectYAML/ELFYAML.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,7 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
16011601
TypeStr = getStringValue(IO, "Type");
16021602
if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) {
16031603
IO.mapRequired("Type", Type);
1604-
if (static_cast<Input&>(IO).error())
1604+
if (IO.error())
16051605
Type = ELF::SHT_NULL;
16061606
}
16071607
}

llvm/lib/Support/YAMLTraits.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,10 @@ void Output::scalarTag(std::string &Tag) {
750750
void Output::setError(const Twine &message) {
751751
}
752752

753+
std::error_code Output::error() {
754+
return {};
755+
}
756+
753757
bool Output::canElideEmptySequence() {
754758
// Normally, with an optional key/value where the value is an empty sequence,
755759
// the whole key/value can be not written. But, that produces wrong yaml

0 commit comments

Comments
 (0)