Skip to content

Wrap local vars in std::move (Clang 7 build fix) #3239

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions jbmc/src/java_bytecode/character_refine_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ exprt character_refine_preprocesst::expr_of_high_surrogate(
exprt u400=from_integer(0x0400, type);

plus_exprt high_surrogate(uD800, div_exprt(minus_exprt(chr, u10000), u400));
return high_surrogate;
return std::move(high_surrogate);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down Expand Up @@ -496,7 +496,7 @@ exprt character_refine_preprocesst::expr_of_is_digit(
or_exprt digit(
or_exprt(latin_digit, or_exprt(arabic_indic_digit, extended_digit)),
or_exprt(devanagari_digit, fullwidth_digit));
return digit;
return std::move(digit);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down Expand Up @@ -555,7 +555,7 @@ exprt character_refine_preprocesst::expr_of_is_identifier_ignorable(
or_exprt(
in_interval_expr(chr, 0x000E, 0x001B),
in_interval_expr(chr, 0x007F, 0x009F)));
return ignorable;
return std::move(ignorable);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down Expand Up @@ -1235,7 +1235,7 @@ exprt character_refine_preprocesst::expr_of_to_lower_case(
plus_exprt(chr, from_integer('a', type)), from_integer('A', type));

if_exprt res(expr_of_is_ascii_upper_case(chr, type), transformed, chr);
return res;
return std::move(res);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down Expand Up @@ -1291,7 +1291,7 @@ exprt character_refine_preprocesst::expr_of_to_title_case(
plus_9,
chr))));

return res;
return std::move(res);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down Expand Up @@ -1328,7 +1328,7 @@ exprt character_refine_preprocesst::expr_of_to_upper_case(
plus_exprt(chr, from_integer('A', type)), from_integer('a', type));

if_exprt res(expr_of_is_ascii_lower_case(chr, type), transformed, chr);
return res;
return std::move(res);
}

/// Converts function call to an assignment of an expression corresponding to
Expand Down
26 changes: 13 additions & 13 deletions jbmc/src/java_bytecode/java_bytecode_convert_method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ const exprt java_bytecode_convert_methodt::variable(
symbol_exprt result(identifier, t);
result.set(ID_C_base_name, base_name);
used_local_names.insert(result);
return result;
return std::move(result);
}
else
{
Expand Down Expand Up @@ -1913,7 +1913,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
for(auto &block : root_block.statements())
code.add(block);

return code;
return std::move(code);
}

codet java_bytecode_convert_methodt::convert_pop(
Expand Down Expand Up @@ -1983,7 +1983,7 @@ codet java_bytecode_convert_methodt::convert_switch(
}

code_switch.body() = code_block;
return code_switch;
return std::move(code_switch);
}

