[LLVMdev] Status of YAML IO?

Nick Kledzik kledzik at apple.com
Mon Oct 22 17:07:15 PDT 2012

On Oct 22, 2012, at 4:40 PM, Sean Silva wrote:
> Hey Nick, what's the status on YAML IO? The other thread seems to have died.\

I'm waiting on Michael Spencer's feedback.  

The issues I know of right now are:

1) Should we structure YAML I/O to be a more general I/O utility that could support reading and writing other data formats such as JSON or plists.  RIght now, all the code is in the llvm::yaml:: namespace.  I we planned to generalize later, only the yaml specific parts should be in the llvm::yaml namespace.  

You mentioned that YAML (1.2) is a superset of JSON.  While that is true, there is some impedance mismatch:  a) that does not help writing JSON documents, and b) there is the issue that JSON requires all strings to be quoted, whereas YAML does not.

2) Can the template meta programming used by YAML I/O work in C++03?  My current implementation was written in C++11, but then back ported to C++03 in a way that works with clang, but may not work with other compilers.  Here is an example:

template <class T>
struct has_output
  static double test(...);
#if __has_feature(cxx_access_control_sfinae)
  template <class U, class X> 
  static auto test(U& u, X& x)
    -> decltype(U::output(std::declval<const X&>(), std::declval<llvm::raw_ostream&>()), char());
  template <class U, class X> 
  static __typeof__(U::output(std::declval<const X&>(), std::declval<llvm::raw_ostream&>()), char()) test(U& u, X& x);
  static const bool value = (sizeof(test(std::declval<ScalarTraits<T>&>(), std::declval<T&>())) == 1);


More information about the llvm-dev mailing list