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

Andrew Tulloch andrew at tullo.ch
Mon Nov 18 07:17:30 PST 2013


  @alexfh - thanks for reviewing the patch. I don't have commit access, and feel free to commit the patch (with whatever changes you feel like - the rewording you proposed is much clearer).

  Thanks!

  Andrew


================
Comment at: lib/Support/YAMLTraits.cpp:118
@@ +117,3 @@
+  // when to fail until we reach this point.
+  if (!CurrentNode) {
+    if (Required)
----------------
Alexander Kornienko wrote:
> Andrew Tulloch wrote:
> > Alexander Kornienko wrote:
> > > Is CurrentNode NULL only when the document is empty? Can it be NULL when parsing invalid documents?
> > It would be null in the case where the document is invalid, yes. In that case we would have set `EC` in `setCurrentDocument()`, and so wouldn't have reached this part of the method.  
> > 
> > Would you like this comment to be clarified?
> Yes, the comment needs to be clarified. Mostly by removing the description of _what_ we're doing, and leaving only _why_, e.g. "CurrentNode is null for empty documents, which is an error in the presence of required keys." or something similar. What do you think?
I think your wording is much clearer, thanks!


http://llvm-reviews.chandlerc.com/D1236



More information about the llvm-commits mailing list