From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- llvm/lib/Support/YAMLTraits.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Support/YAMLTraits.cpp') diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp index 5f0cedc71829..9ac7c65e19f7 100644 --- a/llvm/lib/Support/YAMLTraits.cpp +++ b/llvm/lib/Support/YAMLTraits.cpp @@ -166,6 +166,8 @@ bool Input::preflightKey(const char *Key, bool Required, bool, bool &UseDefault, if (!MN) { if (Required || !isa(CurrentNode)) setError(CurrentNode, "not a mapping"); + else + UseDefault = true; return false; } MN->ValidKeys.push_back(Key); @@ -738,7 +740,7 @@ bool Output::canElideEmptySequence() { // the whole key/value can be not written. But, that produces wrong yaml // if the key/value is the only thing in the map and the map is used in // a sequence. This detects if the this sequence is the first key/value - // in map that itself is embedded in a sequnce. + // in map that itself is embedded in a sequence. if (StateStack.size() < 2) return true; if (StateStack.back() != inMapFirstKey) @@ -876,12 +878,12 @@ StringRef ScalarTraits::input(StringRef Scalar, void *, } void ScalarTraits::output(const std::string &Val, void *, - raw_ostream &Out) { + raw_ostream &Out) { Out << Val; } StringRef ScalarTraits::input(StringRef Scalar, void *, - std::string &Val) { + std::string &Val) { Val = Scalar.str(); return StringRef(); } -- cgit v1.2.3