codet java_bytecode_convert_methodt::convert_monitorenterexit(
Expand All @@ -2006,7 +2006,7 @@ codet java_bytecode_convert_methodt::convert_monitorenterexit(
call.add_source_location() = source_location;
if(needed_lazy_methods && symbol_table.has_symbol(descriptor))
needed_lazy_methods->add_needed_method(descriptor);
return call;
return std::move(call);
}

void java_bytecode_convert_methodt::convert_dup2(
Expand Down Expand Up @@ -2566,7 +2566,7 @@ codet java_bytecode_convert_methodt::convert_putstatic(
bytecode_write_typet::STATIC_FIELD,
symbol_expr.get_identifier());
block.add(code_assignt(symbol_expr, op[0]));
return block;
return std::move(block);
}

codet java_bytecode_convert_methodt::convert_putfield(
Expand All @@ -2581,7 +2581,7 @@ codet java_bytecode_convert_methodt::convert_putfield(
bytecode_write_typet::FIELD,
arg0.get(ID_component_name));
block.add(code_assignt(to_member(op[0], arg0), op[1]));
return block;
return std::move(block);
}

void java_bytecode_convert_methodt::convert_getstatic(
Expand Down Expand Up @@ -2722,7 +2722,7 @@ codet java_bytecode_convert_methodt::convert_iinc(
plus_exprt(variable(arg0, 'i', address, CAST_AS_NEEDED), arg1_int_type));
block.add(code_assign);

return block;
return std::move(block);
}

codet java_bytecode_convert_methodt::convert_ifnull(
Expand All @@ -2740,7 +2740,7 @@ codet java_bytecode_convert_methodt::convert_ifnull(
code_branch.then_case().add_source_location() =
address_map.at(label_number).source->source_location;
code_branch.add_source_location() = location;
return code_branch;
return std::move(code_branch);
}

codet java_bytecode_convert_methodt::convert_ifnonull(
Expand All @@ -2758,7 +2758,7 @@ codet java_bytecode_convert_methodt::convert_ifnonull(
code_branch.then_case().add_source_location() =
address_map.at(label_number).source->source_location;
code_branch.add_source_location() = location;
return code_branch;
return std::move(code_branch);
}

codet java_bytecode_convert_methodt::convert_if(
Expand All @@ -2780,7 +2780,7 @@ codet java_bytecode_convert_methodt::convert_if(
code_branch.then_case().add_source_location().set_function(method_id);
code_branch.add_source_location() = location;
code_branch.add_source_location().set_function(method_id);
return code_branch;
return std::move(code_branch);
}

codet java_bytecode_convert_methodt::convert_if_cmp(
Expand Down Expand Up @@ -2809,7 +2809,7 @@ codet java_bytecode_convert_methodt::convert_if_cmp(
address_map.at(label_number).source->source_location;
code_branch.add_source_location() = location;

return code_branch;
return std::move(code_branch);
}

code_blockt java_bytecode_convert_methodt::convert_ret(
Expand Down Expand Up @@ -2889,7 +2889,7 @@ codet java_bytecode_convert_methodt::convert_store(
code_assignt assign(var, toassign);
assign.add_source_location() = location;
block.add(assign);
return block;
return std::move(block);
}

codet java_bytecode_convert_methodt::convert_astore(
Expand Down Expand Up @@ -2921,7 +2921,7 @@ codet java_bytecode_convert_methodt::convert_astore(
code_assignt array_put(element, op[2]);
array_put.add_source_location() = location;
block.add(array_put);
return block;
return std::move(block);
}

optionalt<exprt> java_bytecode_convert_methodt::convert_invoke_dynamic(
Expand Down
8 changes: 4 additions & 4 deletions jbmc/src/java_bytecode/java_bytecode_instrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ codet java_bytecode_instrumentt::throw_exception(
if_code.cond()=cond;
if_code.then_case() = code_blockt({assign_new, code_expressiont(throw_expr)});

return if_code;
return std::move(if_code);
}


Expand Down Expand Up @@ -205,7 +205,7 @@ codet java_bytecode_instrumentt::check_array_access(
bounds_checks.add(create_fatal_assertion(ge_zero, low_check_loc));
bounds_checks.add(create_fatal_assertion(lt_length, high_check_loc));

return bounds_checks;
return std::move(bounds_checks);
}

/// Checks whether `class1` is an instance of `class2` and throws
Expand Down Expand Up @@ -255,7 +255,7 @@ codet java_bytecode_instrumentt::check_class_cast(
notequal_exprt op_not_null(null_check_op, null_pointer_exprt(voidptr));
conditional_check.cond()=std::move(op_not_null);
conditional_check.then_case()=std::move(check_code);
return conditional_check;
return std::move(conditional_check);
}

/// Checks whether `expr` is null and throws NullPointerException/
Expand Down Expand Up @@ -540,7 +540,7 @@ optionalt<codet> java_bytecode_instrumentt::instrument_expr(const exprt &expr)
if(result==code_blockt())
return {};
else
return result;
return std::move(result);
}

/// Instruments `expr`
Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_bytecode_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ exprt java_bytecode_parsert::get_relement_value()
{
values.operands().push_back(get_relement_value());
}
return values;
return std::move(values);
}

case 's':
Expand Down
6 changes: 3 additions & 3 deletions jbmc/src/java_bytecode/java_static_initializers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ codet get_thread_safe_clinit_wrapper_body(
function_body.add(code_returnt());
}

return function_body;
return std::move(function_body);
}

/// Produces the static initializer wrapper body for the given function.
Expand Down Expand Up @@ -702,7 +702,7 @@ codet get_clinit_wrapper_body(

wrapper_body.then_case() = init_body;

return wrapper_body;
return std::move(wrapper_body);
}


Expand Down Expand Up @@ -891,5 +891,5 @@ codet stub_global_initializer_factoryt::get_stub_initializer_body(
update_in_placet::NO_UPDATE_IN_PLACE);
}

return static_init_body;
return std::move(static_init_body);
}
24 changes: 12 additions & 12 deletions jbmc/src/java_bytecode/java_string_library_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ codet java_string_library_preprocesst::make_float_to_string_code(

// Return str
code.add(code_returnt(str), loc);
return code;
return std::move(code);
}

/// Generate the goto code for string initialization.
Expand Down Expand Up @@ -1088,7 +1088,7 @@ codet java_string_library_preprocesst::make_init_function_from_call(
code_assign_string_expr_to_java_string(arg_this, string_expr, symbol_table),
loc);

return code;
return std::move(code);
}

/// Call a cprover internal function, assign the result to object `this` and
Expand All @@ -1114,7 +1114,7 @@ codet java_string_library_preprocesst::
loc);
const symbol_exprt arg_this(params[0].get_identifier(), params[0].type());
code.add(code_returnt(arg_this), loc);
return code;
return std::move(code);
}

