[PATCH] D46054: [TableGen] Add a general-purpose JSON backend.
Simon Tatham via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 30 06:22:46 PDT 2018
simon_tatham added a comment.
@nhaehnle, following up discussion about `NAME` in https://reviews.llvm.org/D47430 (and hopefully posted in the right place this time):
I was going to change this patch so that it uses `!name` instead of `NAME` for the key inside each JSON def object that gives the def's own name. (Mostly the reason I think it's useful to have such a key at all is so that client code that's consuming the JSON can pass those dictionaries to its own subfunctions without having to pass the name alongside it, so it makes sense to me to use a key that indicates that it's a JSON-specific convenience.)
But it's just struck me that there might also be a use case for knowing whether the record is //anonymous// or not, in the sense of whether its name is something that was deliberately specified in the TableGen input or whether it was some `anonymous_123` value made up by tblgen itself.
I was thinking of adding a boolean field `!anonymous`, or alternatively perhaps having `!key` and `!name` (where `!key` is always the key under which this record is stored in the JSON root object, and `!name` is either the same as `!key` or null). Any particular preference, before I make the changes? Or is the entire idea not worth bothering with?
(Also, I noticed in passing that the `IsAnonymous` field isn't set reliably: the records defined by an anonymous `defm` have it false rather than true. That looks easy to fix, and I could fold that into this change or make it a separate one.)
https://reviews.llvm.org/D46054
More information about the llvm-commits
mailing list