[llvm-commits] [PATCH] YAML I/O
Sean Silva
silvas at purdue.edu
Fri Sep 14 13:04:50 PDT 2012
I don't think that a GCC extension would be allowed. Could you do this with
enable_if?
CC'ing Richard Smith since if this is possible in C++03, he'll almost
surely know how to do it.
--Sean Silva
On Thu, Sep 13, 2012 at 6:58 PM, Nick Kledzik <kledzik at apple.com> wrote:
> I have the traits based approach working for C++11. I have a way to get
> it
> working for C++03, but it uses the typeof() (aka __typeof__()) language
> extension.
> It that extension legal in the LLVM code base? It is used in one place
> in lib/Support/Unix/Program.inc. But that might be ok because that file
> is only compile by gcc or clang??
>
> I need a way to test if a class implements a particular method with
> particular parameters.
>
> template <class T>
> struct has_scalar_trait
> {
> private:
> struct two {char _[2];};
> static two test(...);
> template <class U, class X>
> static __typeof__(U::doScalar(declval<class IO&>(), declval<X&>()),
> char()) test(U& u, X& x);
> public:
> static const bool value = (sizeof(test(declval<ScalarTrait<T>&>(),
> declval<T&>())) == 1);
> };
>
>
> -Nick
>
> On Aug 28, 2012, at 9:28 AM, Sean Silva wrote:
> >> This format is the most compact. It is also the format that is easiest
> for
> >> YAML I/O to validate, since the legal keys at any point are well
> defined.
> >> What is lost though, is the original order of shapes. For lld, that
> does
> >> not matter. In fact the lld::File model does not have one list of all
> >> Atoms. It already has four lists. One for each Atom kind.
> >
> > Ok, this seems satisfactory. I think it's important though that there
> > actually be an order here, for the sake of testing. E.g. it could be
> > that the keys are output in alphabetical order.
> >
> > --Sean Silva
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120914/3d824f0a/attachment.html>
More information about the llvm-commits
mailing list