/// Call a cprover internal function and assign the result to object `this`.
Expand Down Expand Up @@ -1266,7 +1266,7 @@ exprt java_string_library_preprocesst::get_object_at_index(
data_member, from_integer(index, java_int_type()), data_member.type());
dereference_exprt data_at_index(
data_pointer_plus_index, data_pointer_plus_index.type().subtype());
return data_at_index;
return std::move(data_at_index);
}

/// Helper for format function. Adds code:
Expand Down Expand Up @@ -1393,7 +1393,7 @@ exprt java_string_library_preprocesst::make_argument_for_format(
}

code.add(code_not_null, loc);
return arg_i_struct;
return std::move(arg_i_struct);
}

/// Used to provide code for the Java String.format function.
Expand Down Expand Up @@ -1451,7 +1451,7 @@ codet java_string_library_preprocesst::make_string_format_code(
java_string, string_expr, symbol_table),
loc);
code.add(code_returnt(java_string), loc);
return code;
return std::move(code);
}

/// Used to provide our own implementation of the java.lang.Object.getClass()
Expand Down Expand Up @@ -1532,7 +1532,7 @@ codet java_string_library_preprocesst::make_object_get_class_code(

// > return class1;
code.add(code_returnt(class1), loc);
return code;
return std::move(code);
}

/// Provide code for a function that calls a function from the solver and simply
Expand All @@ -1558,7 +1558,7 @@ codet java_string_library_preprocesst::make_function_from_call(
code_return_function_application(
function_name, args, type.return_type(), symbol_table),
loc);
return code;
return std::move(code);
}

/// Provide code for a function that calls a function from the solver and return
Expand Down Expand Up @@ -1600,7 +1600,7 @@ codet java_string_library_preprocesst::make_string_returning_function_from_call(

// Return value
code.add(code_returnt(str), loc);
return code;
return std::move(code);
}

/// Generates code for a function which copies a string object to a new string
Expand Down Expand Up @@ -1643,7 +1643,7 @@ codet java_string_library_preprocesst::make_copy_string_code(

// Return value
code.add(code_returnt(str), loc);
return code;
return std::move(code);
}

/// Generates code for a constructor of a string object from another string
Expand Down Expand Up @@ -1684,7 +1684,7 @@ codet java_string_library_preprocesst::make_copy_constructor_code(
code_assign_string_expr_to_java_string(arg_this, string_expr, symbol_table),
loc);

return code;
return std::move(code);
}

/// Generates code for the String.length method
Expand Down Expand Up @@ -1714,7 +1714,7 @@ codet java_string_library_preprocesst::make_string_length_code(
code_returnt ret(get_length(deref, symbol_table));
ret.add_source_location() = loc;

return ret;
return std::move(ret);
}

bool java_string_library_preprocesst::implements_function(
Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/java_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ build_class_name(const std::string &src, const std::string &class_name_prefix)
// Look for the next generic type info (if it exists)
f_pos = src.find('<', e_pos + 1);
} while(f_pos != std::string::npos);
return result;
return std::move(result);
}

return java_reference_type(symbol_type);
Expand Down
4 changes: 2 additions & 2 deletions src/analyses/ai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jsont ai_baset::output_json(
}
}

return result;
return std::move(result);
}

/// Output the domains for a single function as JSON
Expand Down Expand Up @@ -113,7 +113,7 @@ jsont ai_baset::output_json(
contents.push_back(location);
}

return contents;
return std::move(contents);
}

/// Output the domains for the whole program as XML
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/ai_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jsont ai_domain_baset::output_json(const ai_baset &ai, const namespacet &ns)
std::ostringstream out;
output(out, ai, ns);
json_stringt json(out.str());
return json;
return std::move(json);
}

xmlt ai_domain_baset::output_xml(const ai_baset &ai, const namespacet &ns) const
Expand Down
2 changes: 1 addition & 1 deletion src/analyses/dependence_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ jsont dep_graph_domaint::output_json(
link["type"]=json_stringt("data");
}

return graph;
return std::move(graph);
}

void dependence_grapht::add_dep(
Expand Down
Loading