Detect malformed YAML sequence in yaml::Input::beginSequence()
authorJustin Bogner <mail@justinbogner.com>
Mon, 2 Mar 2015 17:26:43 +0000 (17:26 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 2 Mar 2015 17:26:43 +0000 (17:26 +0000)
commit64d2cdf4ec62d16ba2b2b3bc7a99750e7e02eeb3
tree0470324f57892861cf2464112ebed2042938c59c
parentd50bca7314b94589385a195894caa579d1d9977d
Detect malformed YAML sequence in yaml::Input::beginSequence()

When reading a yaml::SequenceTraits object, YAMLIO does not report an
error if the yaml item is not a sequence. Instead, YAMLIO reads an
empty sequence. For example:

---
seq:
    foo: 1
    bar: 2
...

If `seq` is a SequenceTraits object, then reading the above yaml will
yield `seq` as an empty sequence.

Fix this to report an error for the above mapping ("not a sequence")

Patch by William Fisher. Thanks!

llvm-svn: 230976
llvm/lib/Support/YAMLTraits.cpp
llvm/unittests/Support/YAMLIOTest.cpp