-
Notifications
You must be signed in to change notification settings - Fork 444
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
Move IRUtils Literal get functions to the respective IR members. Add stringliteral get function. #4623
Conversation
002e4b2
to
f058dab
Compare
Do you mean e.g. |
Yes, something in that form. |
OK, I think that would make more sense than the freestanding functions. |
f058dab
to
4d9d190
Compare
Alright, gave this a shot. There is probably more utils we could add. |
4d9d190
to
333ed41
Compare
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.
I think there is a problem when caching values that can have valid source info. Either we cannot cache these at all, or we would need the cache to take the source info into account (but then it is unlikely it would hit). Otherwise, we risk breaking error messages because the programmer will believe that the source info is there, but it won't (or it will be wrong one!). I wonder if the cache makes sense at all. Maybe in testgen it could...
I do realize this is not new in the PR. But since you have changed this code and likely intend to use it more widely, I suggest this is fixed now.
51cef18
to
3acde1b
Compare
3acde1b
to
cde8444
Compare
@@ -11,6 +11,8 @@ | |||
#include <tuple> | |||
#include <type_traits> | |||
|
|||
#include "lib/big_int_util.h" |
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.
maybe it would make sense to reverse the dependency and instantiate hasher inside lib/big_int_util.h
? Right now it seems that everyone who'd like to use lib/hash.h
would pull big_int_util.h
, this seems to be not quite a good thing to me.
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.
big_int_util
is mostly used for the declaration of big_int
, which is used fairly pervasively in the compiler. We can split that out?
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.
Right. But why does it become the hash dependency? It seems it should be the opposite: big_int_utils
should depend on hash
and not vice versa. To make it a bit more clear: why would #include lib/hash.h
pull in the declaration of big_int
?
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.
Yes, I have a fix for that in #4655.
I have been doing this a lot lately, so might as well contribute a utility function. Maybe all of these "get" functions should be static class members?