-
Notifications
You must be signed in to change notification settings - Fork 274
String refine preprocessing #378
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
String refine preprocessing #378
Conversation
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.
Broadly looks good, three main flavours of change to make:
(1) Some possible factoring in preprocess to consider
(2) Run cpplint.py to find code style problems
(3) Add commentary / function block comments to explain the reasoning behind some of the less-obvious code.
Regarding (3), cpplint.py will demand that you include a full docblock for every one of axioms_for_concat
and axioms_for_substring
and .... However I suspect if you consult with @forejtv / @peterschrammel they might be willing to accept a docblock for the /family/ of functions rather than lots of tedious repetition.
#include <util/prefix.h> | ||
#include <solvers/refinement/string_expr.h> | ||
|
||
symbol_exprt string_refine_preprocesst::new_tmp_symbol |
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.
Unify this with java_bytecode/java_bytecode_convert_method.cpp::tmp_variable
i_it->code=assignment; | ||
} | ||
|
||
void string_refine_preprocesst::make_string_function_side_effect |
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.
Can you factor these three nearly-identical functions?
debug() << "string_refine_preprocesst::make_to_char_array_function" | ||
<< "got nil object_size" << eom; | ||
|
||
auto location = function_call.source_location(); |
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.
Code style -- use cpplint.py
side_effect_exprt data_cpp_new_expr(ID_cpp_new_array, data.type()); | ||
data_cpp_new_expr.set(ID_size, length); | ||
symbol_exprt tmp_data= | ||
new_tmp_symbol("tmp_data", struct_type.components()[2].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.
To help people reading generated VCCs, give this a more descriptive name
|
||
// tmp_assign = MALLOC(struct java::array[reference],sizeof(s)) | ||
symbol_exprt tmp_assign = | ||
new_tmp_symbol("tmp_assign", pointer_typet(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.
Again, descriptive name would be good
} | ||
|
||
|
||
exprt string_refinementt::sum_of_map(std::map<exprt, int> & m, bool negated) |
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.
Comment on what this function does / what it's purpose is, and consider a more descriptive name
return plus_exprt(sum, index_const); | ||
} | ||
|
||
exprt string_refinementt::simplify_sum(const exprt &f) |
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.
Comment on what sort of simplification this can do
return sum_of_map(map); | ||
} | ||
|
||
exprt string_refinementt::compute_subst |
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.
What does this do? Subst...itution, I guess? But from what, to what? Looking below, I guess this could be renamed "instantiate_quanfitier" or "substitute_quantifier" or similar? What is f
for?
(const exprt &qvar, const exprt &val, const exprt &f) | ||
{ | ||
exprt positive, negative; | ||
// number of time the element should be added (can be negative) |
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 comment should make sense in context of a block comment up top, to tell us what 'the element' is, and what it's being added to, and so on
} | ||
else | ||
{ | ||
// otherwise we add k-1 |
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.
Explain, here or somewhere else, what's happening here-- will this be called repeatedly to decrement the quantifier towards its lower bound, or is this a one-shot instantiate-with-upper-bound-minus-one?
9b1e639
to
f5a6cfd
Compare
0625ef1
to
b69129b
Compare
b69129b
to
ff66780
Compare
4c26c59
to
2cd801d
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've only looked over the first part of it. My comments apply to the whole PR, though. I'll review again once it has been rebased and cleaned up.
const std::string &name, const typet &type) | ||
{ | ||
auxiliary_symbolt tmp_symbol; | ||
// TODO: add a prefix to the name to avoid clashing with other |
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 do that.
goto_functions.function_map[function_name]; | ||
} | ||
|
||
static bool is_java_string_type(const typet& 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.
Make it a static class member.
These are candidates to go into a util class at some point.
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.
Actually it is already declared here https://github.com/diffblue/cbmc/blob/master/src/solvers/refinement/refined_string_type.h#L64 so I'm going to use this one for now, but yes it could be moved
// variables of the program | ||
std::ostringstream buf; | ||
buf << prefix << "_" << (next_symbol_id++); | ||
std::string name = buf.str(); |
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.
cpplint
return false; | ||
} | ||
|
||
static bool is_java_string_pointer_type(const typet& 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.
function comment block missing
symbol_exprt("java::java.lang.String", string_typet()); | ||
// TODO: we should use a function which is not currently in the code base | ||
// to get the class identifier in this way: | ||
// get_class_identifier_field(in, symbol_typet("java::java.lang.Object"), ns); |
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.
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.
changed this here 918d97a
assert(ns.follow(object_type).id() == ID_struct); | ||
const struct_typet &struct_type=to_struct_type(object_type); | ||
typet length_type, data_type; | ||
for(unsigned i=0; i < struct_type.components().size(); i++) |
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 a ranged for
else if(struct_type.components()[i].get_name() == "data") | ||
data_type=struct_type.components()[i].type(); | ||
|
||
std::string fnamel=std::string(function_name.c_str()) + "_length"; |
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 id2string
// TODO: there should be a way defined in refined_string_type to access | ||
// the array element | ||
exprt rhs_data=member_exprt(arg, "content", data_type.subtype()); | ||
//exprt rhs_data=member_exprt(arg, "data", data_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.
code commented out? Fix, remove or use #if 0 and explain why
if(lhs.id()==ID_typecast) | ||
lhs=to_typecast_expr(lhs).op(); | ||
|
||
#if 0 |
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.
why is this code commented out?
|
||
Purpose: at the given position replace `r = some_function(arr,...)` by | ||
`r = function_name(arr.length, arr.data, ...)` | ||
TODO: document what exactly do the two options |
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 do so
334ac5f
to
3fd299a
Compare
#include <util/pointer_offset_size.h> | ||
#include <util/prefix.h> | ||
#include <goto-programs/class_identifier.h> | ||
#include <solvers/refinement/string_expr.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.
Strictly speaking, this is forbidden. This would introduce a dependency of goto-programs on solvers. So, the immediate guess is that string_expr.h should go into util/. However, this contains dependencies to solvers and java_bytecode, which I don't understand why they are needed. In my opinion. string_expr.h should be language-independent and be moved into util/: for this to happen, the includes bv_refinement.h (seems obsolete) and refined_string_type.h must be removed. The function to_refined_string_type should be defined in refined_string_type.h in the style of similar functions in std_expr.h.
Note: Investigating all these unwanted dependencies, I noticed that solvers depends on ansi-c (in qbf and flattening) and also on java_bytecode (in the string solver), which is not "clean". Also, goto-programs has dependencies on ansi-c, which should not be the case if we take the view of a goto-program being language-independent. All this is related to our multi-language facilities requiring some refactoring.
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.
@peterschrammel would you mind opening an issue to track those (undesirable) dependencies? I'm aware of some of them, but as you have done a proper investigation it would be great if you could note down the details of your findings so that we can all work on them. Thanks!!
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.
string_expr.h
could be moved to util but we need refined_string_type.h
(this is the type of string_exprt, and maybe these should be renamed to make that obvious). To avoid dependencies on java_bytecode and such, some static of methods of refined_string_type should be moved out of this class to more appropriate places.
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.
@peterschrammel do you prefer to have these changes (on string_expr and refined_string_type) in this pull request or should it be a new one?
symbol_exprt string_refine_preprocesst::new_tmp_symbol( | ||
const std::string &prefix, const typet &type) | ||
{ | ||
auxiliary_symbolt tmp_symbol; |
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.
Consider using #523 (once it has been merged) for adding fresh variables.
assert(ns.follow(object_type).id() == ID_struct); | ||
const struct_typet &struct_type=to_struct_type(object_type); | ||
for(unsigned i=0; i<struct_type.components().size(); i++) | ||
if(struct_type.components()[i].get_name() == "length") |
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.
cpplint (check whole file)
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 didn't get any error from cpplint on this file
|
||
/*******************************************************************\ | ||
|
||
Function: string_refine_preprocesst::insert_assignements |
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.
assignments (check whole file)
typet length_type, data_type; | ||
get_data_and_length_type_of_string(deref, data_type, length_type); | ||
|
||
std::string fnamel=id2string(function_name) + "_length"; |
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.
cpplint
{ | ||
exprt::operandst new_arguments; | ||
|
||
for(unsigned i=0; i<arguments.size(); i++) |
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.
std::size_t
const irep_idt &function_id) | ||
{ | ||
auto it=signatures.find(function_id); | ||
if(it != signatures.end()) |
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.
cpplint
Looks much cleaner now. Please squash the commits when finalising. |
|
||
\*******************************************************************/ | ||
|
||
#include "string_refine_preprocess.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: most files place the include of the class-specific header as the last #include
(I can't argue this is good or bad).
\*******************************************************************/ | ||
|
||
symbol_exprt string_refine_preprocesst::new_tmp_symbol( | ||
const std::string &prefix, const typet &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.
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 added a TODO note there, in case this PR is merged before
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 seems some poking and pushing on #523 is required...
{ | ||
symbolt tmp_symbol; | ||
std::ostringstream buf; | ||
buf << "string_preprocess" << (next_symbol_id++) << "#" << prefix; |
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 use of #' as separator may be dangerous as it is used in the SSA encoding. Code shouldn't be doing this, but may be relying only a single
#' to exist...
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.
tmp_symbol.name=name; | ||
tmp_symbol.type=type; | ||
symbol_table.add(tmp_symbol); | ||
return symbol_exprt(name, 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.
return tmp_symbol.symbol_expr();
auxiliary_symbolt func_symbol; | ||
func_symbol.base_name=function_name; | ||
func_symbol.is_static_lifetime=false; | ||
func_symbol.mode=ID_java; |
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.
Hardcoding ID_java looks scary to me. Why does that work? (Though, in fact, it might as well just not matter.)
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.
As mentioned in the next comment, this preprocessing functions are only for Java, so that's why there shouldn't be any problem there.
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.
If this is Java only, shouldn't all the files go in the java_bytecode folder? Language-specific parts should be as clearly separated from generic ones as possible.
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.
From the point of view of dependencies, we need goto-programs
but not anything from java_bytecode
. If code in java_bytecode
is allowed to use things from goto-programs
then yes we could move it there, but I'm not sure it's the case. Maybe @peterschrammel has an opinion on 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.
How is this code being invoked, i.e., where is the call that says "now let's do string preprocessing"? That might help to understand where it fits best.
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.
Invocation of the preprocessing is not part of this pull request but of this one: #429 (in particular here: https://github.com/diffblue/cbmc/pull/429/files#diff-41db988013f70caad45ce489749c7df6R921)
This is because the original pull request was too big and thus was split into several parts.
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.
Thanks a lot for the pointer (I was aware it had been split out, but couldn't find it on the spot)! This certainly suggests that goto-programs is the right place, and that one should rather think about how to make this extensible to other languages? (Which does not imply any request to do so right away, but just bringing up the thought and possibly placing some TODO notes.)
void string_refine_preprocesst::initialize_string_function_table() | ||
{ | ||
string_functions | ||
[irep_idt("java::java.lang.String.codePointAt:(I)I")]= |
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 explicit use of irep_idt
should not be necessary.
{ | ||
string_functions | ||
[irep_idt("java::java.lang.String.codePointAt:(I)I")]= | ||
ID_cprover_string_code_point_at_func; |
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.
With C++11 you should be able to initialize that map using { { id, value}, {id, value} , ... } as a more concise syntax.
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 seems like it works for maps but not unordered maps
|
||
// String builders maps the different names of a same StringBuilder object | ||
// to a unique expression. | ||
std::map<exprt, exprt> string_builders; |
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.
Shouldn't that be a std::unordered_map?
std::map<irep_idt, irep_idt> string_function_calls; | ||
std::map<irep_idt, irep_idt> string_of_char_array_functions; | ||
std::map<irep_idt, irep_idt> string_of_char_array_function_calls; | ||
std::map<irep_idt, irep_idt> side_effect_char_array_functions; |
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.
Likely these should be std::unordered_map as well
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.
agreed
|
||
std::map<irep_idt, std::string> signatures; | ||
std::map<exprt, exprt> hidden_strings; | ||
std::map<exprt, exprt> java_to_cprover_strings; |
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.
As above: std::unordered_map
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.
agreed
3af4fb8
to
d35d9ca
Compare
I squashed the commits, but this now depends on #549 which moves |
const std::string &signature) | ||
{ | ||
if(function_name==ID_cprover_string_copy_func) | ||
make_string_copy(goto_program, i_it, lhs, arguments[0], location); |
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.
are sure there is an argument?
goto_programt::targett &i_it, | ||
const std::list<code_assignt> &va) | ||
{ | ||
auto i=va.begin(); |
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.
are you sure the list is not empty?
\*******************************************************************/ | ||
|
||
symbol_exprt string_refine_preprocesst::new_tmp_symbol( | ||
const std::string &prefix, const typet &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.
It seems some poking and pushing on #523 is required...
auxiliary_symbolt func_symbol; | ||
func_symbol.base_name=function_name; | ||
func_symbol.is_static_lifetime=false; | ||
func_symbol.mode=ID_java; |
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.
If this is Java only, shouldn't all the files go in the java_bytecode folder? Language-specific parts should be as clearly separated from generic ones as possible.
if(i_it->is_function_call()) | ||
{ | ||
code_function_callt &function_call=to_code_function_call(i_it->code); | ||
for(auto arg : function_call.arguments()) |
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.
const auto &arg
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 particular one cannot be made const as we modify it
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.
Oh, I'm sorry, but not knowing the precise rules for auto
just yet: are you sure you end up with a reference and not with a copy? In the latter case you can obviously modify it, but it won't have much of an effect... I'd suggest auto &arg
to be on the safe side.
assert(is_java_string_type(expr.type()) || | ||
is_java_string_builder_type(expr.type())); | ||
typet object_type=ns.follow(expr.type()); | ||
assert(object_type.id()==ID_struct); |
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 assertion is covered by the subsequent to_struct_type
typet object_type=ns.follow(expr.type()); | ||
assert(object_type.id()==ID_struct); | ||
const struct_typet &struct_type=to_struct_type(object_type); | ||
for(auto component : struct_type.components()) |
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.
const auto &component
|
||
exprt string_refine_preprocesst::make_cprover_string_assign( | ||
goto_programt &goto_program, | ||
goto_programt::targett &i_it, |
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.
Would it be possible to find a more descriptive name for this parameter?
i_it->code=*i; | ||
for(i++; i!=va.end(); i++) | ||
{ | ||
i_it=goto_program.insert_after(i_it); |
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.
neither source_location nor function is properly set for these newly inserted instructions
|
||
if(object_size.is_nil()) | ||
debug() << "string_refine_preprocesst::make_string_assign " | ||
<< "got nil object_size" << eom; |
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 it nevertheless ok to continue?
From my point of view #523 is the main blocker here. (Actually, the only one, for me.) |
7aea419
to
f14f165
Compare
src/util/std_expr.h
Outdated
|
||
function_application_exprt( | ||
const symbol_exprt &_function, const typet &_type): | ||
function_application_exprt(_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 add // NOLINT(runtime/explicit)
to this line to silence the linter on this invocation of the constructor from the two-parameter one.
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 ready to go after some minor polishing
{ | ||
if(function_name==ID_cprover_string_copy_func) | ||
{ | ||
assert(arguments.size()>0); |
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.
!.empty()
function_application_exprt rhs; | ||
std::vector<exprt> args; | ||
if(assign_first_arg) | ||
rhs.type()=function_call.arguments()[0].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.
assert !arguments().empty()
|
||
exprt lhs; | ||
if(assign_first_arg) | ||
lhs=function_call.arguments()[0]; |
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.
assert !arguments().empty()
const std::string &signature) | ||
{ | ||
const code_function_callt function_call=to_code_function_call(target->code); | ||
string_builders[function_call.lhs()]=function_call.arguments()[0]; |
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.
assert !arguments().empty()
{ | ||
const code_function_callt &function_call=to_code_function_call(target->code); | ||
|
||
assert(function_call.arguments().size()>=1); |
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.
!.empty()
make_char_array_function( | ||
goto_program, target, function_name, signature, 1, true, false); | ||
code_function_callt &function_call=to_code_function_call(target->code); | ||
string_builders[function_call.lhs()]=function_call.arguments()[0]; |
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.
assert !arguments().empty()
auto it=signatures.find(function_id); | ||
if(it!=signatures.end()) | ||
return it->second; | ||
else return ""; |
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.
return on next line
const typet &subtype=pt.subtype(); | ||
if(subtype.id()==ID_struct) | ||
{ | ||
irep_idt tag=to_struct_type(subtype).get_tag(); |
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 const & here
} | ||
else if(type.id()==ID_struct) | ||
{ | ||
irep_idt tag=to_struct_type(type).get_tag(); |
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 const & here
{ | ||
if(type.id()==ID_symbol) | ||
{ | ||
irep_idt tag=to_symbol_type(type).get_identifier(); |
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 const & here
c404cd1
to
ff69281
Compare
This avoid dependencies between goto-programs and solver. We also removed function is_unrefined_string_type which should not be needed in the string solver. Removed also mention of java string types and unrefined types in the solver. These mentions should not be necessary, since we are not supposed to do anything java specific. The solver should only have to deal with refined string types and possibly char arrays.
This is a more appropriate location for this module since it's used both in the preprocessing of goto-programs and the string solver.
Refined string type should be used instead as we are trying to be language independent.
ff69281
to
5cb0e5e
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.
Looks good to me now.
Why did refined_string_type.h move into util/? |
@kroening the |
I'm closing this PR which is obsolete compared to what is in the test-gen-support branch |
67c80fc Merge pull request diffblue#394 from diffblue/jeannie/LinkedHashMapIterators 6667484 Tests that the iteration order is correct. 38301ea Tests other methods and constructor in LinkedHashMap f795b3d Models other methods in LinkedHashMap. 25773a6 Tests entrySet(), keySet() and values() in LinkedHashMap ee8cfad Models keySet(), entrySet() and values() in LinkedHashMap. 02c8271 Merge pull request diffblue#393 from diffblue/jeannie/UpdateReadMeForSpec 81460d3 Update readme.md to include new style for specs 9efcce3 Merge pull request diffblue#396 from diffblue/antonia/clean-up-for-TG-1081 c902c03 Merge pull request diffblue#397 from diffblue/jeannie/ForgotAppendObjectDocs 772a977 Merge pull request diffblue#390 from diffblue/antonia/enable-fixed-tests 5bef2ff Merge pull request diffblue#398 from diffblue/antonia/ticket-references-bugfix ed1dca2 Merge pull request diffblue#395 from diffblue/allredj/disable-tests-failing-on-tg2717 c07841d Add more tests for String.getBytes(Charset) d568e47 Fix array index bug in String.getBytesUTF_16 2218407 Model String.getBytes(Charset) 9c3a8bc Clarify difference of String.getBytes from JDK cf1c23b Merge the two active scenarios in String.spec dd5d2d9 Remove support_v1 tag from String specs 5f9a7e1 Split String tests into Level 0 and Level 1+ f2877b9 Enable Class test that was blocked by TG-1081 034f3e0 Remove reference to TG-1081 from File model 43afde7 Force static initialiser for File model d95ff9e Remove reference to fixed bug from Date model 0807806 Remove references to fixed bugs from Arrays model cde4085 Remove references to fixed bugs from HashMap model d85fe5b Update RaceTimes references to TG-1404 and TG-1523 0e925e5 Update ticket number in HashMap.spec 03a5186 Enable TG-1404 tests fa051dd Delete ArrayList CustomType test file b0e853b Enable HashMap test previously blocked by TG-1877 44bfe0a Merge pull request diffblue#392 from diffblue/lajw/TG-2389-enable-tests 595dd5d Changes CProver helped methods in HashMap to protected. c52771c Merge pull request diffblue#385 from diffblue/jeannie/UpdateTestRunner de0abdc Enable tests fixed by recent test-gen fixes b64357a Remove ticket numbers from resolved bugfix tests 53eca00 Documents StringBuilder and StringBuffer append(Object) baec23f Merge pull request diffblue#389 from diffblue/antonia/enable-TG-2666-test b2f0258 Enable LinkedList test that was blocked by TG-2666 57e79e5 Add knownbug tests for TG-2717 80fa433 Merge pull request diffblue#387 from diffblue/forejtv/unsupportedcharsetexception 990129c Merge pull request diffblue#391 from diffblue/allredj/disable-html-report 97f32f6 Don't write to the Html report 4cb5996 Merge pull request diffblue#382 from diffblue/antonia/address-ArrayList-todos 6749702 Merge pull request diffblue#386 from diffblue/antonia/gauge-telemetry-off 546dfdc Move legacy style tests into main Gauge step 5be886f Mark UnsupportedCharsetException as untested 1c17838 Add regression test for side effects 8c836ab Add tests for ArrayLists w. (non-default) capacity 34a141d Address bugfix TODOs in ArrayList 563b631 Correct bug description in comment 3e7603d Merge pull request diffblue#383 from diffblue/antonia/reformat-HashSet-tests 5d4e013 [TG-2751] Added UnsupportedCharsetException 11b28fb Reformat HashSet.spec f77c3c4 Rename HashSet_L2.spec to HashSet_L0.spec a16a1e7 Move all HashSet Maven tests into HashSet.spec f21a2da Merge pull request diffblue#376 from diffblue/jeannie/LinkedHashMap 820c5f7 Merge pull request diffblue#380 from diffblue/jeannie/AppendObject af65f4d Tests java.lang.StringBuffer append(Object) a554517 Reformat tests in java.util.StringBuilder dd6d3f6 Models append(Object) for StringBuilder and StringBuffer. 8920399 Tests toString() methods on existing models where possible 647f4fe Tests toString() methods on existing models where possible 978273b Documents and implements toString() methods in existing models. 78020ee Documents java.util.LinkedHashMap fb0cf92 Tests java.util.LinkedHashMap 7a9df4e Models java.util.LinkedHashMap 5a8af60 Marks all methods as notModelled() for java.util.LinkedHashMap 8d6b149 Initial commit for java.util.LinkedHashMap 34b7c54 Merge pull request diffblue#359 from diffblue/forejtv/throwable-no-static e2230de Cleanup of unused (mostly static) variables 255013e Merge pull request diffblue#384 from diffblue/jeannie/DisableBoundedGenericHashMap f374d5f Merge pull request diffblue#381 from diffblue/justin/TG2600-Correction ce6328b Turn off Gauge telemetry on Travis 6ab2864 Updates TestRunner.java to mimic platform parameters. 8ee75a4 Disables a HashMap test that depends on bounded generic type. 3677c3a [TG-2600] correct a mistake in the L1RemoveLast test 4511813 Merge pull request diffblue#378 from diffblue/antonia/LinkedList-first-model 6bda7ea Add tests for LinkedList b5d4cbe Model LinkedList methods specified in TG-2600 aa6e90a Empty models for new classes 3c25555 Copy LinkedList and related classes from jdk 5e4d410 Merge pull request diffblue#373 from diffblue/romain/tests/activate-arrays-hashset-test#TG-1404 a0d9289 Activate some Arrays test 27d06b4 Activate tests for Hashset fixed by TG-1404 224962a Merge pull request diffblue#371 from diffblue/romain/tests/activate-after-fix-1404 ed26b28 Activate level 2 tests fixed by TG-1404 b59c1e9 Relabel known-bug for Level2 HashMap test 5c0041b Activate tests for HashMap.values fixed by TG-1404 2777872 Activate tests for HashMap.entrySet 50d3f2c Activate tests for HashMap.keySet fixed by TG-1404 6146215 Activate ArrayList test fixed by TG-1404 bc09fd7 Merge pull request diffblue#365 from diffblue/jeannie/getTimeZone 29cf7e0 Merge pull request diffblue#372 from diffblue/forejtv/bump-up-gauge-v bdd500a Change Gauge Java Maven Plugin to 0.6.6 190aa18 Tests java.util.TimeZone 170a992 Documents java.util.TimeZone in javadocs 9e52664 Models java.util.TimeZone constructor, getID, setID and getTimeZone. eac578e Tests sun.util.calendar.ZoneInfo b4be728 Documents sun.util.calendar.ZoneInfo in javadocs e5ffa98 Models the sun.util.calendar.ZoneInfo constructor and getTimeZone() 6d704ad Marks methods as notModelled() for sun.util.calendar.ZoneInfo d249adb Marks methods as notModelled() for java.util.TimeZone 7f71d8d Initial commit for sun.util.calendar.ZoneInfo. b53d9c1 Initial commit for java.util.TimeZone 056aad2 Merge pull request diffblue#368 from diffblue/allredj/fix-hashtable-spec 8848414 Merge pull request diffblue#370 from diffblue/allredj/stringbuffer-spec-small-correction 1d947e5 Small correction to StringBuffer spec file 42f1a93 Fix typo in hashtable spec file git-subtree-dir: benchmarks/LIBRARIES/models git-subtree-split: 67c80fcdcf82418b5e7099ae63dec3360b153f90
…resco-readme Update readme for installing Alfresco
Preprocessing of goto-programs for the string refinement.
This pull request includes the changes from
#374#549(merged) which should be merged before.