-
Notifications
You must be signed in to change notification settings - Fork 284
Pointer cleanup #1154
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
Pointer cleanup #1154
Conversation
src/ansi-c/ansi_c_entry_point.cpp
Outdated
| index.copy_to_operands(zero_string, from_integer(0, uint_type())); | ||
| exprt address_of("address_of", pointer_typet()); | ||
| address_of.type().subtype()=char_type(); | ||
| exprt address_of("address_of", pointer_type(char_type())); |
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.
Please use address_of_exprt
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.
done
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.
Happy to approve once pushed.
src/cpp/cpp_constructor.cpp
Outdated
| address_of.type().subtype()=object_tc.type(); | ||
| address_of.copy_to_operands(object_tc); | ||
| exprt address_of= | ||
| address_of_exprt(object_tc, pointer_type(object_tc.type())); |
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.
address_of_exprt address_of(object_tc...);
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.
Done
src/cpp/cpp_destructor.cpp
Outdated
| address_of.type().subtype()=object.type(); | ||
| address_of.copy_to_operands(object); | ||
| exprt address_of= | ||
| address_of_exprt(object, pointer_type(object.type())); |
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.
See above
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.
Done
| index_exprt index( | ||
| expr, | ||
| from_integer(0, index_type()), | ||
| expr.type().subtype()); |
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.
The third argument is not necessary
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.
Done
| expr_pfrom, pto, expr_ptmp, tmp_rank)) | ||
| // try derived-to-base conversion | ||
| exprt expr_pfrom= | ||
| address_of_exprt(expr, pointer_type(expr.type())); |
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.
addres_of_exprt expr_pfrom...
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.
Done
src/goto-symex/auto_objects.cpp
Outdated
|
|
||
| address_of_exprt address_of_expr= | ||
| address_of_exprt(make_auto_object(type.subtype())); | ||
| address_of_exprt( |
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.
Use constructor, not assignment
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.
done
|
|
||
| #include <util/namespace.h> | ||
| #include <util/std_expr.h> | ||
| #include <util/c_types.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.
Nit picking as above
| #include <util/arith_tools.h> | ||
| #include <util/ieee_float.h> | ||
| #include <util/simplify_expr.h> | ||
| #include <util/c_types.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.
Nit picking as above
src/solvers/smt2/smt2_conv.cpp
Outdated
| #include <util/base_type.h> | ||
| #include <util/string2int.h> | ||
| #include <util/invariant.h> | ||
| #include <util/c_types.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.
Nit picking as above
| \*******************************************************************/ | ||
|
|
||
| address_of_exprt::address_of_exprt(const exprt &_op): |
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.
Is this actually being used? Most (all?) calls above appear to use a two-argument constructor
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.
Now using it more.
894a5b3 to
c73ee7a
Compare
src/ansi-c/ansi_c_entry_point.cpp
Outdated
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.
Could use array_of_exprt array_of(... here
src/ansi-c/ansi_c_entry_point.cpp
Outdated
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.
index_exprt index_expr(...) and the lines below should be eliminated
src/ansi-c/ansi_c_entry_point.cpp
Outdated
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.
index_exprt index_expr(... and again code below to be eliminated
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.
Might be a candidate for address_of_exprt address_of(...
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.
Unfortunately not, as this might turn into a dereference expression.
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.
index_exprt index(...
c73ee7a to
9dd44d6
Compare
9dd44d6 to
db71221
Compare
This is in preparation for giving pointers a width (much like integers), using constructors and a service function to produce pointer and reference types whenever appropriate.
Split off PR #970.