[llvm-commits] [PATCH] YAML I/O for review

Michael Spencer bigcheesegs at gmail.com
Wed Dec 5 11:58:17 PST 2012


On Tue, Dec 4, 2012 at 1:25 PM, Nick Kledzik <kledzik at apple.com> wrote:
> Attached is a patch to add functionality to llvm to aid in the conversion between in-memory data structures and YAML text files.
>
>
>
>
> The patch includes the implementation, test cases, and documentation.
>
> I've included a PDF of the documentation, so you don't have to install the patch and run sphinx to read it.
>
>
>
>
>
> Back in August I proposed a different implementation that required all in-memory data structure to derive from some yaml classes I had defined.  It was suggested that using a traits based approach could eliminate that intrusiveness and allow YAML I/O to work with any existing data structures by defining template specializations on the existing data types.   Doing that was straight forward with C++11, but getting it to work with older C++ compilers was challenging.  I finally found an alternate way to do the trait testing that should work with all C++ compilers.
>
> -Nick
>
>
>
>
>

Code looks good. Just a few concerns.

+  struct IntVector : public std::vector<int> {
+    // The existence of this member causes YAML I/O to use a flow sequence
+    static const bool flow = true;
+  };

Deriving types like this breaks the constructors for vector. There
needs to be a different way to do this that doesn't require flow to be
a member.

There are lots of style issues. Some of the main ones:

* No tabs.
* Uppercase variable names.
* Non-doxygen documentation.

- Michael Spencer




More information about the llvm-commits mailing list