-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make json output more informative for functions. #6380
Conversation
It now includes the attributes I was able to find as well as the return type, linkage, and purity. This explicitly includes the return type because a function might be declared without an explicit return type (eg `int i; auto ref foo() { return i; }`) and that results in a type in the json of `ref ()`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks useful to me. Maybe two minor points:
- I think it's worthwhile to use sth. like
attrs
orattributes
to keep the JSON object clean and adjustable for future attributes. - Is it possible to output UDAs as well?
property("parameters", tf.parameters); | ||
property("trust", tf.trust); | ||
propertyBool("nothrow", tf.isnothrow); | ||
propertyBool("nogc", tf.isnogc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worthwhile to put these under attributes
, especially considering that UDAs should also be part of the output.
@dhasenan Are you still interested in pursuing this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reduce the size of the json output, I suggest outputting the boolean attributes only if they are true
. The reader can infer if they are not present that they are false
.
Using protocol buffers (eg https://github.com/msoucy/dproto) would reduce need for such hacks, and have many other advantages, primarily type/schema safety, better performance, ease of reading and writing. |
@dhasenan why did you close this? |
Because I am not currently able to spend any time on it. It's over a year old and probably has merge errors. |
No problem. I'll see if someone else wants to pick it up. |
It now includes the attributes I was able to find as well as the return type, linkage, and purity.
This explicitly includes the return type because a function might be declared without an explicit
return type (eg
int i; auto ref foo() { return i; }
) and that results in a type in the json ofref ()
.