This is an archive of the discontinued LLVM Phabricator instance.

[yaml] Add a ScalarTraits for mapping endian aware types.
ClosedPublic

Authored by zturner on Jun 6 2016, 10:57 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 59829.Jun 6 2016, 10:57 PM
zturner retitled this revision from to [yaml] Add a ScalarTraits for mapping endian aware types..
zturner updated this object.
zturner added reviewers: majnemer, kledzik.
zturner added a subscriber: llvm-commits.
zturner updated this revision to Diff 59833.Jun 6 2016, 11:22 PM

Added some unit tests.

majnemer edited edge metadata.Jun 7 2016, 8:04 AM

I'm a little confused. It seems to me that this wraps the endian-aware types so perfectly that there is not an effective difference between ulittle32_t and uint32_t.

zturner added a subscriber: zturner.Jun 7 2016, 8:46 AM

The difference is that without this patch, the following does not compile:

ulittle32_t X;
IO.mapRequired("u32", X);

Sure, I could map it to a uint32_t, but all my internal data structures are
represented with iendian aware types, so this allows me to interact with
existing code more cleanly

majnemer accepted this revision.Jun 7 2016, 8:48 AM
majnemer edited edge metadata.

OK. So the actual use case is not:

ulittle32_t X;

but:

type_embedded_with_ulittle32 X;

?

If so, LGTM

This revision is now accepted and ready to land.Jun 7 2016, 8:48 AM

Essentially. One concrete example is vector<ulittle32_t>, without this
patch it's very onerous to create one of these

This revision was automatically updated to reflect the committed changes.