Page MenuHomePhabricator

[JSON] Handle uint64_t type

Authored by djtodoro on Sep 7 2021, 1:38 AM.



There was no handling of uint64_t in the LLVM JSON library. This patch adds support for that.
The motivation is the

Diff Detail

Event Timeline

djtodoro created this revision.Sep 7 2021, 1:38 AM
djtodoro requested review of this revision.Sep 7 2021, 1:38 AM
djtodoro updated this revision to Diff 371547.Sep 9 2021, 4:05 AM
  • apply clang-format suggestions

Looks mostly good, but I don't think the parsing side of things quite works: in order for us to ever parse a JSON value as an unsigned integer - including with parse<uint64_t> - we need to either produce unsigned Values in Parser::parseNumber, or allow getAsUINT64 to produce unsigned values from integer Values. As there is no real way to represent unsigned values in JSON, I think the latter makes more sense as it simply needs a check to ensure that the integer value is not negative.

I haven't paid attention to the parse() part, but I should have. Hmm, I think parsing an int as unsigned via getAsUNIT64() is a better way IMO, so I'll do that way.

djtodoro updated this revision to Diff 377836.Oct 7 2021, 7:03 AM
  • handle parse()
This revision is now accepted and ready to land.Oct 7 2021, 7:10 AM
This revision was landed with ongoing or failed builds.Oct 15 2021, 2:19 AM
This revision was automatically updated to reflect the committed changes.