[llvm] 4f26edd - [NFC][YAML] Add `IO::error()` (#123475)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 03:56:55 PST 2025
Author: Vitaly Buka
Date: 2025-01-23T03:56:51-08:00
New Revision: 4f26edd5e9eb3b6cea19e15ca8fb2c8416b82fa8
URL: https://github.com/llvm/llvm-project/commit/4f26edd5e9eb3b6cea19e15ca8fb2c8416b82fa8
DIFF: https://github.com/llvm/llvm-project/commit/4f26edd5e9eb3b6cea19e15ca8fb2c8416b82fa8.diff
LOG: [NFC][YAML] Add `IO::error()` (#123475)
For #123280
Added:
Modified:
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/Support/YAMLTraits.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index eca26e90845bf6..e707a445012b51 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -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>
@@ -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;
@@ -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
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index f326422138488c..28642e004c4f43 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -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
More information about the llvm-commits
mailing list