[PATCH] support validation for YAML I/O mappings

Nick Kledzik kledzik at apple.com
Tue Nov 19 17:56:26 PST 2013


Here is my proposed patch for enhancing YAML I/O to allow semantic level error checking.  I previous made a change in r194655 to allow dyn_cast<> to work with yaml Input and Output types.  So that mapping() methods used  on input, could detect that and do extra checking.  If this new way is better, I’ll revert that change.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: yaml.patch
Type: application/octet-stream
Size: 6590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131119/18e2e68c/attachment.obj>
-------------- next part --------------


Some things to think  about:

1) When writing yaml, what should happen if the validate() method find the in-memory struct is semantically invalid?  My patch has it triggering an assert().
2) Is a StringRef the best way to return the error string?  Another possibility is that the caller of validate() passes in a std::string which the validate() method fills in if there is an error. 

-Nick



More information about the llvm-commits mailing list