[PATCH] [YAML] Recover gracefully when deserializing invalid YAML input.

Alp Toker alp at nuanti.com
Fri Nov 15 06:50:16 PST 2013

Hi Chandler,

Writing off-list because the discussions are getting a bit heated over
what's ultimately not a big deal..

 include/llvm/Support/YAMLTraits.h |   15 ++++++--
 lib/Support/YAMLTraits.cpp        |   33 +++++++++++++++++--
 unittests/Support/YAMLIOTest.cpp  |   64
 3 files changed, 99 insertions(+), 13 deletions(-)

The unit test is twice the size of the implementation in this patch.

There's an entire standalone C compiler out there written in fewer lines
of code than just the /YAML unit tests/.

The code either dumps valid YAML or it doesn't. If for whatever reason
it doesn't dump valid YAML, the problem could be detected rapidly by lit
tests or external consumers.

This is a good example of why there was a backlash against more
systematic testing like mock tests (which is actually not a bad idea in
principle, I honestly kind of want it if it can be added the right way).


On 15/11/2013 13:51, Andrew Tulloch wrote:
>   Updated with reviewer comments, and added unit tests covering the empty string for the sequence/map with {required, optional} keys cases.
> Hi gribozavr, kledzik, rsmith, bkramer, chandlerc,
> http://llvm-reviews.chandlerc.com/D1236
>   http://llvm-reviews.chandlerc.com/D1236?vs=3142&id=5572#toc
> Files:
>   include/llvm/Support/YAMLTraits.h
>   lib/Support/YAMLTraits.cpp
>   unittests/Support/YAMLIOTest.cpp
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

the browser experts

More information about the llvm-commits mailing list