diff --git a/.github/workflows/syntax-checks.yaml b/.github/workflows/syntax-checks.yaml index 27badf441d3..f350cbb0992 100644 --- a/.github/workflows/syntax-checks.yaml +++ b/.github/workflows/syntax-checks.yaml @@ -59,3 +59,23 @@ jobs: rustup toolchain install stable --profile minimal --no-self-update -c clippy -c rustfmt - name: Run `cargo fmt` on top of Rust API project run: cd src/libcprover-rust; cargo fmt --all -- --check + + # This job takes approximately 3 minutes + check-pass-by-value: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - name: Fetch dependencies + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -yq \ + cmake g++ flex bison clang-18 llvm-18-dev libclang-18-dev \ + libclang-cpp18-dev + - name: Configure + run: cmake -S . -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + - name: Check for pass-by-const-reference of cheap-to-copy types + run: ./scripts/run_pass_by_value_check.sh build diff --git a/.gitignore b/.gitignore index c7511712684..7f6cf7d0197 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,4 @@ dist/ # auto generated documentation doc/html/ +/scripts/check-pass-by-value diff --git a/jbmc/src/janalyzer/janalyzer_parse_options.cpp b/jbmc/src/janalyzer/janalyzer_parse_options.cpp index 79b712d55d1..a0f7881e07d 100644 --- a/jbmc/src/janalyzer/janalyzer_parse_options.cpp +++ b/jbmc/src/janalyzer/janalyzer_parse_options.cpp @@ -688,7 +688,8 @@ void janalyzer_parse_optionst::process_goto_function( // Java virtual functions -> explicit dispatch tables: remove_virtual_functions(function, *class_hierarchy); - auto function_is_stub = [&symbol_table, &model](const irep_idt &id) { + auto function_is_stub = [&symbol_table, &model](irep_idt id) + { return symbol_table.lookup_ref(id).value.is_nil() && !model.can_produce_function(id); }; @@ -698,7 +699,7 @@ void janalyzer_parse_optionst::process_goto_function( transform_assertions_assumptions(options, function.get_goto_function().body); } -bool janalyzer_parse_optionst::can_generate_function_body(const irep_idt &name) +bool janalyzer_parse_optionst::can_generate_function_body(irep_idt name) { static const irep_idt initialize_id = INITIALIZE_FUNCTION; @@ -706,7 +707,7 @@ bool janalyzer_parse_optionst::can_generate_function_body(const irep_idt &name) } bool janalyzer_parse_optionst::generate_function_body( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, goto_functiont &function, bool body_available) diff --git a/jbmc/src/janalyzer/janalyzer_parse_options.h b/jbmc/src/janalyzer/janalyzer_parse_options.h index b55e99db4c5..e3defce36d9 100644 --- a/jbmc/src/janalyzer/janalyzer_parse_options.h +++ b/jbmc/src/janalyzer/janalyzer_parse_options.h @@ -164,10 +164,10 @@ class janalyzer_parse_optionst : public parse_options_baset const abstract_goto_modelt &model, const optionst &options); - bool can_generate_function_body(const irep_idt &name); + bool can_generate_function_body(irep_idt name); bool generate_function_body( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, goto_functiont &function, bool body_available); diff --git a/jbmc/src/java_bytecode/README.md b/jbmc/src/java_bytecode/README.md index f7593c2a23e..04ec4b8eaee 100644 --- a/jbmc/src/java_bytecode/README.md +++ b/jbmc/src/java_bytecode/README.md @@ -674,10 +674,10 @@ determine which loading strategy to use. If [lazy_methods_mode](\ref java_bytecode_language_optionst::lazy_methods_mode) is \ref LAZY_METHODS_MODE_EAGER then eager loading is used. Under eager loading -\ref java_bytecode_languaget::convert_single_method(const irep_idt &, symbol_table_baset &, lazy_class_to_declared_symbols_mapt &, message_handlert &) +\ref java_bytecode_languaget::convert_single_method(irep_idt, symbol_table_baset &, lazy_class_to_declared_symbols_mapt &, message_handlert &) is called once for each method listed in method_bytecode (described above). This then calls -\ref java_bytecode_languaget::convert_single_method(const irep_idt &, symbol_table_baset &, std::optional, lazy_class_to_declared_symbols_mapt &, message_handlert &); +\ref java_bytecode_languaget::convert_single_method(irep_idt, symbol_table_baset &, std::optional, lazy_class_to_declared_symbols_mapt &, message_handlert &); without a ci_lazy_methods_neededt object, which calls \ref java_bytecode_convert_method, passing in the method parse tree. This in diff --git a/jbmc/src/java_bytecode/assignments_from_json.cpp b/jbmc/src/java_bytecode/assignments_from_json.cpp index dee711f00e6..f5b76e5e604 100644 --- a/jbmc/src/java_bytecode/assignments_from_json.cpp +++ b/jbmc/src/java_bytecode/assignments_from_json.cpp @@ -914,7 +914,7 @@ code_with_references_listt assign_from_json_rec( code_with_references_listt assign_from_json( const exprt &expr, const jsont &json, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional &needed_lazy_methods, size_t max_user_array_length, diff --git a/jbmc/src/java_bytecode/assignments_from_json.h b/jbmc/src/java_bytecode/assignments_from_json.h index 328fbb5c9b4..155b20d88b0 100644 --- a/jbmc/src/java_bytecode/assignments_from_json.h +++ b/jbmc/src/java_bytecode/assignments_from_json.h @@ -98,7 +98,7 @@ class ci_lazy_methods_neededt; code_with_references_listt assign_from_json( const exprt &expr, const jsont &json, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional &needed_lazy_methods, size_t max_user_array_length, diff --git a/jbmc/src/java_bytecode/ci_lazy_methods.cpp b/jbmc/src/java_bytecode/ci_lazy_methods.cpp index c565b16cda3..1977f3b1317 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods.cpp +++ b/jbmc/src/java_bytecode/ci_lazy_methods.cpp @@ -38,7 +38,7 @@ Author: Diffblue Ltd. /// Java bytecode. ci_lazy_methodst::ci_lazy_methodst( const symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, const std::vector &main_jar_classes, const std::vector &lazy_methods_extra_entry_points, java_class_loadert &java_class_loader, @@ -331,7 +331,7 @@ ci_lazy_methodst::convert_and_analyze_method( const method_convertert &method_converter, std::unordered_set &methods_already_populated, const bool class_initializer_already_seen, - const irep_idt &method_name, + irep_idt method_name, symbol_table_baset &symbol_table, std::unordered_set &methods_to_convert_later, std::unordered_set &instantiated_classes, @@ -557,8 +557,8 @@ void ci_lazy_methodst::gather_needed_globals( /// `instantiated_classes`, or irep_idt() otherwise. irep_idt ci_lazy_methodst::get_virtual_method_target( const std::unordered_set &instantiated_classes, - const irep_idt &call_basename, - const irep_idt &classname, + irep_idt call_basename, + irep_idt classname, const symbol_table_baset &symbol_table) { // Program-wide, is this class ever instantiated? diff --git a/jbmc/src/java_bytecode/ci_lazy_methods.h b/jbmc/src/java_bytecode/ci_lazy_methods.h index f37e153589e..89bab35433c 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods.h +++ b/jbmc/src/java_bytecode/ci_lazy_methods.h @@ -50,7 +50,7 @@ class method_bytecodet mapt map; public: - bool contains_method(const irep_idt &method_id) const + bool contains_method(irep_idt method_id) const { return map.count(method_id) != 0; } @@ -63,8 +63,8 @@ class method_bytecodet } void add( - const irep_idt &class_id, - const irep_idt &method_id, + irep_idt class_id, + irep_idt method_id, const java_bytecode_parse_treet::methodt &method) { add(class_method_and_bytecodet{class_id, method_id, method}); @@ -79,7 +79,7 @@ class method_bytecodet return map.end(); } - opt_reft get(const irep_idt &method_id) + opt_reft get(irep_idt method_id) { const auto it = map.find(method_id); if(it == map.end()) @@ -88,8 +88,7 @@ class method_bytecodet } }; -typedef std::function< - bool(const irep_idt &function_id, ci_lazy_methods_neededt)> +typedef std::function method_convertert; typedef std::function(const symbol_table_baset &)> @@ -100,7 +99,7 @@ class ci_lazy_methodst public: ci_lazy_methodst( const symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, const std::vector &main_jar_classes, const std::vector &lazy_methods_extra_entry_points, java_class_loadert &java_class_loader, @@ -138,13 +137,13 @@ class ci_lazy_methodst irep_idt get_virtual_method_target( const std::unordered_set &instantiated_classes, - const irep_idt &call_basename, - const irep_idt &classname, + irep_idt call_basename, + irep_idt classname, const symbol_table_baset &symbol_table); static irep_idt build_virtual_method_name( - const irep_idt &class_name, - const irep_idt &component_method_name); + irep_idt class_name, + irep_idt component_method_name); class_hierarchyt class_hierarchy; irep_idt main_class; @@ -169,7 +168,7 @@ class ci_lazy_methodst const method_convertert &method_converter, std::unordered_set &methods_already_populated, const bool class_initializer_already_seen, - const irep_idt &method_name, + irep_idt method_name, symbol_table_baset &symbol_table, std::unordered_set &methods_to_convert_later, std::unordered_set &instantiated_classes, diff --git a/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp b/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp index 11d5c7dac59..817326a9bed 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp +++ b/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp @@ -25,8 +25,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com /// Notes `method_symbol_name` is referenced from some reachable function, and /// should therefore be elaborated. /// \param method_symbol_name: method name; must exist in symbol table. -void ci_lazy_methods_neededt::add_needed_method( - const irep_idt &method_symbol_name) +void ci_lazy_methods_neededt::add_needed_method(irep_idt method_symbol_name) { callable_methods.insert(method_symbol_name); } @@ -39,7 +38,7 @@ void ci_lazy_methods_neededt::add_needed_method( /// __CPROVER_start in its initial setup, and because return values of opaque /// methods need to be considered in ci_lazy_methods too. /// \param class_id: The given class id -void ci_lazy_methods_neededt::add_clinit_call(const irep_idt &class_id) +void ci_lazy_methods_neededt::add_clinit_call(irep_idt class_id) { const irep_idt &clinit_wrapper = clinit_wrapper_name(class_id); if(symbol_table.symbols.count(clinit_wrapper)) @@ -50,7 +49,7 @@ void ci_lazy_methods_neededt::add_clinit_call(const irep_idt &class_id) /// ancestors then note that it is needed. /// \param class_id: The given class id void ci_lazy_methods_neededt::add_cprover_nondet_initialize_if_it_exists( - const irep_idt &class_id) + irep_idt class_id) { resolve_inherited_componentt resolve_inherited_component{symbol_table}; std::optional @@ -69,8 +68,7 @@ void ci_lazy_methods_neededt::add_cprover_nondet_initialize_if_it_exists( /// therefore reachable. /// \param class_symbol_name: class name; must exist in symbol table. /// \return Returns true if `class_symbol_name` is new (not seen before). -bool ci_lazy_methods_neededt::add_needed_class( - const irep_idt &class_symbol_name) +bool ci_lazy_methods_neededt::add_needed_class(irep_idt class_symbol_name) { if(!instantiated_classes.insert(class_symbol_name).second) return false; diff --git a/jbmc/src/java_bytecode/ci_lazy_methods_needed.h b/jbmc/src/java_bytecode/ci_lazy_methods_needed.h index 305b248a508..ed8e726489f 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods_needed.h +++ b/jbmc/src/java_bytecode/ci_lazy_methods_needed.h @@ -36,9 +36,9 @@ class ci_lazy_methods_neededt pointer_type_selector(pointer_type_selector) {} - void add_needed_method(const irep_idt &); + void add_needed_method(irep_idt); // Returns true if new - bool add_needed_class(const irep_idt &); + bool add_needed_class(irep_idt); void add_all_needed_classes(const pointer_typet &pointer_type); @@ -57,8 +57,8 @@ class ci_lazy_methods_neededt const select_pointer_typet &pointer_type_selector; - void add_clinit_call(const irep_idt &class_id); - void add_cprover_nondet_initialize_if_it_exists(const irep_idt &class_id); + void add_clinit_call(irep_idt class_id); + void add_cprover_nondet_initialize_if_it_exists(irep_idt class_id); void initialize_instantiated_classes_from_pointer( const pointer_typet &pointer_type, diff --git a/jbmc/src/java_bytecode/convert_java_nondet.cpp b/jbmc/src/java_bytecode/convert_java_nondet.cpp index 8df3b972964..89e08c4ca81 100644 --- a/jbmc/src/java_bytecode/convert_java_nondet.cpp +++ b/jbmc/src/java_bytecode/convert_java_nondet.cpp @@ -44,7 +44,7 @@ static goto_programt get_gen_nondet_init_instructions( symbol_table_baset &symbol_table, message_handlert &message_handler, const java_object_factory_parameterst &object_factory_parameters, - const irep_idt &mode) + irep_idt mode) { code_blockt gen_nondet_init_code; const bool skip_classid = true; @@ -79,13 +79,13 @@ static goto_programt get_gen_nondet_init_instructions( /// \return The next instruction to process with this function and a boolean /// indicating whether any changes were made to the goto program. static std::pair insert_nondet_init_code( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &target, symbol_table_baset &symbol_table, message_handlert &message_handler, java_object_factory_parameterst object_factory_parameters, - const irep_idt &mode) + irep_idt mode) { const auto next_instr = std::next(target); @@ -164,12 +164,12 @@ static std::pair insert_nondet_init_code( /// nondet objects. /// \param mode: Language mode void convert_nondet( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, symbol_table_baset &symbol_table, message_handlert &message_handler, const java_object_factory_parameterst &user_object_factory_parameters, - const irep_idt &mode) + irep_idt mode) { java_object_factory_parameterst object_factory_parameters = user_object_factory_parameters; @@ -202,7 +202,7 @@ void convert_nondet( goto_model_functiont &function, message_handlert &message_handler, const java_object_factory_parameterst &object_factory_parameters, - const irep_idt &mode) + irep_idt mode) { convert_nondet( function.get_function_id(), diff --git a/jbmc/src/java_bytecode/convert_java_nondet.h b/jbmc/src/java_bytecode/convert_java_nondet.h index 0dd9b971b84..2452ea6c088 100644 --- a/jbmc/src/java_bytecode/convert_java_nondet.h +++ b/jbmc/src/java_bytecode/convert_java_nondet.h @@ -64,6 +64,6 @@ void convert_nondet( goto_model_functiont &function, message_handlert &message_handler, const java_object_factory_parameterst &object_factory_parameters, - const irep_idt &mode); + irep_idt mode); #endif // CPROVER_JAVA_BYTECODE_CONVERT_NONDET_H diff --git a/jbmc/src/java_bytecode/create_array_with_type_intrinsic.cpp b/jbmc/src/java_bytecode/create_array_with_type_intrinsic.cpp index 4477488b6c1..3ac349de9a5 100644 --- a/jbmc/src/java_bytecode/create_array_with_type_intrinsic.cpp +++ b/jbmc/src/java_bytecode/create_array_with_type_intrinsic.cpp @@ -39,7 +39,7 @@ irep_idt get_create_array_with_type_name() /// \param message_handler: any GOTO program conversion errors are logged here /// \return new GOTO program body for `org.cprover.CProver.createArrayWithType`. codet create_array_with_type_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { diff --git a/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h b/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h index 9712da07b92..5a9202c407d 100644 --- a/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h +++ b/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h @@ -20,7 +20,7 @@ class symbol_table_baset; irep_idt get_create_array_with_type_name(); codet create_array_with_type_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); diff --git a/jbmc/src/java_bytecode/generic_parameter_specialization_map.cpp b/jbmc/src/java_bytecode/generic_parameter_specialization_map.cpp index 5444a6f11f7..e0be2d23f2b 100644 --- a/jbmc/src/java_bytecode/generic_parameter_specialization_map.cpp +++ b/jbmc/src/java_bytecode/generic_parameter_specialization_map.cpp @@ -52,7 +52,7 @@ void generic_parameter_specialization_mapt::pop(std::size_t container_index) } std::optional -generic_parameter_specialization_mapt::pop(const irep_idt ¶meter_name) +generic_parameter_specialization_mapt::pop(irep_idt parameter_name) { const auto types_it = param_to_container.find(parameter_name); if(types_it == param_to_container.end()) diff --git a/jbmc/src/java_bytecode/generic_parameter_specialization_map.h b/jbmc/src/java_bytecode/generic_parameter_specialization_map.h index 2a954e11e66..d93d025ad88 100644 --- a/jbmc/src/java_bytecode/generic_parameter_specialization_map.h +++ b/jbmc/src/java_bytecode/generic_parameter_specialization_map.h @@ -54,7 +54,7 @@ class generic_parameter_specialization_mapt /// \param parameter_name: The name of the type parameter /// \returns: The specialization for the given type parameter, if there was /// one before the pop, or an empty std::optional if the stack was empty - std::optional pop(const irep_idt ¶meter_name); + std::optional pop(irep_idt parameter_name); /// A wrapper for a generic_parameter_specialization_mapt and a namespacet /// that can be output to a stream diff --git a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp index 0ae89521cdf..a57f6d65ef6 100644 --- a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp @@ -35,8 +35,8 @@ const std::string thread_id = CPROVER_PREFIX "_thread_id";// NOLINT(*) /// /return returns new or existing symbol. static symbolt add_or_get_symbol( symbol_table_baset &symbol_table, - const irep_idt &name, - const irep_idt &base_name, + irep_idt name, + irep_idt base_name, const typet &type, const exprt &value, const bool is_thread_local, diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp b/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp index f600348b943..f06cf432d14 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp @@ -158,8 +158,7 @@ class java_bytecode_convert_classt /// \param class_name: class the method is declared on /// \param method: a `methodt` object from a java bytecode parse tree /// \return true if the method is an ignored method, else false - static bool is_ignored_method( - const irep_idt &class_name, const methodt &method) + static bool is_ignored_method(irep_idt class_name, const methodt &method) { static irep_idt org_cprover_CProver_name = "org.cprover.CProver"; return @@ -170,7 +169,7 @@ class java_bytecode_convert_classt bool check_field_exists( const fieldt &field, - const irep_idt &qualified_fieldname, + irep_idt qualified_fieldname, const struct_union_typet::componentst &fields) const; std::unordered_set no_load_classes; @@ -620,7 +619,7 @@ void java_bytecode_convert_classt::convert( bool java_bytecode_convert_classt::check_field_exists( const java_bytecode_parse_treet::fieldt &field, - const irep_idt &qualified_fieldname, + irep_idt qualified_fieldname, const struct_union_typet::componentst &fields) const { if(field.is_static) @@ -1178,7 +1177,7 @@ void convert_java_annotations( /// the inner class are updated to point to the type parameters of the /// corresponding outer classes. void mark_java_implicitly_generic_class_type( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table) { const std::string qualified_class_name = "java::" + id2string(class_name); diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_class.h b/jbmc/src/java_bytecode/java_bytecode_convert_class.h index 432dc8a7760..b29f8190e42 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_class.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_class.h @@ -40,7 +40,7 @@ void convert_java_annotations( java_bytecode_parse_treet::annotationst &annotations); void mark_java_implicitly_generic_class_type( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table); /// Register in the \p symbol_table new symbols for the objects diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp b/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp index a6e650389dc..35ea30c850d 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp @@ -61,7 +61,7 @@ Author: Daniel Kroening, kroening@kroening.com /// Global symbol table. static void assign_parameter_names( java_method_typet &ftype, - const irep_idt &name_prefix, + irep_idt name_prefix, symbol_table_baset &symbol_table) { java_method_typet::parameterst ¶meters = ftype.parameters(); @@ -92,11 +92,11 @@ static void assign_parameter_names( } void create_method_stub_symbol( - const irep_idt &identifier, - const irep_idt &base_name, - const irep_idt &pretty_name, + irep_idt identifier, + irep_idt base_name, + irep_idt pretty_name, const typet &type, - const irep_idt &declaring_class, + irep_idt declaring_class, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -116,7 +116,7 @@ void create_method_stub_symbol( symbol_table.add(symbol); } -static bool is_constructor(const irep_idt &method_name) +static bool is_constructor(irep_idt method_name) { return id2string(method_name).find("") != std::string::npos; } @@ -155,7 +155,7 @@ void java_bytecode_convert_methodt::push(const exprt::operandst &o) } // JVM program locations -irep_idt java_bytecode_convert_methodt::label(const irep_idt &address) +irep_idt java_bytecode_convert_methodt::label(irep_idt address) { return "pc"+id2string(address); } @@ -298,7 +298,7 @@ java_method_typet member_type_lazy( /// \param message_handler: A message handler to collect warnings. void java_bytecode_convert_method_lazy( symbolt &class_symbol, - const irep_idt &method_identifier, + irep_idt method_identifier, const java_bytecode_parse_treet::methodt &m, symbol_table_baset &symbol_table, message_handlert &message_handler) @@ -411,7 +411,7 @@ void java_bytecode_convert_method_lazy( } static irep_idt get_method_identifier( - const irep_idt &class_identifier, + irep_idt class_identifier, const java_bytecode_parse_treet::methodt &method) { return @@ -421,7 +421,7 @@ static irep_idt get_method_identifier( void create_parameter_names( const java_bytecode_parse_treet::methodt &m, - const irep_idt &method_identifier, + irep_idt method_identifier, java_method_typet::parameterst ¶meters, const java_bytecode_convert_methodt::method_offsett &slots_for_parameters) { @@ -694,8 +694,8 @@ static member_exprt to_member( /// \param new_label: The label to replace `old_label` with. void java_bytecode_convert_methodt::replace_goto_target( codet &repl, - const irep_idt &old_label, - const irep_idt &new_label) + irep_idt old_label, + irep_idt new_label) { const auto &stmt=repl.get_statement(); if(stmt==ID_goto) @@ -981,8 +981,7 @@ static void gather_symbol_live_ranges( /// \param classname: Class name /// \return Returns a function call to the given class' static initializer /// wrapper if one is needed, or a skip instruction otherwise. -codet java_bytecode_convert_methodt::get_clinit_call( - const irep_idt &classname) +codet java_bytecode_convert_methodt::get_clinit_call(irep_idt classname) { auto findit = symbol_table.symbols.find(clinit_wrapper_name(classname)); if(findit == symbol_table.symbols.end()) @@ -2031,7 +2030,7 @@ java_bytecode_convert_methodt::convert_instructions(const methodt &method) } codet java_bytecode_convert_methodt::convert_pop( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op) { // these are skips @@ -2097,7 +2096,7 @@ code_switcht java_bytecode_convert_methodt::convert_switch( } codet java_bytecode_convert_methodt::convert_monitorenterexit( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, const source_locationt &source_location) { @@ -2167,7 +2166,7 @@ void java_bytecode_convert_methodt::convert_dup2_x2( } exprt::operandst &java_bytecode_convert_methodt::convert_const( - const irep_idt &statement, + irep_idt statement, const constant_exprt &arg0, exprt::operandst &results) const { @@ -2230,7 +2229,7 @@ static void adjust_invoke_argument_types( void java_bytecode_convert_methodt::convert_invoke( source_locationt location, - const irep_idt &statement, + irep_idt statement, class_method_descriptor_exprt &class_method_descriptor, codet &c, exprt::operandst &results) @@ -2568,7 +2567,7 @@ code_blockt java_bytecode_convert_methodt::convert_multianewarray( code_blockt java_bytecode_convert_methodt::convert_newarray( const source_locationt &location, - const irep_idt &statement, + irep_idt statement, const exprt &arg0, const exprt::operandst &op, exprt::operandst &results) @@ -2737,7 +2736,7 @@ void java_bytecode_convert_methodt::convert_getstatic( } exprt::operandst &java_bytecode_convert_methodt::convert_cmp2( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const { @@ -2785,7 +2784,7 @@ exprt::operandst &java_bytecode_convert_methodt::convert_cmp( } exprt::operandst &java_bytecode_convert_methodt::convert_shl( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const { @@ -2802,7 +2801,7 @@ exprt::operandst &java_bytecode_convert_methodt::convert_shl( } exprt::operandst &java_bytecode_convert_methodt::convert_ushr( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const { @@ -2896,7 +2895,7 @@ code_ifthenelset java_bytecode_convert_methodt::convert_ifnonull( code_ifthenelset java_bytecode_convert_methodt::convert_if( const java_bytecode_convert_methodt::address_mapt &address_map, const exprt::operandst &op, - const irep_idt &id, + irep_idt id, const mp_integer &number, const source_locationt &location) const { @@ -2991,7 +2990,7 @@ static exprt conditional_array_cast(const exprt &expr, char type_char) } exprt java_bytecode_convert_methodt::convert_aload( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op) { PRECONDITION(op.size() == 2); @@ -3032,7 +3031,7 @@ exprt java_bytecode_convert_methodt::convert_load( } code_blockt java_bytecode_convert_methodt::convert_store( - const irep_idt &statement, + irep_idt statement, const exprt &arg0, const exprt::operandst &op, const method_offsett address, @@ -3057,7 +3056,7 @@ code_blockt java_bytecode_convert_methodt::convert_store( } code_blockt java_bytecode_convert_methodt::convert_astore( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, const source_locationt &location) { @@ -3313,8 +3312,8 @@ void java_bytecode_convert_method( /// \param classname: class whose method is referenced /// \param mangled_method_name: The particular overload of a given method. bool java_bytecode_convert_methodt::is_method_inherited( - const irep_idt &classname, - const irep_idt &mangled_method_name) const + irep_idt classname, + irep_idt mangled_method_name) const { const auto inherited_method = get_inherited_method_implementation( mangled_method_name, classname, symbol_table); @@ -3328,8 +3327,8 @@ bool java_bytecode_convert_methodt::is_method_inherited( /// \param component_name: component (static field) name /// \return identifier of the actual concrete field referred to irep_idt java_bytecode_convert_methodt::get_static_field( - const irep_idt &class_identifier, - const irep_idt &component_name) const + irep_idt class_identifier, + irep_idt component_name) const { const auto inherited_method = get_inherited_component( class_identifier, component_name, symbol_table, true); @@ -3350,7 +3349,7 @@ void java_bytecode_convert_methodt::save_stack_entries( const std::string &tmp_var_prefix, code_blockt &block, const bytecode_write_typet write_type, - const irep_idt &identifier) + irep_idt identifier) { const std::function, const exprt &expr)> diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_method.h b/jbmc/src/java_bytecode/java_bytecode_convert_method.h index 8ad5d25ad96..d63b854ff32 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method.h @@ -39,17 +39,17 @@ void java_bytecode_convert_method( bool assert_no_exceptions_thrown); void create_method_stub_symbol( - const irep_idt &identifier, - const irep_idt &base_name, - const irep_idt &pretty_name, + irep_idt identifier, + irep_idt base_name, + irep_idt pretty_name, const typet &type, - const irep_idt &declaring_class, + irep_idt declaring_class, symbol_table_baset &symbol_table, message_handlert &message_handler); void java_bytecode_convert_method_lazy( symbolt &class_symbol, - const irep_idt &method_identifier, + irep_idt method_identifier, const java_bytecode_parse_treet::methodt &, symbol_table_baset &symbol_table, message_handlert &); @@ -69,7 +69,7 @@ typedef expanding_vectort> /// i.e. a positive integer void create_parameter_names( const java_bytecode_parse_treet::methodt &m, - const irep_idt &method_identifier, + irep_idt method_identifier, java_method_typet::parameterst ¶meters, const java_bytecode_convert_methodt::method_offsett &slots_for_parameters); diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h b/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h index 2d12b5377bd..bb245e9fa7b 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h @@ -201,7 +201,7 @@ class java_bytecode_convert_methodt symbol_exprt tmp_variable(const std::string &prefix, const typet &type); // JVM program locations - static irep_idt label(const irep_idt &address); + static irep_idt label(irep_idt address); // JVM Stack typedef std::vector stackt; @@ -294,10 +294,8 @@ class java_bytecode_convert_methodt } }; - static void replace_goto_target( - codet &repl, - const irep_idt &old_label, - const irep_idt &new_label); + static void + replace_goto_target(codet &repl, irep_idt old_label, irep_idt new_label); code_blockt &get_block_for_pcrange( block_tree_nodet &tree, @@ -327,14 +325,13 @@ class java_bytecode_convert_methodt code_blockt convert_instructions(const methodt &); - codet get_clinit_call(const irep_idt &classname); + codet get_clinit_call(irep_idt classname); - bool is_method_inherited( - const irep_idt &classname, - const irep_idt &mangled_method_name) const; + bool + is_method_inherited(irep_idt classname, irep_idt mangled_method_name) const; - irep_idt get_static_field( - const irep_idt &class_identifier, const irep_idt &component_name) const; + irep_idt + get_static_field(irep_idt class_identifier, irep_idt component_name) const; enum class bytecode_write_typet { @@ -348,7 +345,7 @@ class java_bytecode_convert_methodt const std::string &, code_blockt &, const bytecode_write_typet, - const irep_idt &); + irep_idt); void create_stack_tmp_var( const std::string &, @@ -375,19 +372,18 @@ class java_bytecode_convert_methodt codet &result_code); code_blockt convert_astore( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, const source_locationt &location); code_blockt convert_store( - const irep_idt &statement, + irep_idt statement, const exprt &arg0, const exprt::operandst &op, const method_offsett address, const source_locationt &location); - static exprt - convert_aload(const irep_idt &statement, const exprt::operandst &op); + static exprt convert_aload(irep_idt statement, const exprt::operandst &op); /// Load reference from local variable. /// \p index must be an unsigned byte and an index in the local variable array @@ -416,7 +412,7 @@ class java_bytecode_convert_methodt code_ifthenelset convert_if( const java_bytecode_convert_methodt::address_mapt &address_map, const exprt::operandst &op, - const irep_idt &id, + irep_idt id, const mp_integer &number, const source_locationt &location) const; @@ -439,12 +435,12 @@ class java_bytecode_convert_methodt method_offsett address); exprt::operandst &convert_shl( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const; exprt::operandst &convert_ushr( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const; @@ -452,7 +448,7 @@ class java_bytecode_convert_methodt convert_cmp(const exprt::operandst &op, exprt::operandst &results) const; exprt::operandst &convert_cmp2( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, exprt::operandst &results) const; @@ -481,7 +477,7 @@ class java_bytecode_convert_methodt code_blockt convert_newarray( const source_locationt &location, - const irep_idt &statement, + irep_idt statement, const exprt &arg0, const exprt::operandst &op, exprt::operandst &results); @@ -511,7 +507,7 @@ class java_bytecode_convert_methodt exprt::operandst &results) const; codet convert_monitorenterexit( - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, const source_locationt &source_location); @@ -519,13 +515,13 @@ class java_bytecode_convert_methodt void convert_invoke( source_locationt location, - const irep_idt &statement, + irep_idt statement, class_method_descriptor_exprt &class_method_descriptor, codet &c, exprt::operandst &results); exprt::operandst &convert_const( - const irep_idt &statement, + irep_idt statement, const constant_exprt &arg0, exprt::operandst &results) const; @@ -540,7 +536,7 @@ class java_bytecode_convert_methodt const java_bytecode_parse_treet::instructiont::argst &args, const source_locationt &location); - codet convert_pop(const irep_idt &statement, const exprt::operandst &op); + codet convert_pop(irep_idt statement, const exprt::operandst &op); friend class java_bytecode_convert_method_unit_testt; }; diff --git a/jbmc/src/java_bytecode/java_bytecode_instrument.cpp b/jbmc/src/java_bytecode/java_bytecode_instrument.cpp index a37d6688be9..cc8c67b7587 100644 --- a/jbmc/src/java_bytecode/java_bytecode_instrument.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_instrument.cpp @@ -44,7 +44,7 @@ class java_bytecode_instrumentt code_ifthenelset throw_exception( const exprt &cond, const source_locationt &original_loc, - const irep_idt &exc_name); + irep_idt exc_name); codet check_array_access( const exprt &array_struct, @@ -93,7 +93,7 @@ const std::vector exception_needed_classes = { code_ifthenelset java_bytecode_instrumentt::throw_exception( const exprt &cond, const source_locationt &original_loc, - const irep_idt &exc_name) + irep_idt exc_name) { irep_idt exc_class_name("java::"+id2string(exc_name)); diff --git a/jbmc/src/java_bytecode/java_bytecode_language.cpp b/jbmc/src/java_bytecode/java_bytecode_language.cpp index b982ff625b0..0a4f87f6ec6 100644 --- a/jbmc/src/java_bytecode/java_bytecode_language.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_language.cpp @@ -305,9 +305,8 @@ void java_bytecode_languaget::initialize_class_loader( { string_preprocess.initialize_known_type_table(); - auto get_string_base_classes = [this](const irep_idt &id) { - return string_preprocess.get_string_type_base_classes(id); - }; + auto get_string_base_classes = [this](irep_idt id) + { return string_preprocess.get_string_type_base_classes(id); }; java_class_loader.set_extra_class_refs_function(get_string_base_classes); } @@ -511,7 +510,7 @@ static void infer_opaque_type_fields( /// \param symbol_table: global symbol table; a symbol may be added /// \return java.lang.Class typed symbol expression static symbol_exprt get_or_create_class_literal_symbol( - const irep_idt &class_id, + irep_idt class_id, symbol_table_baset &symbol_table) { struct_tag_typet java_lang_Class("java::java.lang.Class"); @@ -635,10 +634,10 @@ static void generate_constant_global_variables( /// to be created later. static void create_stub_global_symbol( symbol_table_baset &symbol_table, - const irep_idt &symbol_id, - const irep_idt &symbol_basename, + irep_idt symbol_id, + irep_idt symbol_basename, const typet &symbol_type, - const irep_idt &class_id, + irep_idt class_id, bool force_nondet_init) { symbolt new_symbol{symbol_id, symbol_type, ID_java}; @@ -675,7 +674,7 @@ static void create_stub_global_symbol( /// \return first incomplete ancestor encountered, /// including start_class_id itself. static irep_idt get_any_incomplete_ancestor_for_stub_static_field( - const irep_idt &start_class_id, + irep_idt start_class_id, const symbol_table_baset &symbol_table, const class_hierarchyt &class_hierarchy) { @@ -1120,15 +1119,15 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion( const method_convertert method_converter = [this, &symbol_table_builder, &class_to_declared_symbols, &message_handler]( - const irep_idt &function_id, - ci_lazy_methods_neededt lazy_methods_needed) { - return convert_single_method( - function_id, - symbol_table_builder, - std::move(lazy_methods_needed), - class_to_declared_symbols, - message_handler); - }; + irep_idt function_id, ci_lazy_methods_neededt lazy_methods_needed) + { + return convert_single_method( + function_id, + symbol_table_builder, + std::move(lazy_methods_needed), + class_to_declared_symbols, + message_handler); + }; ci_lazy_methodst method_gather( symbol_table, @@ -1182,7 +1181,7 @@ void java_bytecode_languaget::methods_provided( /// \param symtab: global symbol table /// \param message_handler: message handler void java_bytecode_languaget::convert_lazy_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symtab, message_handlert &message_handler) { @@ -1280,7 +1279,7 @@ static void notify_static_method_calls( /// they declare. /// \param message_handler: message handler bool java_bytecode_languaget::convert_single_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols, @@ -1339,7 +1338,7 @@ bool java_bytecode_languaget::convert_single_method( /// they declare. /// \param message_handler: message handler bool java_bytecode_languaget::convert_single_method_code( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols, diff --git a/jbmc/src/java_bytecode/java_bytecode_language.h b/jbmc/src/java_bytecode/java_bytecode_language.h index 1142e1fee0c..8f864ee7473 100644 --- a/jbmc/src/java_bytecode/java_bytecode_language.h +++ b/jbmc/src/java_bytecode/java_bytecode_language.h @@ -329,13 +329,13 @@ class java_bytecode_languaget:public languaget virtual void methods_provided(std::unordered_set &methods) const override; virtual void convert_lazy_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) override; protected: void convert_single_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols, message_handlert &message_handler) @@ -348,13 +348,13 @@ class java_bytecode_languaget:public languaget message_handler); } bool convert_single_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols, message_handlert &); bool convert_single_method_code( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols, diff --git a/jbmc/src/java_bytecode/java_bytecode_parse_tree.cpp b/jbmc/src/java_bytecode/java_bytecode_parse_tree.cpp index 3aa3449e4c6..520e8332f9f 100644 --- a/jbmc/src/java_bytecode/java_bytecode_parse_tree.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_parse_tree.cpp @@ -94,7 +94,7 @@ void java_bytecode_parse_treet::annotationt::element_value_pairt::output( std::optional java_bytecode_parse_treet::find_annotation( const annotationst &annotations, - const irep_idt &annotation_type_name) + irep_idt annotation_type_name) { const auto annotation_it = std::find_if( annotations.begin(), diff --git a/jbmc/src/java_bytecode/java_bytecode_parse_tree.h b/jbmc/src/java_bytecode/java_bytecode_parse_tree.h index cd1544ef3c1..756049d095a 100644 --- a/jbmc/src/java_bytecode/java_bytecode_parse_tree.h +++ b/jbmc/src/java_bytecode/java_bytecode_parse_tree.h @@ -50,7 +50,7 @@ struct java_bytecode_parse_treet static std::optional find_annotation( const annotationst &annotations, - const irep_idt &annotation_type_name); + irep_idt annotation_type_name); struct instructiont { @@ -75,7 +75,7 @@ struct java_bytecode_parse_treet { } - bool has_annotation(const irep_idt &annotation_id) const + bool has_annotation(irep_idt annotation_id) const { return find_annotation(annotations, annotation_id).has_value(); } @@ -198,7 +198,7 @@ struct java_bytecode_parse_treet classt() = default; /// Create a class \p name. - explicit classt(const irep_idt &name) : name(name) + explicit classt(irep_idt name) : name(name) { } @@ -321,7 +321,7 @@ struct java_bytecode_parse_treet java_bytecode_parse_treet() = default; /// Create a blank parse tree for class \p class_name. - explicit java_bytecode_parse_treet(const irep_idt &class_name) + explicit java_bytecode_parse_treet(irep_idt class_name) : parsed_class(class_name) { } @@ -335,8 +335,8 @@ class fieldref_exprt : public exprt public: fieldref_exprt( const typet &type, - const irep_idt &component_name, - const irep_idt &class_name) + irep_idt component_name, + irep_idt class_name) : exprt(ID_empty_string, type) { set(ID_class, class_name); diff --git a/jbmc/src/java_bytecode/java_bytecode_parser.cpp b/jbmc/src/java_bytecode/java_bytecode_parser.cpp index cc55bc738ea..dea9f122311 100644 --- a/jbmc/src/java_bytecode/java_bytecode_parser.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_parser.cpp @@ -1817,7 +1817,7 @@ void java_bytecode_parsert::rmethod() std::optional java_bytecode_parse( std::istream &istream, - const irep_idt &class_name, + irep_idt class_name, message_handlert &message_handler, bool skip_instructions) { @@ -1839,7 +1839,7 @@ std::optional java_bytecode_parse( std::optional java_bytecode_parse( const std::string &file, - const irep_idt &class_name, + irep_idt class_name, message_handlert &message_handler, bool skip_instructions) { diff --git a/jbmc/src/java_bytecode/java_bytecode_parser.h b/jbmc/src/java_bytecode/java_bytecode_parser.h index 9150428b686..cffc909d2f2 100644 --- a/jbmc/src/java_bytecode/java_bytecode_parser.h +++ b/jbmc/src/java_bytecode/java_bytecode_parser.h @@ -27,7 +27,7 @@ struct java_bytecode_parse_treet; /// \return parse tree, or empty std::optional on failure std::optional java_bytecode_parse( const std::string &file, - const irep_idt &class_name, + irep_idt class_name, class message_handlert &msg, bool skip_instructions = false); @@ -40,7 +40,7 @@ std::optional java_bytecode_parse( /// \return parse tree, or empty std::optional on failure std::optional java_bytecode_parse( std::istream &stream, - const irep_idt &class_name, + irep_idt class_name, class message_handlert &msg, bool skip_instructions = false); diff --git a/jbmc/src/java_bytecode/java_class_loader.cpp b/jbmc/src/java_bytecode/java_class_loader.cpp index 19b0c698d31..cf92bdd3161 100644 --- a/jbmc/src/java_bytecode/java_class_loader.cpp +++ b/jbmc/src/java_bytecode/java_class_loader.cpp @@ -15,8 +15,9 @@ Author: Daniel Kroening, kroening@kroening.com #include "java_class_loader_limit.h" -java_class_loadert::parse_tree_with_overlayst &java_class_loadert:: -operator()(const irep_idt &class_name, message_handlert &message_handler) +java_class_loadert::parse_tree_with_overlayst &java_class_loadert::operator()( + irep_idt class_name, + message_handlert &message_handler) { messaget log(message_handler); @@ -105,7 +106,7 @@ static bool is_overlay_class(const java_bytecode_parse_treet::classt &c) } bool java_class_loadert::can_load_class( - const irep_idt &class_name, + irep_idt class_name, message_handlert &message_handler) { for(const auto &cp_entry : classpath_entries) @@ -133,7 +134,7 @@ bool java_class_loadert::can_load_class( java_class_loadert::parse_tree_with_overlayst & java_class_loadert::get_parse_tree( java_class_loader_limitt &class_loader_limit, - const irep_idt &class_name, + irep_idt class_name, message_handlert &message_handler) { parse_tree_with_overlayst &parse_trees = class_map[class_name]; diff --git a/jbmc/src/java_bytecode/java_class_loader.h b/jbmc/src/java_bytecode/java_class_loader.h index 163cc1df220..1f5ab90af90 100644 --- a/jbmc/src/java_bytecode/java_class_loader.h +++ b/jbmc/src/java_bytecode/java_class_loader.h @@ -33,7 +33,7 @@ class java_class_loadert : public java_class_loader_baset parse_tree_with_overridest_mapt; /// A function that yields a list of extra dependencies based on a class name. - typedef std::function(const irep_idt &)> + typedef std::function(irep_idt)> get_extra_class_refs_functiont; java_class_loadert() @@ -41,15 +41,15 @@ class java_class_loadert : public java_class_loader_baset } parse_tree_with_overlayst & - operator()(const irep_idt &class_name, message_handlert &); + operator()(irep_idt class_name, message_handlert &); /// Checks whether \p class_name is parseable from the classpath, /// ignoring class loading limits. - bool can_load_class(const irep_idt &class_name, message_handlert &); + bool can_load_class(irep_idt class_name, message_handlert &); parse_tree_with_overlayst &get_parse_tree( java_class_loader_limitt &class_loader_limit, - const irep_idt &class_name, + irep_idt class_name, message_handlert &); /// Set the argument of the class loader limit \ref java_class_loader_limitt @@ -84,8 +84,7 @@ class java_class_loadert : public java_class_loader_baset { return fixed_keys_map_wrappert(class_map); } - const java_bytecode_parse_treet &get_original_class( - const irep_idt &class_name) + const java_bytecode_parse_treet &get_original_class(irep_idt class_name) { return class_map.at(class_name).front(); } diff --git a/jbmc/src/java_bytecode/java_class_loader_base.cpp b/jbmc/src/java_bytecode/java_class_loader_base.cpp index 24efaaf881c..49d41a27c80 100644 --- a/jbmc/src/java_bytecode/java_class_loader_base.cpp +++ b/jbmc/src/java_bytecode/java_class_loader_base.cpp @@ -92,8 +92,7 @@ std::string java_class_loader_baset::file_to_class_name(const std::string &file) /// file_to_class_name. /// \param class_name: the name of the class /// \return the class name converted to file name -std::string -java_class_loader_baset::class_name_to_jar_file(const irep_idt &class_name) +std::string java_class_loader_baset::class_name_to_jar_file(irep_idt class_name) { std::string result = id2string(class_name); @@ -111,8 +110,7 @@ java_class_loader_baset::class_name_to_jar_file(const irep_idt &class_name) /// Convert a class name to a file name, with OS-dependent syntax /// \param class_name: the name of the class /// \return the class name converted to file name -std::string -java_class_loader_baset::class_name_to_os_file(const irep_idt &class_name) +std::string java_class_loader_baset::class_name_to_os_file(irep_idt class_name) { std::string result = id2string(class_name); @@ -135,7 +133,7 @@ java_class_loader_baset::class_name_to_os_file(const irep_idt &class_name) /// attempt to load a class from a classpath_entry std::optional java_class_loader_baset::load_class( - const irep_idt &class_name, + irep_idt class_name, const classpath_entryt &cp_entry, message_handlert &message_handler) { @@ -158,7 +156,7 @@ std::optional java_class_loader_baset::load_class( /// \return optional value of parse tree, empty if class cannot be loaded std::optional java_class_loader_baset::get_class_from_jar( - const irep_idt &class_name, + irep_idt class_name, const std::string &jar_file, message_handlert &message_handler) { @@ -193,7 +191,7 @@ java_class_loader_baset::get_class_from_jar( /// \return optional value of parse tree, empty if class cannot be loaded std::optional java_class_loader_baset::get_class_from_directory( - const irep_idt &class_name, + irep_idt class_name, const std::string &path, message_handlert &message_handler) { diff --git a/jbmc/src/java_bytecode/java_class_loader_base.h b/jbmc/src/java_bytecode/java_class_loader_base.h index 7507b35a6cc..b19f4ae4fb4 100644 --- a/jbmc/src/java_bytecode/java_class_loader_base.h +++ b/jbmc/src/java_bytecode/java_class_loader_base.h @@ -35,8 +35,8 @@ class java_class_loader_baset void add_classpath_entry(const std::string &, message_handlert &); static std::string file_to_class_name(const std::string &); - static std::string class_name_to_os_file(const irep_idt &); - static std::string class_name_to_jar_file(const irep_idt &); + static std::string class_name_to_os_file(irep_idt); + static std::string class_name_to_jar_file(irep_idt); /// a cache for jar_filet, by path name jar_poolt jar_pool; @@ -59,20 +59,18 @@ class java_class_loader_baset std::list classpath_entries; /// attempt to load a class from a classpath_entry - std::optional load_class( - const irep_idt &class_name, - const classpath_entryt &, - message_handlert &); + std::optional + load_class(irep_idt class_name, const classpath_entryt &, message_handlert &); /// attempt to load a class from a given jar file std::optional get_class_from_jar( - const irep_idt &class_name, + irep_idt class_name, const std::string &jar_file, message_handlert &); /// attempt to load a class from a given directory std::optional get_class_from_directory( - const irep_idt &class_name, + irep_idt class_name, const std::string &path, message_handlert &); }; diff --git a/jbmc/src/java_bytecode/java_entry_point.cpp b/jbmc/src/java_bytecode/java_entry_point.cpp index fa074554c8e..9f84935d451 100644 --- a/jbmc/src/java_bytecode/java_entry_point.cpp +++ b/jbmc/src/java_bytecode/java_entry_point.cpp @@ -547,7 +547,7 @@ static codet record_exception( main_function_resultt get_main_symbol( const symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, message_handlert &message_handler) { messaget message(message_handler); @@ -601,7 +601,7 @@ main_function_resultt get_main_symbol( bool java_entry_point( symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, diff --git a/jbmc/src/java_bytecode/java_entry_point.h b/jbmc/src/java_bytecode/java_entry_point.h index 077a0438db0..16db9748192 100644 --- a/jbmc/src/java_bytecode/java_entry_point.h +++ b/jbmc/src/java_bytecode/java_entry_point.h @@ -76,7 +76,7 @@ using build_argumentst = /// \return true if error occurred on entry point search bool java_entry_point( class symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, class message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, @@ -139,7 +139,7 @@ irep_idt get_java_class_literal_initializer_signature(); /// Figures out the entry point of the code to verify main_function_resultt get_main_symbol( const symbol_table_baset &symbol_table, - const irep_idt &main_class, + irep_idt main_class, message_handlert &); /// Generate a _start function for a specific function. See diff --git a/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp b/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp index 6bd53817086..92424fced11 100644 --- a/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp +++ b/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp @@ -18,7 +18,7 @@ goto_tracet java_multi_path_symex_checkert::build_full_trace() const } goto_tracet -java_multi_path_symex_checkert::build_trace(const irep_idt &property_id) const +java_multi_path_symex_checkert::build_trace(irep_idt property_id) const { goto_tracet goto_trace = multi_path_symex_checkert::build_trace(property_id); check_trace_assumptions( diff --git a/jbmc/src/java_bytecode/java_multi_path_symex_checker.h b/jbmc/src/java_bytecode/java_multi_path_symex_checker.h index 99f63aa050a..50c5bc6bc75 100644 --- a/jbmc/src/java_bytecode/java_multi_path_symex_checker.h +++ b/jbmc/src/java_bytecode/java_multi_path_symex_checker.h @@ -29,7 +29,7 @@ class java_multi_path_symex_checkert : public multi_path_symex_checkert } goto_tracet build_full_trace() const override; - goto_tracet build_trace(const irep_idt &property_id) const override; + goto_tracet build_trace(irep_idt property_id) const override; goto_tracet build_shortest_trace() const override; }; diff --git a/jbmc/src/java_bytecode/java_object_factory.cpp b/jbmc/src/java_bytecode/java_object_factory.cpp index 3ea4bab11eb..d38a01773f7 100644 --- a/jbmc/src/java_bytecode/java_object_factory.cpp +++ b/jbmc/src/java_bytecode/java_object_factory.cpp @@ -292,7 +292,7 @@ class recursion_set_entryt /// entry and erase it on destruction; otherwise do nothing. /// \param entry: entry to add /// \return true if added to the set (and therefore owned by this object) - bool insert_entry(const irep_idt &entry) + bool insert_entry(irep_idt entry) { INVARIANT(erase_entry.empty(), "insert_entry should only be called once"); INVARIANT(!entry.empty(), "entry should be a struct tag"); @@ -365,7 +365,7 @@ void initialize_nondet_string_fields( const std::size_t &min_nondet_string_length, const std::size_t &max_nondet_string_length, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, bool printable, allocate_objectst &allocate_objects) diff --git a/jbmc/src/java_bytecode/java_root_class.cpp b/jbmc/src/java_bytecode/java_root_class.cpp index 36ac2802eef..81ef886a763 100644 --- a/jbmc/src/java_bytecode/java_root_class.cpp +++ b/jbmc/src/java_bytecode/java_root_class.cpp @@ -41,7 +41,7 @@ void java_root_class(symbolt &class_symbol) void java_root_class_init( struct_exprt &jlo, const struct_typet &root_type, - const irep_idt &class_identifier) + irep_idt class_identifier) { jlo.operands().resize(root_type.components().size()); diff --git a/jbmc/src/java_bytecode/java_root_class.h b/jbmc/src/java_bytecode/java_root_class.h index 086c461347e..2aa0cae9a5a 100644 --- a/jbmc/src/java_bytecode/java_root_class.h +++ b/jbmc/src/java_bytecode/java_root_class.h @@ -24,6 +24,6 @@ void java_root_class( void java_root_class_init( struct_exprt &jlo, const struct_typet &root_type, - const irep_idt &class_identifier); + irep_idt class_identifier); #endif // CPROVER_JAVA_BYTECODE_JAVA_ROOT_CLASS_H diff --git a/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp b/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp index d361ebb56cb..07a0d4a31c3 100644 --- a/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp +++ b/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp @@ -26,7 +26,7 @@ goto_tracet java_single_path_symex_checkert::build_shortest_trace() const } goto_tracet -java_single_path_symex_checkert::build_trace(const irep_idt &property_id) const +java_single_path_symex_checkert::build_trace(irep_idt property_id) const { goto_tracet goto_trace = single_path_symex_checkert::build_trace(property_id); check_trace_assumptions( diff --git a/jbmc/src/java_bytecode/java_single_path_symex_checker.h b/jbmc/src/java_bytecode/java_single_path_symex_checker.h index de0862194d1..4f04266ab18 100644 --- a/jbmc/src/java_bytecode/java_single_path_symex_checker.h +++ b/jbmc/src/java_bytecode/java_single_path_symex_checker.h @@ -35,7 +35,7 @@ class java_single_path_symex_checkert : public single_path_symex_checkert goto_tracet build_full_trace() const override; goto_tracet build_shortest_trace() const override; - goto_tracet build_trace(const irep_idt &property_id) const override; + goto_tracet build_trace(irep_idt property_id) const override; }; #endif // CPROVER_JAVA_BYTECODE_JAVA_SINGLE_PATH_SYMEX_CHECKER_H diff --git a/jbmc/src/java_bytecode/java_static_initializers.cpp b/jbmc/src/java_bytecode/java_static_initializers.cpp index fad44b65958..8bd4cc2f4f2 100644 --- a/jbmc/src/java_bytecode/java_static_initializers.cpp +++ b/jbmc/src/java_bytecode/java_static_initializers.cpp @@ -70,12 +70,12 @@ const std::string clinit_function_suffix = ".:()V"; // NOLINT(*) /// Doesn't check whether the symbol actually exists /// \param class_name: class symbol name /// \return static initializer wrapper name -irep_idt clinit_wrapper_name(const irep_idt &class_name) +irep_idt clinit_wrapper_name(irep_idt class_name) { return id2string(class_name) + clinit_wrapper_suffix; } -irep_idt user_specified_clinit_name(const irep_idt &class_name) +irep_idt user_specified_clinit_name(irep_idt class_name) { return id2string(class_name) + user_specified_clinit_suffix; } @@ -83,7 +83,7 @@ irep_idt user_specified_clinit_name(const irep_idt &class_name) /// Check if function_id is a clinit wrapper /// \param function_id: some function identifier /// \return true if the passed identifier is a clinit wrapper -bool is_clinit_wrapper_function(const irep_idt &function_id) +bool is_clinit_wrapper_function(irep_idt function_id) { return has_suffix(id2string(function_id), clinit_wrapper_suffix); } @@ -91,7 +91,7 @@ bool is_clinit_wrapper_function(const irep_idt &function_id) /// Check if function_id is a clinit /// \param function_id: some function identifier /// \return true if the passed identifier is a clinit -bool is_clinit_function(const irep_idt &function_id) +bool is_clinit_function(irep_idt function_id) { return has_suffix(id2string(function_id), clinit_function_suffix); } @@ -99,7 +99,7 @@ bool is_clinit_function(const irep_idt &function_id) /// Check if function_id is a user-specified clinit /// \param function_id: some function identifier /// \return true if the passed identifier is a clinit -bool is_user_specified_clinit_function(const irep_idt &function_id) +bool is_user_specified_clinit_function(irep_idt function_id) { return has_suffix(id2string(function_id), user_specified_clinit_suffix); } @@ -114,7 +114,7 @@ bool is_user_specified_clinit_function(const irep_idt &function_id) /// /return returns new symbol. static symbolt add_new_variable_symbol( symbol_table_baset &symbol_table, - const irep_idt &name, + irep_idt name, const typet &type, const exprt &value, const bool is_thread_local, @@ -137,7 +137,7 @@ static symbolt add_new_variable_symbol( /// given class. /// \param class_name: class symbol name /// \return static initializer wrapper-already run global name -static irep_idt clinit_already_run_variable_name(const irep_idt &class_name) +static irep_idt clinit_already_run_variable_name(irep_idt class_name) { return id2string(class_name) + "::clinit_already_run"; } @@ -146,7 +146,7 @@ static irep_idt clinit_already_run_variable_name(const irep_idt &class_name) /// if a static initializer actually exists. /// \param class_name: class symbol name /// \return Static initializer symbol name -static irep_idt clinit_function_name(const irep_idt &class_name) +static irep_idt clinit_function_name(irep_idt class_name) { return id2string(class_name) + clinit_function_suffix; } @@ -155,7 +155,7 @@ static irep_idt clinit_function_name(const irep_idt &class_name) /// given class. /// \param class_name: class symbol name /// \return static initializer wrapper-state variable global name -static irep_idt clinit_state_var_name(const irep_idt &class_name) +static irep_idt clinit_state_var_name(irep_idt class_name) { return id2string(class_name) + CPROVER_PREFIX "clinit_state"; } @@ -164,7 +164,7 @@ static irep_idt clinit_state_var_name(const irep_idt &class_name) /// given class. /// \param class_name: class symbol name /// \return static initializer wrapper-state local state variable name -static irep_idt clinit_thread_local_state_var_name(const irep_idt &class_name) +static irep_idt clinit_thread_local_state_var_name(irep_idt class_name) { return id2string(class_name) + CPROVER_PREFIX "clinit_threadlocal_state"; } @@ -172,7 +172,7 @@ static irep_idt clinit_thread_local_state_var_name(const irep_idt &class_name) /// Get name of the static-initialization local variable for a given class. /// \param class_name: class symbol name /// \return static initializer wrapper-state local variable -static irep_idt clinit_local_init_complete_var_name(const irep_idt &class_name) +static irep_idt clinit_local_init_complete_var_name(irep_idt class_name) { return id2string(class_name) + CPROVER_PREFIX "clinit_wrapper::init_complete"; } @@ -228,7 +228,7 @@ gen_clinit_eqexpr(const exprt &expr, const clinit_statest state) /// \param message_handler: log static void clinit_wrapper_do_recursive_calls( symbol_table_baset &symbol_table, - const irep_idt &class_name, + irep_idt class_name, code_blockt &init_body, const bool nondet_static, const bool replace_clinit, @@ -304,7 +304,7 @@ static void clinit_wrapper_do_recursive_calls( /// \param symbol_table: global symbol table /// \return true if a static initializer wrapper is needed static bool needs_clinit_wrapper( - const irep_idt &class_name, + irep_idt class_name, const symbol_table_baset &symbol_table) { if(symbol_table.has_symbol(clinit_function_name(class_name))) @@ -326,9 +326,9 @@ static bool needs_clinit_wrapper( } static void create_function_symbol( - const irep_idt &class_name, - const irep_idt &function_name, - const irep_idt &function_base_name, + irep_idt class_name, + irep_idt function_name, + irep_idt function_base_name, const synthetic_method_typet &synthetic_method_type, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) @@ -354,7 +354,7 @@ static void create_function_symbol( // Create symbol for the "clinit_wrapper" static void create_clinit_wrapper_function_symbol( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) { @@ -369,7 +369,7 @@ static void create_clinit_wrapper_function_symbol( // Create symbol for the "user_specified_clinit" static void create_user_specified_clinit_function_symbol( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) { @@ -393,7 +393,7 @@ static void create_user_specified_clinit_function_symbol( /// \param thread_safe: if true state variables required to make the /// clinit_wrapper thread safe will be created. static void create_clinit_wrapper_symbols( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, const bool thread_safe) @@ -518,7 +518,7 @@ static void create_clinit_wrapper_symbols( /// \param message_handler: log output /// \return the body of the static initializer wrapper code_blockt get_thread_safe_clinit_wrapper_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const bool nondet_static, const bool replace_clinit, @@ -716,7 +716,7 @@ code_blockt get_thread_safe_clinit_wrapper_body( /// \param message_handler: log output /// \return the body of the static initializer wrapper code_ifthenelset get_clinit_wrapper_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const bool nondet_static, const bool replace_clinit, @@ -789,7 +789,7 @@ class_to_declared_symbols(const symbol_table_baset &symbol_table) } code_blockt get_user_specified_clinit_body( - const irep_idt &class_id, + irep_idt class_id, const json_objectt &static_values_json, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, @@ -1000,7 +1000,7 @@ void stub_global_initializer_factoryt::create_stub_global_initializer_symbols( /// \param message_handler: log output /// \return synthetic static initializer body. code_blockt stub_global_initializer_factoryt::get_stub_initializer_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, diff --git a/jbmc/src/java_bytecode/java_static_initializers.h b/jbmc/src/java_bytecode/java_static_initializers.h index 3e2286bc3b9..dfb6b10b48b 100644 --- a/jbmc/src/java_bytecode/java_static_initializers.h +++ b/jbmc/src/java_bytecode/java_static_initializers.h @@ -24,12 +24,12 @@ class symbolt; struct java_object_factory_parameterst; struct object_creation_referencet; -irep_idt clinit_wrapper_name(const irep_idt &class_name); -irep_idt user_specified_clinit_name(const irep_idt &class_name); +irep_idt clinit_wrapper_name(irep_idt class_name); +irep_idt user_specified_clinit_name(irep_idt class_name); -bool is_clinit_wrapper_function(const irep_idt &function_id); -bool is_clinit_function(const irep_idt &function_id); -bool is_user_specified_clinit_function(const irep_idt &function_id); +bool is_clinit_wrapper_function(irep_idt function_id); +bool is_clinit_function(irep_idt function_id); +bool is_user_specified_clinit_function(irep_idt function_id); void create_static_initializer_symbols( symbol_table_baset &symbol_table, @@ -38,7 +38,7 @@ void create_static_initializer_symbols( const bool is_user_clinit_needed); code_blockt get_thread_safe_clinit_wrapper_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const bool nondet_static, const bool replace_clinit, @@ -47,7 +47,7 @@ code_blockt get_thread_safe_clinit_wrapper_body( message_handlert &message_handler); code_ifthenelset get_clinit_wrapper_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const bool nondet_static, const bool replace_clinit, @@ -83,7 +83,7 @@ class_to_declared_symbols(const symbol_table_baset &symbol_table); /// they declare. /// \return the body of the user_specified_clinit function as a code block. code_blockt get_user_specified_clinit_body( - const irep_idt &class_id, + irep_idt class_id, const json_objectt &static_values_json, symbol_table_baset &symbol_table, std::optional needed_lazy_methods, @@ -105,7 +105,7 @@ class stub_global_initializer_factoryt synthetic_methods_mapt &synthetic_methods); code_blockt get_stub_initializer_body( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, diff --git a/jbmc/src/java_bytecode/java_string_library_preprocess.cpp b/jbmc/src/java_bytecode/java_string_library_preprocess.cpp index 18106895546..da207b4e3cb 100644 --- a/jbmc/src/java_bytecode/java_string_library_preprocess.cpp +++ b/jbmc/src/java_bytecode/java_string_library_preprocess.cpp @@ -185,7 +185,7 @@ static typet string_length_type() /// \return a list of base classes, again without "java::" prefix. std::vector java_string_library_preprocesst::get_string_type_base_classes( - const irep_idt &class_name) + irep_idt class_name) { if(!is_known_string_type(class_name)) return {}; @@ -218,7 +218,7 @@ java_string_library_preprocesst::get_string_type_base_classes( /// \param class_name: a name for the class such as "java.lang.String" /// \param symbol_table: symbol table to which the class will be added void java_string_library_preprocesst::add_string_type( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table) { irep_idt class_symbol_name = "java::" + id2string(class_name); @@ -280,7 +280,7 @@ void java_string_library_preprocesst::add_string_type( exprt::operandst java_string_library_preprocesst::process_parameters( const java_method_typet::parameterst ¶ms, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &init_code) { @@ -310,7 +310,7 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt( const exprt &expr_to_process, const source_locationt &loc, symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, code_blockt &init_code) { PRECONDITION(implements_java_char_sequence_pointer(expr_to_process.type())); @@ -337,7 +337,7 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt( exprt::operandst java_string_library_preprocesst::process_operands( const exprt::operandst &operands, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &init_code) { @@ -431,7 +431,7 @@ static exprt get_data(const exprt &expr, const symbol_table_baset &symbol_table) refined_string_exprt java_string_library_preprocesst::replace_char_array( const exprt &array_pointer, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code) { @@ -468,7 +468,7 @@ refined_string_exprt java_string_library_preprocesst::replace_char_array( symbol_exprt java_string_library_preprocesst::fresh_string( const typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table) { symbolt string_symbol = @@ -486,7 +486,7 @@ symbol_exprt java_string_library_preprocesst::fresh_string( /// \return refined string expr with fresh content and length symbols refined_string_exprt java_string_library_preprocesst::decl_string_expr( const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code) { @@ -511,7 +511,7 @@ refined_string_exprt java_string_library_preprocesst::decl_string_expr( /// \return a new string_expr refined_string_exprt java_string_library_preprocesst::make_nondet_string_expr( const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code) { @@ -549,7 +549,7 @@ refined_string_exprt java_string_library_preprocesst::make_nondet_string_expr( exprt java_string_library_preprocesst::allocate_fresh_string( const typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code) { @@ -577,7 +577,7 @@ exprt java_string_library_preprocesst::allocate_fresh_string( /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ static codet code_assign_function_application( const exprt &lhs, - const irep_idt &function_id, + irep_idt function_id, const exprt::operandst &arguments, symbol_table_baset &symbol_table) { @@ -597,7 +597,7 @@ static codet code_assign_function_application( /// return (arguments) /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ codet java_string_library_preprocesst::code_return_function_application( - const irep_idt &function_id, + irep_idt function_id, const exprt::operandst &arguments, const typet &type, symbol_table_baset &symbol_table) @@ -615,7 +615,7 @@ codet java_string_library_preprocesst::code_return_function_application( exprt make_nondet_infinite_char_array( symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code) { const array_typet array_type( @@ -649,7 +649,7 @@ void add_pointer_to_array_association( const exprt &array, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code) { PRECONDITION(array.type().id() == ID_array); @@ -680,7 +680,7 @@ void add_array_to_length_association( const exprt &length, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code) { const symbolt &return_sym = fresh_java_symbol( @@ -710,10 +710,10 @@ void add_array_to_length_association( void add_character_set_constraint( const exprt &pointer, const exprt &length, - const irep_idt &char_range, + irep_idt char_range, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code) { PRECONDITION(pointer.type().id() == ID_pointer); @@ -748,7 +748,7 @@ void add_character_set_constraint( /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// \return refined string expression `str` refined_string_exprt java_string_library_preprocesst::string_expr_of_function( - const irep_idt &function_id, + irep_idt function_id, const exprt::operandst &arguments, const source_locationt &loc, symbol_table_baset &symbol_table, @@ -917,7 +917,7 @@ java_string_library_preprocesst::string_literal_to_string_expr( code_blockt java_string_library_preprocesst::make_float_to_string_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -1076,7 +1076,7 @@ code_blockt java_string_library_preprocesst::make_float_to_string_code( /// cprover_string = {.=cprover_string_length, .=cprover_string_array}; /// code_blockt java_string_library_preprocesst::make_init_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table, @@ -1120,7 +1120,7 @@ code_blockt java_string_library_preprocesst::make_init_function_from_call( /// \return Code calling function with the given function name. code_blockt java_string_library_preprocesst::make_assign_and_return_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table) @@ -1145,7 +1145,7 @@ java_string_library_preprocesst::make_assign_and_return_function_from_call( /// \return Code assigning result of a call to the function with given function /// name. code_blockt java_string_library_preprocesst::make_assign_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table) @@ -1171,7 +1171,7 @@ code_blockt java_string_library_preprocesst::make_assign_function_from_call( code_blockt java_string_library_preprocesst::make_class_identifier_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -1229,7 +1229,7 @@ code_blockt java_string_library_preprocesst::make_class_identifier_code( /// return function_id(args) /// ~~~~~~~~~~~~~~~~~~~~~~~~~~ code_blockt java_string_library_preprocesst::make_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table) @@ -1259,7 +1259,7 @@ code_blockt java_string_library_preprocesst::make_function_from_call( /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ code_blockt java_string_library_preprocesst::make_string_returning_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table) @@ -1306,7 +1306,7 @@ java_string_library_preprocesst::make_string_returning_function_from_call( code_blockt java_string_library_preprocesst::make_copy_string_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -1356,7 +1356,7 @@ code_blockt java_string_library_preprocesst::make_copy_string_code( code_blockt java_string_library_preprocesst::make_copy_constructor_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -1401,7 +1401,7 @@ code_blockt java_string_library_preprocesst::make_copy_constructor_code( code_returnt java_string_library_preprocesst::make_string_length_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -1420,7 +1420,7 @@ code_returnt java_string_library_preprocesst::make_string_length_code( } bool java_string_library_preprocesst::implements_function( - const irep_idt &function_id) const + irep_idt function_id) const { for(const id_mapt *map : id_maps) if(map->count(function_id) != 0) diff --git a/jbmc/src/java_bytecode/java_string_library_preprocess.h b/jbmc/src/java_bytecode/java_string_library_preprocess.h index 7fc1f014ff9..052b2129e4f 100644 --- a/jbmc/src/java_bytecode/java_string_library_preprocess.h +++ b/jbmc/src/java_bytecode/java_string_library_preprocess.h @@ -47,7 +47,7 @@ class java_string_library_preprocesst void initialize_known_type_table(); void initialize_conversion_table(); - bool implements_function(const irep_idt &function_id) const; + bool implements_function(irep_idt function_id) const; void get_all_function_names(std::unordered_set &methods) const; codet code_for_function( @@ -59,10 +59,8 @@ class java_string_library_preprocesst { return character_preprocess.replace_character_call(call); } - std::vector get_string_type_base_classes( - const irep_idt &class_name); - void - add_string_type(const irep_idt &class_name, symbol_table_baset &symbol_table); + std::vector get_string_type_base_classes(irep_idt class_name); + void add_string_type(irep_idt class_name, symbol_table_baset &symbol_table); bool is_known_string_type(irep_idt class_name); static bool implements_java_char_sequence_pointer(const typet &type) @@ -106,7 +104,7 @@ class java_string_library_preprocesst typedef std::function conversion_functiont; @@ -154,35 +152,35 @@ class java_string_library_preprocesst code_blockt make_float_to_string_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); code_blockt make_copy_string_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); code_blockt make_copy_constructor_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); code_returnt make_string_length_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); code_blockt make_class_identifier_code( const java_method_typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); @@ -190,7 +188,7 @@ class java_string_library_preprocesst exprt::operandst process_parameters( const java_method_typet::parameterst ¶ms, const source_locationt &loc, - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, code_blockt &init_code); @@ -199,7 +197,7 @@ class java_string_library_preprocesst java_string_library_preprocesst &preprocess, const exprt &deref, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &init_code); @@ -207,56 +205,56 @@ class java_string_library_preprocesst const exprt &deref, const source_locationt &loc, symbol_table_baset &symbol_table, - const irep_idt &function_name, + irep_idt function_name, code_blockt &init_code); exprt::operandst process_operands( const exprt::operandst &operands, const source_locationt &loc, - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, code_blockt &init_code); refined_string_exprt replace_char_array( const exprt &array_pointer, const source_locationt &loc, - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, code_blockt &code); symbol_exprt fresh_string( const typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table); refined_string_exprt decl_string_expr( const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code); refined_string_exprt make_nondet_string_expr( const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code); exprt allocate_fresh_string( const typet &type, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &code); codet code_return_function_application( - const irep_idt &function_id, + irep_idt function_id, const exprt::operandst &arguments, const typet &type, symbol_table_baset &symbol_table); refined_string_exprt string_expr_of_function( - const irep_idt &function_id, + irep_idt function_id, const exprt::operandst &arguments, const source_locationt &loc, symbol_table_baset &symbol_table, @@ -289,32 +287,32 @@ class java_string_library_preprocesst code_blockt &code); code_blockt make_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table); code_blockt make_init_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table, bool is_constructor = true); code_blockt make_assign_and_return_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table); code_blockt make_assign_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table); code_blockt make_string_returning_function_from_call( - const irep_idt &function_id, + irep_idt function_id, const java_method_typet &type, const source_locationt &loc, symbol_table_baset &symbol_table); @@ -323,7 +321,7 @@ class java_string_library_preprocesst exprt make_nondet_infinite_char_array( symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code); void add_pointer_to_array_association( @@ -331,7 +329,7 @@ void add_pointer_to_array_association( const exprt &array, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code); void add_array_to_length_association( @@ -339,16 +337,16 @@ void add_array_to_length_association( const exprt &length, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code); void add_character_set_constraint( const exprt &pointer, const exprt &length, - const irep_idt &char_range, + irep_idt char_range, symbol_table_baset &symbol_table, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &code); #endif // CPROVER_JAVA_BYTECODE_JAVA_STRING_LIBRARY_PREPROCESS_H diff --git a/jbmc/src/java_bytecode/java_string_literal_expr.h b/jbmc/src/java_bytecode/java_string_literal_expr.h index 1c6be6eb987..c551735d657 100644 --- a/jbmc/src/java_bytecode/java_string_literal_expr.h +++ b/jbmc/src/java_bytecode/java_string_literal_expr.h @@ -17,7 +17,7 @@ Author: Diffblue Ltd. class java_string_literal_exprt : public exprt { public: - explicit java_string_literal_exprt(const irep_idt &literal) + explicit java_string_literal_exprt(irep_idt literal) : exprt(ID_java_string_literal) { set(ID_value, literal); diff --git a/jbmc/src/java_bytecode/java_string_literals.cpp b/jbmc/src/java_bytecode/java_string_literals.cpp index d63681580b9..b50e7f7040e 100644 --- a/jbmc/src/java_bytecode/java_string_literals.cpp +++ b/jbmc/src/java_bytecode/java_string_literals.cpp @@ -184,7 +184,7 @@ symbol_exprt get_or_create_string_literal_symbol( } symbol_exprt get_or_create_string_literal_symbol( - const irep_idt &string_value, + irep_idt string_value, symbol_table_baset &symbol_table, bool string_refinement_enabled) { diff --git a/jbmc/src/java_bytecode/java_string_literals.h b/jbmc/src/java_bytecode/java_string_literals.h index fa57306e1dd..c688e9ab180 100644 --- a/jbmc/src/java_bytecode/java_string_literals.h +++ b/jbmc/src/java_bytecode/java_string_literals.h @@ -31,7 +31,7 @@ symbol_exprt get_or_create_string_literal_symbol( /// get_or_create_string_literal_symbol(const exprt&, symbol_table_baset&, bool) /// except it takes an id/string parameter rather than a string literal exprt. symbol_exprt get_or_create_string_literal_symbol( - const irep_idt &string_value, + irep_idt string_value, symbol_table_baset &symbol_table, bool string_refinement_enabled); diff --git a/jbmc/src/java_bytecode/java_types.cpp b/jbmc/src/java_bytecode/java_types.cpp index d6f2c1b9ffe..4fa88fd0e7a 100644 --- a/jbmc/src/java_bytecode/java_types.cpp +++ b/jbmc/src/java_bytecode/java_types.cpp @@ -230,7 +230,7 @@ exprt get_array_element_type_field(const exprt &pointer) /// \param tag: Tag of a struct /// \return True if the given string is a Java array tag, i.e., has a prefix /// of java::array[ -bool is_java_array_tag(const irep_idt& tag) +bool is_java_array_tag(irep_idt tag) { return tag.starts_with("java::array["); } diff --git a/jbmc/src/java_bytecode/java_types.h b/jbmc/src/java_bytecode/java_types.h index b1e2c1a4306..c4f49cfb79a 100644 --- a/jbmc/src/java_bytecode/java_types.h +++ b/jbmc/src/java_bytecode/java_types.h @@ -200,7 +200,7 @@ class java_class_typet:public class_typet public: componentt() = default; - componentt(const irep_idt &_name, typet _type) + componentt(irep_idt _name, typet _type) : class_typet::componentt(_name, std::move(_type)) { } @@ -230,7 +230,7 @@ class java_class_typet:public class_typet return (componentst &)(add(ID_components).get_sub()); } - const componentt &get_component(const irep_idt &component_name) const + const componentt &get_component(irep_idt component_name) const { return static_cast( class_typet::get_component(component_name)); @@ -241,7 +241,7 @@ class java_class_typet:public class_typet public: methodt() = delete; - methodt(const irep_idt &_name, java_method_typet _type) + methodt(irep_idt _name, java_method_typet _type) : class_typet::methodt(_name, std::move(_type)) { } @@ -288,7 +288,7 @@ class java_class_typet:public class_typet } /// Sets the method's descriptor -- the mangled form of its type - void set_descriptor(const irep_idt &id) + void set_descriptor(irep_idt id) { set(ID_object_descriptor, id); } @@ -324,7 +324,7 @@ class java_class_typet:public class_typet return get(ID_access); } - void set_access(const irep_idt &access) + void set_access(irep_idt access) { return set(ID_access, access); } @@ -344,7 +344,7 @@ class java_class_typet:public class_typet return get(ID_outer_class); } - void set_outer_class(const irep_idt &outer_class) + void set_outer_class(irep_idt outer_class) { return set(ID_outer_class, outer_class); } @@ -354,7 +354,7 @@ class java_class_typet:public class_typet return get(ID_super_class); } - void set_super_class(const irep_idt &super_class) + void set_super_class(irep_idt super_class) { return set(ID_super_class, super_class); } @@ -560,7 +560,7 @@ class java_class_typet:public class_typet /// Set the name of the struct, which can be used to look up its symbol /// in the symbol table. - void set_name(const irep_idt &name) + void set_name(irep_idt name) { set(ID_name, name); } @@ -572,7 +572,7 @@ class java_class_typet:public class_typet } /// Set the name of a java inner class. - void set_inner_name(const irep_idt &name) + void set_inner_name(irep_idt name) { set(ID_inner_name, name); } @@ -690,7 +690,7 @@ std::vector parse_raw_list_types( char opening_bracket, char closing_bracket); -bool is_java_array_tag(const irep_idt &tag); +bool is_java_array_tag(irep_idt tag); bool is_valid_java_array(const struct_typet &); bool equal_java_types(const typet &type1, const typet &type2); @@ -704,7 +704,7 @@ class java_generic_parameter_tagt : public struct_tag_typet typedef struct_tag_typet type_variablet; java_generic_parameter_tagt( - const irep_idt &_type_var_name, + irep_idt _type_var_name, const struct_tag_typet &_bound) : struct_tag_typet(_bound) { @@ -777,7 +777,7 @@ class java_generic_parametert : public reference_typet typedef struct_tag_typet type_variablet; java_generic_parametert( - const irep_idt &_type_var_name, + irep_idt _type_var_name, const struct_tag_typet &_bound) : reference_typet(java_reference_type( java_generic_parameter_tagt(_type_var_name, _bound))) @@ -1158,7 +1158,7 @@ inline std::optional java_type_from_string_with_exception( /// \return Optional with the size if the identifier was found. inline const std::optional java_generics_get_index_for_subtype( const std::vector &gen_types, - const irep_idt &identifier) + irep_idt identifier) { const auto iter = std::find_if( gen_types.cbegin(), diff --git a/jbmc/src/java_bytecode/java_utils.cpp b/jbmc/src/java_bytecode/java_utils.cpp index a851c2f27f6..db7ec40eb13 100644 --- a/jbmc/src/java_bytecode/java_utils.cpp +++ b/jbmc/src/java_bytecode/java_utils.cpp @@ -32,8 +32,7 @@ bool is_java_string_type(const struct_typet &struct_type) struct_type.has_component("data"); } -const java_boxed_type_infot * -get_boxed_type_info_by_name(const irep_idt &type_name) +const java_boxed_type_infot *get_boxed_type_info_by_name(irep_idt type_name) { static std::unordered_map type_info_by_name = { @@ -106,7 +105,7 @@ get_java_primitive_type_info(const typet &maybe_primitive_type) return found == type_info_by_primitive_type.end() ? nullptr : &found->second; } -bool is_primitive_wrapper_type_id(const irep_idt &id) +bool is_primitive_wrapper_type_id(irep_idt id) { return get_boxed_type_info_by_name(id) != nullptr; } @@ -160,7 +159,7 @@ const std::string java_class_to_package(const std::string &canonical_classname) } void generate_class_stub( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table, message_handlert &message_handler, const struct_union_typet::componentst &componentst) @@ -204,7 +203,7 @@ void merge_source_location_rec( merge_source_location_rec(op, source_location); } -bool is_java_string_literal_id(const irep_idt &id) +bool is_java_string_literal_id(irep_idt id) { return id.starts_with(JAVA_STRING_LITERAL_PREFIX); } @@ -356,7 +355,7 @@ void java_add_components_to_class( /// \param symbol_table: symbol table /// \return newly created symbol static auxiliary_symbolt declare_function( - const irep_idt &function_name, + irep_idt function_name, const mathematical_function_typet &type, symbol_table_baset &symbol_table) { @@ -382,7 +381,7 @@ static auxiliary_symbolt declare_function( /// \return a function application expression representing: /// `function_name(arguments)` exprt make_function_application( - const irep_idt &function_name, + irep_idt function_name, const exprt::operandst &arguments, const typet &range, symbol_table_baset &symbol_table) @@ -404,7 +403,7 @@ exprt make_function_application( /// Strip java:: prefix from given identifier /// \param to_strip: identifier from which the prefix is stripped /// \return the identifier without without java:: prefix -irep_idt strip_java_namespace_prefix(const irep_idt &to_strip) +irep_idt strip_java_namespace_prefix(irep_idt to_strip) { const std::string to_strip_str=id2string(to_strip); const std::string prefix="java::"; @@ -446,8 +445,8 @@ std::string pretty_print_java_type(const std::string &fqn_java_type) /// resolve_inherited_componentt::inherited_componentt otherwise. std::optional get_inherited_component( - const irep_idt &component_class_id, - const irep_idt &component_name, + irep_idt component_class_id, + irep_idt component_name, const symbol_table_baset &symbol_table, bool include_interfaces) { @@ -516,7 +515,7 @@ get_inherited_component( /// Check if a symbol is a well-known non-null global /// \param symbolid: symbol id to check /// \return true if this static field is known never to be null -bool is_non_null_library_global(const irep_idt &symbolid) +bool is_non_null_library_global(irep_idt symbolid) { static const irep_idt in = "java::java.lang.System.in"; static const irep_idt out = "java::java.lang.System.out"; @@ -556,7 +555,7 @@ symbolt &fresh_java_symbol( const typet &type, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table) { PRECONDITION(!function_name.empty()); @@ -571,7 +570,7 @@ std::optional declaring_class(const symbolt &symbol) return class_id.empty() ? std::optional{} : class_id; } -void set_declaring_class(symbolt &symbol, const irep_idt &declaring_class) +void set_declaring_class(symbolt &symbol, irep_idt declaring_class) { symbol.type.set(ID_C_class, declaring_class); } diff --git a/jbmc/src/java_bytecode/java_utils.h b/jbmc/src/java_bytecode/java_utils.h index 4deb6183cde..76533886a28 100644 --- a/jbmc/src/java_bytecode/java_utils.h +++ b/jbmc/src/java_bytecode/java_utils.h @@ -60,19 +60,18 @@ struct java_boxed_type_infot /// If \p type_name is a Java boxed type tag, return information about it, /// otherwise return null -const java_boxed_type_infot * -get_boxed_type_info_by_name(const irep_idt &type_name); +const java_boxed_type_infot *get_boxed_type_info_by_name(irep_idt type_name); /// Returns true iff the argument is the symbol-table identifier of a Java /// primitive wrapper type (for example, java::java.lang.Byte) -bool is_primitive_wrapper_type_id(const irep_idt &id); +bool is_primitive_wrapper_type_id(irep_idt id); /// Returns true iff the argument is the fully qualified name of a Java /// primitive wrapper type (for example, java.lang.Byte) bool is_primitive_wrapper_type_name(const std::string &type_name); void generate_class_stub( - const irep_idt &class_name, + irep_idt class_name, symbol_table_baset &symbol_table, message_handlert &message_handler, const struct_union_typet::componentst &componentst); @@ -104,7 +103,7 @@ void merge_source_location_rec( /// \param id: any string /// \return Returns true if 'id' identifies a string literal symbol -bool is_java_string_literal_id(const irep_idt &id); +bool is_java_string_literal_id(irep_idt id); /// Resolves a user-friendly method name (like packagename.Class.method) /// into an internal name (like java::packagename.Class.method:()V) @@ -144,23 +143,23 @@ size_t find_closing_delimiter( char close_char); exprt make_function_application( - const irep_idt &function_name, + irep_idt function_name, const exprt::operandst &arguments, const typet &range, symbol_table_baset &symbol_table); -irep_idt strip_java_namespace_prefix(const irep_idt &to_strip); +irep_idt strip_java_namespace_prefix(irep_idt to_strip); std::string pretty_print_java_type(const std::string &fqn_java_type); std::optional get_inherited_component( - const irep_idt &component_class_id, - const irep_idt &component_name, + irep_idt component_class_id, + irep_idt component_name, const symbol_table_baset &symbol_table, bool include_interfaces); -bool is_non_null_library_global(const irep_idt &); +bool is_non_null_library_global(irep_idt); extern const std::unordered_set cprover_methods_to_ignore; @@ -172,7 +171,7 @@ fresh_java_symbol( const typet &type, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table); /// Gets the identifier of the class which declared a given \p symbol. If the @@ -183,7 +182,7 @@ std::optional declaring_class(const symbolt &symbol); /// Sets the identifier of the class which declared a given \p symbol to \p /// declaring_class. -void set_declaring_class(symbolt &symbol, const irep_idt &declaring_class); +void set_declaring_class(symbolt &symbol, irep_idt declaring_class); /// Get JVM type name of the class in which \p method_name is defined. /// Returns an empty optional if the class name cannot be retrieved, diff --git a/jbmc/src/java_bytecode/lambda_synthesis.cpp b/jbmc/src/java_bytecode/lambda_synthesis.cpp index 8fa28b18159..0bf3b97d743 100644 --- a/jbmc/src/java_bytecode/lambda_synthesis.cpp +++ b/jbmc/src/java_bytecode/lambda_synthesis.cpp @@ -35,7 +35,7 @@ static std::string escape_symbol_special_chars(std::string input) } irep_idt lambda_synthetic_class_name( - const irep_idt &method_identifier, + irep_idt method_identifier, std::size_t instruction_address) { return "java::lambda_synthetic_class$" + @@ -76,7 +76,7 @@ get_lambda_method_handle( static std::optional lambda_method_handle( const symbol_table_baset &symbol_table, - const irep_idt &method_identifier, + irep_idt method_identifier, const java_method_typet &dynamic_method_type) { const namespacet ns{symbol_table}; @@ -132,7 +132,7 @@ typedef std::map< /// for example because both If1.f(int) and If2.f(int) are inherited here, only /// one is stored in the map, chosen arbitrarily. static const methods_by_name_and_descriptort -get_interface_methods(const irep_idt &interface_id, const namespacet &ns) +get_interface_methods(irep_idt interface_id, const namespacet &ns) { static const irep_idt jlo = "java::java.lang.Object"; // Terminate recursion at Object; any other base of an interface must @@ -204,7 +204,7 @@ get_interface_methods(const irep_idt &interface_id, const namespacet &ns) static const java_class_typet::methodt *try_get_unique_unimplemented_method( const symbol_table_baset &symbol_table, const struct_tag_typet &functional_interface_tag, - const irep_idt &method_identifier, + irep_idt method_identifier, const int instruction_address, const messaget &log) { @@ -248,7 +248,7 @@ static const java_class_typet::methodt *try_get_unique_unimplemented_method( } symbolt synthetic_class_symbol( - const irep_idt &synthetic_class_name, + irep_idt synthetic_class_name, const java_class_typet::java_lambda_method_handlet &lambda_method_handle, const struct_tag_typet &functional_interface_tag, const java_method_typet &dynamic_method_type) @@ -297,7 +297,7 @@ symbolt synthetic_class_symbol( static symbolt constructor_symbol( synthetic_methods_mapt &synthetic_methods, - const irep_idt &synthetic_class_name, + irep_idt synthetic_class_name, java_method_typet constructor_type) // dynamic_method_type { irep_idt constructor_name = id2string(synthetic_class_name) + "."; @@ -337,7 +337,7 @@ static symbolt constructor_symbol( static symbolt implemented_method_symbol( synthetic_methods_mapt &synthetic_methods, const java_class_typet::methodt &method_to_implement, - const irep_idt &synthetic_class_name) + irep_idt synthetic_class_name) { const std::string implemented_method_name = id2string(synthetic_class_name) + "." + @@ -393,7 +393,7 @@ static symbolt implemented_method_symbol( // invoke instruction will return null when eventually converted by // java_bytecode_convert_method. void create_invokedynamic_synthetic_classes( - const irep_idt &method_identifier, + irep_idt method_identifier, const java_bytecode_parse_treet::methodt::instructionst &instructions, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, @@ -449,11 +449,11 @@ void create_invokedynamic_synthetic_classes( #endif static const symbolt & get_or_create_method_symbol( - const irep_idt &identifier, - const irep_idt &base_name, - const irep_idt &pretty_name, + irep_idt identifier, + irep_idt base_name, + irep_idt pretty_name, const typet &type, - const irep_idt &declaring_class, + irep_idt declaring_class, symbol_table_baset &symbol_table, message_handlert &log) { @@ -473,7 +473,7 @@ get_or_create_method_symbol( } codet invokedynamic_synthetic_constructor( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -539,8 +539,8 @@ codet invokedynamic_synthetic_constructor( } static symbol_exprt create_and_declare_local( - const irep_idt &function_id, - const irep_idt &basename, + irep_idt function_id, + irep_idt basename, const typet &type, symbol_table_baset &symbol_table, code_blockt &method) @@ -570,7 +570,7 @@ static symbol_exprt create_and_declare_local( /// \param result: will gain instructions instantiating the required type /// \return the newly instantiated symbol static symbol_exprt instantiate_new_object( - const irep_idt &function_id, + irep_idt function_id, const symbolt &lambda_method_symbol, symbol_table_baset &symbol_table, code_blockt &result) @@ -686,7 +686,7 @@ exprt box_or_unbox_type_if_necessary( const typet &required_type, code_blockt &code_block, symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, const std::string &role) { const typet &original_type = expr.type(); @@ -745,7 +745,7 @@ exprt adjust_type_if_necessary( const typet &required_type, code_blockt &code_block, symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, const std::string &role) { return typecast_exprt::conditional_cast( @@ -771,7 +771,7 @@ exprt adjust_type_if_necessary( /// \param message_handler: log /// \return the method body for `function_id` codet invokedynamic_synthetic_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { diff --git a/jbmc/src/java_bytecode/lambda_synthesis.h b/jbmc/src/java_bytecode/lambda_synthesis.h index df8d9d61c35..fd54e1fff18 100644 --- a/jbmc/src/java_bytecode/lambda_synthesis.h +++ b/jbmc/src/java_bytecode/lambda_synthesis.h @@ -21,11 +21,11 @@ class codet; class symbol_table_baset; irep_idt lambda_synthetic_class_name( - const irep_idt &method_identifier, + irep_idt method_identifier, std::size_t instruction_address); void create_invokedynamic_synthetic_classes( - const irep_idt &method_identifier, + irep_idt method_identifier, const java_bytecode_parse_treet::methodt::instructionst &instructions, symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, @@ -33,13 +33,13 @@ void create_invokedynamic_synthetic_classes( /// Create invokedynamic synthetic constructor codet invokedynamic_synthetic_constructor( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); /// Create invokedynamic synthetic method codet invokedynamic_synthetic_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler); diff --git a/jbmc/src/java_bytecode/lazy_goto_functions_map.h b/jbmc/src/java_bytecode/lazy_goto_functions_map.h index 4d7e2dcd641..f3dacfa9abd 100644 --- a/jbmc/src/java_bytecode/lazy_goto_functions_map.h +++ b/jbmc/src/java_bytecode/lazy_goto_functions_map.h @@ -51,13 +51,13 @@ class lazy_goto_functions_mapt final typedef std::size_t size_type; typedef std::function post_process_functiont; - typedef std::function can_generate_function_bodyt; + typedef std::function can_generate_function_bodyt; typedef std::function @@ -103,7 +103,7 @@ class lazy_goto_functions_mapt final /// Gets the body for a given function. /// \param name: The name of the function to search for. /// \return The function body corresponding to the given function. - const_mapped_type at(const key_type &name) const + const_mapped_type at(key_type name) const { return ensure_function_loaded_internal(name).second; } @@ -111,7 +111,7 @@ class lazy_goto_functions_mapt final /// Gets the body for a given function. /// \param name: The name of the function to search for. /// \return The function body corresponding to the given function. - mapped_type at(const key_type &name) + mapped_type at(key_type name) { return ensure_function_loaded_internal(name).second; } @@ -121,7 +121,7 @@ class lazy_goto_functions_mapt final /// \param name: function ID to query /// \return true if we can produce a function body, or false if we would leave /// it a bodyless stub. - bool can_produce_function(const key_type &name) const + bool can_produce_function(key_type name) const { return language_files.can_convert_lazy_method(name) || driver_program_can_generate_function_body(name); @@ -130,12 +130,12 @@ class lazy_goto_functions_mapt final /// Remove the function named \p name from the function map, if it exists. /// \return Returns 0 when \p name was not present, and 1 when \p name was /// removed. - std::size_t unload(const key_type &name) const + std::size_t unload(key_type name) const { return goto_functions.erase(name); } - void ensure_function_loaded(const key_type &name) const + void ensure_function_loaded(key_type name) const { ensure_function_loaded_internal(name); } @@ -144,7 +144,7 @@ class lazy_goto_functions_mapt final // This returns a non-const reference, but if you use this method from a // const method then you should not return such a reference without making it // const first - reference ensure_function_loaded_internal(const key_type &name) const + reference ensure_function_loaded_internal(key_type name) const { symbol_table_buildert symbol_table_builder = symbol_table_buildert::wrap(symbol_table); @@ -173,7 +173,7 @@ class lazy_goto_functions_mapt final /// this so that our callers can insert a journalling table here if needed. /// \return reference to the new or existing goto_functions map entry. reference ensure_entry_converted( - const key_type &name, + key_type name, symbol_table_baset &function_symbol_table) const { // Fill in symbol table entry body if not already done diff --git a/jbmc/src/java_bytecode/lazy_goto_model.cpp b/jbmc/src/java_bytecode/lazy_goto_model.cpp index 0b49f17ddb2..bea48e4a84a 100644 --- a/jbmc/src/java_bytecode/lazy_goto_model.cpp +++ b/jbmc/src/java_bytecode/lazy_goto_model.cpp @@ -36,9 +36,10 @@ lazy_goto_modelt::lazy_goto_modelt( language_files, symbol_table, [this]( - const irep_idt &function_name, + irep_idt function_name, goto_functionst::goto_functiont &function, - journalling_symbol_tablet &journalling_symbol_table) -> void { + journalling_symbol_tablet &journalling_symbol_table) -> void + { goto_model_functiont model_function( journalling_symbol_table, goto_model->goto_functions, @@ -67,9 +68,10 @@ lazy_goto_modelt::lazy_goto_modelt(lazy_goto_modelt &&other) language_files, symbol_table, [this]( - const irep_idt &function_name, + irep_idt function_name, goto_functionst::goto_functiont &function, - journalling_symbol_tablet &journalling_symbol_table) -> void { + journalling_symbol_tablet &journalling_symbol_table) -> void + { goto_model_functiont model_function( journalling_symbol_table, goto_model->goto_functions, @@ -170,7 +172,7 @@ void lazy_goto_modelt::initialize( set_up_custom_entry_point( language_files, symbol_table, - [this](const irep_idt &id) { return goto_functions.unload(id); }, + [this](irep_idt id) { return goto_functions.unload(id); }, options, false, message_handler); @@ -234,7 +236,7 @@ bool lazy_goto_modelt::finalize() return post_process_functions(*goto_model); } -bool lazy_goto_modelt::can_produce_function(const irep_idt &id) const +bool lazy_goto_modelt::can_produce_function(irep_idt id) const { return goto_functions.can_produce_function(id); } diff --git a/jbmc/src/java_bytecode/lazy_goto_model.h b/jbmc/src/java_bytecode/lazy_goto_model.h index 55cc4c0c584..7ae07425d78 100644 --- a/jbmc/src/java_bytecode/lazy_goto_model.h +++ b/jbmc/src/java_bytecode/lazy_goto_model.h @@ -156,20 +156,18 @@ class lazy_goto_modelt : public abstract_goto_modelt { return lazy_goto_modelt( [&handler, - &options](goto_model_functiont &fun, const abstract_goto_modelt &model) { - handler.process_goto_function(fun, model, options); - }, - [&handler, &options](goto_modelt &goto_model) -> bool { - return handler.process_goto_functions(goto_model, options); - }, - [&handler](const irep_idt &name) -> bool { - return handler.can_generate_function_body(name); - }, + &options](goto_model_functiont &fun, const abstract_goto_modelt &model) + { handler.process_goto_function(fun, model, options); }, + [&handler, &options](goto_modelt &goto_model) -> bool + { return handler.process_goto_functions(goto_model, options); }, + [&handler](irep_idt name) -> bool + { return handler.can_generate_function_body(name); }, [&handler]( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, goto_functiont &function, - bool is_first_chance) { + bool is_first_chance) + { return handler.generate_function_body( function_name, symbol_table, function, is_first_chance); }, @@ -217,7 +215,7 @@ class lazy_goto_modelt : public abstract_goto_modelt return symbol_table; } - bool can_produce_function(const irep_idt &id) const override; + bool can_produce_function(irep_idt id) const override; /// Get a GOTO function body. `id` must be a valid symbol-table symbol. Its /// body is produced by: @@ -233,8 +231,7 @@ class lazy_goto_modelt : public abstract_goto_modelt /// `languaget::convert_lazy_method` function. If that results in a `codet` /// representation of the function stored in the symbol table, convert it /// to GOTO and return it as in step (3). - const goto_functionst::goto_functiont & - get_goto_function(const irep_idt &id) override + const goto_functionst::goto_functiont &get_goto_function(irep_idt id) override { return goto_functions.at(id); } diff --git a/jbmc/src/java_bytecode/nondet.cpp b/jbmc/src/java_bytecode/nondet.cpp index e07ff81f441..41f6e0d1035 100644 --- a/jbmc/src/java_bytecode/nondet.cpp +++ b/jbmc/src/java_bytecode/nondet.cpp @@ -89,10 +89,10 @@ symbol_exprt generate_nondet_int( } code_blockt generate_nondet_switch( - const irep_idt &name_prefix, + irep_idt name_prefix, const alternate_casest &switch_cases, const typet &int_type, - const irep_idt &mode, + irep_idt mode, const source_locationt &source_location, symbol_table_baset &symbol_table) { diff --git a/jbmc/src/java_bytecode/nondet.h b/jbmc/src/java_bytecode/nondet.h index 3a6e4b3e100..95de8064bc1 100644 --- a/jbmc/src/java_bytecode/nondet.h +++ b/jbmc/src/java_bytecode/nondet.h @@ -93,10 +93,10 @@ typedef std::vector alternate_casest; /// \return Returns a nondet-switch choosing between switch_cases. The resulting /// switch block has no default case. code_blockt generate_nondet_switch( - const irep_idt &name_prefix, + irep_idt name_prefix, const alternate_casest &switch_cases, const typet &int_type, - const irep_idt &mode, + irep_idt mode, const source_locationt &source_location, symbol_table_baset &symbol_table); diff --git a/jbmc/src/java_bytecode/remove_exceptions.cpp b/jbmc/src/java_bytecode/remove_exceptions.cpp index 0153aeb0d00..6327dfb2158 100644 --- a/jbmc/src/java_bytecode/remove_exceptions.cpp +++ b/jbmc/src/java_bytecode/remove_exceptions.cpp @@ -85,7 +85,7 @@ class remove_exceptionst typedef std::vector stack_catcht; public: - typedef std::function function_may_throwt; + typedef std::function function_may_throwt; explicit remove_exceptionst( symbol_table_baset &_symbol_table, @@ -109,8 +109,7 @@ class remove_exceptionst } void operator()(goto_functionst &goto_functions); - void - operator()(const irep_idt &function_identifier, goto_programt &goto_program); + void operator()(irep_idt function_identifier, goto_programt &goto_program); protected: symbol_table_baset &symbol_table; @@ -142,28 +141,28 @@ class remove_exceptionst std::size_t &universal_catch); void add_exception_dispatch_sequence( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &instr_it, const stack_catcht &stack_catch, const std::vector &locals); bool instrument_throw( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &, const stack_catcht &, const std::vector &); instrumentation_resultt instrument_function_call( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &, const stack_catcht &, const std::vector &); void instrument_exceptions( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program); }; @@ -318,7 +317,7 @@ goto_programt::targett remove_exceptionst::find_universal_exception( /// \param stack_catch: exception handlers currently registered /// \param locals: local variables to kill on a function-exit edge void remove_exceptionst::add_exception_dispatch_sequence( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &instr_it, const remove_exceptionst::stack_catcht &stack_catch, @@ -394,7 +393,7 @@ void remove_exceptionst::add_exception_dispatch_sequence( /// instruments each throw with conditional GOTOS to the corresponding /// exception handlers bool remove_exceptionst::instrument_throw( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &instr_it, const remove_exceptionst::stack_catcht &stack_catch, @@ -425,7 +424,7 @@ bool remove_exceptionst::instrument_throw( /// GOTOS to the corresponding exception handlers remove_exceptionst::instrumentation_resultt remove_exceptionst::instrument_function_call( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, const goto_programt::targett &instr_it, const stack_catcht &stack_catch, @@ -483,7 +482,7 @@ remove_exceptionst::instrument_function_call( /// handlers. Additionally, it re-computes the live-range of local variables in /// order to add DEAD instructions. void remove_exceptionst::instrument_exceptions( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program) { stack_catcht stack_catch; // stack of try-catch blocks @@ -613,8 +612,9 @@ void remove_exceptionst::operator()(goto_functionst &goto_functions) instrument_exceptions(gf_entry.first, gf_entry.second.body); } -void remove_exceptionst:: -operator()(const irep_idt &function_identifier, goto_programt &goto_program) +void remove_exceptionst::operator()( + irep_idt function_identifier, + goto_programt &goto_program) { instrument_exceptions(function_identifier, goto_program); } @@ -631,9 +631,7 @@ void remove_exceptions_using_instanceof( uncaught_exceptions(goto_functions, ns, exceptions_map); remove_exceptionst::function_may_throwt function_may_throw = - [&exceptions_map](const irep_idt &id) { - return !exceptions_map[id].empty(); - }; + [&exceptions_map](irep_idt id) { return !exceptions_map[id].empty(); }; remove_exceptionst remove_exceptions( symbol_table, nullptr, function_may_throw, false, message_handler); @@ -654,13 +652,13 @@ void remove_exceptions_using_instanceof( /// the caller's responsibility. /// \param message_handler: logging output void remove_exceptions_using_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, symbol_table_baset &symbol_table, message_handlert &message_handler) { - remove_exceptionst::function_may_throwt any_function_may_throw = - [](const irep_idt &) { return true; }; + remove_exceptionst::function_may_throwt any_function_may_throw = [](irep_idt) + { return true; }; remove_exceptionst remove_exceptions( symbol_table, nullptr, any_function_may_throw, false, message_handler); @@ -696,9 +694,7 @@ void remove_exceptions( uncaught_exceptions(goto_functions, ns, exceptions_map); remove_exceptionst::function_may_throwt function_may_throw = - [&exceptions_map](const irep_idt &id) { - return !exceptions_map[id].empty(); - }; + [&exceptions_map](irep_idt id) { return !exceptions_map[id].empty(); }; remove_exceptionst remove_exceptions( symbol_table, &class_hierarchy, function_may_throw, true, message_handler); @@ -721,14 +717,14 @@ void remove_exceptions( /// Only needed if type == REMOVE_ADDED_INSTANCEOF; otherwise may be null. /// \param message_handler: logging output void remove_exceptions( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, symbol_table_baset &symbol_table, const class_hierarchyt &class_hierarchy, message_handlert &message_handler) { - remove_exceptionst::function_may_throwt any_function_may_throw = - [](const irep_idt &) { return true; }; + remove_exceptionst::function_may_throwt any_function_may_throw = [](irep_idt) + { return true; }; remove_exceptionst remove_exceptions( symbol_table, diff --git a/jbmc/src/java_bytecode/remove_exceptions.h b/jbmc/src/java_bytecode/remove_exceptions.h index bdbb2153eac..39351d596f7 100644 --- a/jbmc/src/java_bytecode/remove_exceptions.h +++ b/jbmc/src/java_bytecode/remove_exceptions.h @@ -30,7 +30,7 @@ class symbol_table_baset; /// and adds the required instrumentation (GOTOs and assignments) /// This introduces instanceof expressions. void remove_exceptions_using_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &, symbol_table_baset &, message_handlert &); @@ -44,7 +44,7 @@ void remove_exceptions_using_instanceof(goto_modelt &, message_handlert &); /// and adds the required instrumentation (GOTOs and assignments) /// This does not introduce instanceof expressions. void remove_exceptions( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &, symbol_table_baset &, const class_hierarchyt &, diff --git a/jbmc/src/java_bytecode/remove_instanceof.cpp b/jbmc/src/java_bytecode/remove_instanceof.cpp index 1671b416cc9..a0930aa3e92 100644 --- a/jbmc/src/java_bytecode/remove_instanceof.cpp +++ b/jbmc/src/java_bytecode/remove_instanceof.cpp @@ -34,11 +34,11 @@ class remove_instanceoft } // Lower instanceof for a single function - bool lower_instanceof(const irep_idt &function_identifier, goto_programt &); + bool lower_instanceof(irep_idt function_identifier, goto_programt &); // Lower instanceof for a single instruction bool lower_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &, goto_programt::targett); @@ -49,7 +49,7 @@ class remove_instanceoft message_handlert &message_handler; bool lower_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, exprt &, goto_programt &, goto_programt::targett); @@ -66,7 +66,7 @@ class remove_instanceoft /// \return disjunction of the possible matched subtypes static exprt subtype_expr( const exprt &classid_field, - const irep_idt &target_type, + irep_idt target_type, const class_hierarchyt &class_hierarchy) { std::vector children = @@ -75,9 +75,9 @@ static exprt subtype_expr( // Sort alphabetically to make order of generated disjuncts // independent of class loading order std::sort( - children.begin(), children.end(), [](const irep_idt &a, const irep_idt &b) { - return a.compare(b) < 0; - }); + children.begin(), + children.end(), + [](irep_idt a, irep_idt b) { return a.compare(b) < 0; }); exprt::operandst or_ops; for(const auto &class_name : children) @@ -99,7 +99,7 @@ static exprt subtype_expr( /// \param this_inst: instruction the expression is found at /// \return true if any instanceof instructionw was replaced bool remove_instanceoft::lower_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, exprt &expr, goto_programt &goto_program, goto_programt::targett this_inst) @@ -237,7 +237,7 @@ static bool contains_instanceof(const exprt &e) /// \param target: instruction to check for instanceof expressions /// \return true if an instanceof has been replaced bool remove_instanceoft::lower_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, goto_programt::targett target) { @@ -276,7 +276,7 @@ bool remove_instanceoft::lower_instanceof( /// \param goto_program: The function body to work on. /// \return true if one or more instanceof expressions have been replaced bool remove_instanceoft::lower_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program) { bool changed=false; @@ -304,7 +304,7 @@ bool remove_instanceoft::lower_instanceof( /// \param class_hierarchy: class hierarchy analysis of symbol_table /// \param message_handler: logging output void remove_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt::targett target, goto_programt &goto_program, symbol_table_baset &symbol_table, @@ -324,7 +324,7 @@ void remove_instanceof( /// \param class_hierarchy: class hierarchy analysis of symbol_table /// \param message_handler: logging output void remove_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &function, symbol_table_baset &symbol_table, const class_hierarchyt &class_hierarchy, diff --git a/jbmc/src/java_bytecode/remove_instanceof.h b/jbmc/src/java_bytecode/remove_instanceof.h index 245d67db4fb..1cf0acd4da3 100644 --- a/jbmc/src/java_bytecode/remove_instanceof.h +++ b/jbmc/src/java_bytecode/remove_instanceof.h @@ -87,7 +87,7 @@ class message_handlert; class symbol_table_baset; void remove_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt::targett target, goto_programt &goto_program, symbol_table_baset &symbol_table, @@ -95,7 +95,7 @@ void remove_instanceof( message_handlert &); void remove_instanceof( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &function, symbol_table_baset &symbol_table, const class_hierarchyt &class_hierarchy, diff --git a/jbmc/src/java_bytecode/remove_java_new.cpp b/jbmc/src/java_bytecode/remove_java_new.cpp index 283be05498e..f2cc59893a8 100644 --- a/jbmc/src/java_bytecode/remove_java_new.cpp +++ b/jbmc/src/java_bytecode/remove_java_new.cpp @@ -36,13 +36,13 @@ class remove_java_newt // Lower java_new for a single function bool lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &, message_handlert &); // Lower java_new for a single instruction goto_programt::targett lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &, goto_programt::targett, message_handlert &); @@ -52,14 +52,14 @@ class remove_java_newt namespacet ns; goto_programt::targett lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, const exprt &lhs, const side_effect_exprt &rhs, goto_programt &, goto_programt::targett); goto_programt::targett lower_java_new_array( - const irep_idt &function_identifier, + irep_idt function_identifier, const exprt &lhs, const side_effect_exprt &rhs, goto_programt &, @@ -80,7 +80,7 @@ class remove_java_newt /// Note: we have to take a copy of `lhs` and `rhs` since they would suffer /// destruction when replacing the instruction. goto_programt::targett remove_java_newt::lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest, @@ -130,7 +130,7 @@ goto_programt::targett remove_java_newt::lower_java_new( /// Note: we have to take a copy of `lhs` and `rhs` since they would suffer /// destruction when replacing the instruction. goto_programt::targett remove_java_newt::lower_java_new_array( - const irep_idt &function_identifier, + irep_idt function_identifier, const exprt &lhs, const side_effect_exprt &rhs, goto_programt &dest, @@ -360,7 +360,7 @@ goto_programt::targett remove_java_newt::lower_java_new_array( /// \param message_handler: message handler /// \return true if a replacement has been made goto_programt::targett remove_java_newt::lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, goto_programt::targett target, message_handlert &message_handler) @@ -406,7 +406,7 @@ goto_programt::targett remove_java_newt::lower_java_new( /// \param message_handler: message handler /// \return true if one or more java_new expressions have been replaced bool remove_java_newt::lower_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program, message_handlert &message_handler) { @@ -436,7 +436,7 @@ bool remove_java_newt::lower_java_new( /// \param symbol_table: The symbol table to add symbols to. /// \param message_handler: a message handler void remove_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt::targett target, goto_programt &goto_program, symbol_table_baset &symbol_table, @@ -455,7 +455,7 @@ void remove_java_new( /// \param symbol_table: The symbol table to add symbols to. /// \param message_handler: a message handler void remove_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &function, symbol_table_baset &symbol_table, message_handlert &message_handler) diff --git a/jbmc/src/java_bytecode/remove_java_new.h b/jbmc/src/java_bytecode/remove_java_new.h index 4ed497a92c0..ea0709fd8f1 100644 --- a/jbmc/src/java_bytecode/remove_java_new.h +++ b/jbmc/src/java_bytecode/remove_java_new.h @@ -19,14 +19,14 @@ class message_handlert; class symbol_table_baset; void remove_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt::targett target, goto_programt &goto_program, symbol_table_baset &symbol_table, message_handlert &_message_handler); void remove_java_new( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &function, symbol_table_baset &symbol_table, message_handlert &_message_handler); diff --git a/jbmc/src/java_bytecode/replace_java_nondet.cpp b/jbmc/src/java_bytecode/replace_java_nondet.cpp index 5615983aa24..81befc7e917 100644 --- a/jbmc/src/java_bytecode/replace_java_nondet.cpp +++ b/jbmc/src/java_bytecode/replace_java_nondet.cpp @@ -105,7 +105,7 @@ get_nondet_instruction_info(const goto_programt::const_targett &instr) /// \param expr: The expression which may be a symbol. /// \param identifier: Some identifier. /// \return True if the expression is a symbol with the specified identifier. -static bool is_symbol_with_id(const exprt &expr, const irep_idt &identifier) +static bool is_symbol_with_id(const exprt &expr, irep_idt identifier) { return expr.id() == ID_symbol && to_symbol_expr(expr).identifier() == identifier; @@ -116,7 +116,7 @@ static bool is_symbol_with_id(const exprt &expr, const irep_idt &identifier) /// \param identifier: Some identifier. /// \return True if the expression is a typecast with one operand, and the /// typecast's identifier matches the specified identifier. -static bool is_typecast_with_id(const exprt &expr, const irep_idt &identifier) +static bool is_typecast_with_id(const exprt &expr, irep_idt identifier) { if(!(expr.id() == ID_typecast && expr.operands().size() == 1)) { @@ -140,7 +140,7 @@ static bool is_typecast_with_id(const exprt &expr, const irep_idt &identifier) /// typecast's identifier matches the specified identifier. static bool is_assignment_from( const goto_programt::instructiont &instr, - const irep_idt &identifier) + irep_idt identifier) { // If not an assignment, return false if(!instr.is_assign()) @@ -160,7 +160,7 @@ static bool is_assignment_from( /// typecast's identifier matches the specified identifier. static bool is_return_with_variable( const goto_programt::instructiont &instr, - const irep_idt &identifier) + irep_idt identifier) { if(!instr.is_set_return_value()) { diff --git a/jbmc/src/java_bytecode/select_pointer_type.cpp b/jbmc/src/java_bytecode/select_pointer_type.cpp index c6bceb4fd72..93b0148e0ee 100644 --- a/jbmc/src/java_bytecode/select_pointer_type.cpp +++ b/jbmc/src/java_bytecode/select_pointer_type.cpp @@ -82,8 +82,8 @@ pointer_typet select_pointer_typet::specialize_generics( std::set select_pointer_typet::get_parameter_alternative_types( - const irep_idt &, - const irep_idt &, + irep_idt, + irep_idt, const namespacet &) const { return {}; diff --git a/jbmc/src/java_bytecode/select_pointer_type.h b/jbmc/src/java_bytecode/select_pointer_type.h index b9ade58821f..fbd10bb0be3 100644 --- a/jbmc/src/java_bytecode/select_pointer_type.h +++ b/jbmc/src/java_bytecode/select_pointer_type.h @@ -44,8 +44,8 @@ class select_pointer_typet /// Derived classes can override this behaviour to provide more /// sophisticated alternative type identification. virtual std::set get_parameter_alternative_types( - const irep_idt &function_name, - const irep_idt ¶meter_name, + irep_idt function_name, + irep_idt parameter_name, const namespacet &ns) const; /// Specialize generic parameters in a pointer type based on the current map diff --git a/jbmc/src/java_bytecode/simple_method_stubbing.cpp b/jbmc/src/java_bytecode/simple_method_stubbing.cpp index bdcc51908f8..521af93702d 100644 --- a/jbmc/src/java_bytecode/simple_method_stubbing.cpp +++ b/jbmc/src/java_bytecode/simple_method_stubbing.cpp @@ -41,7 +41,7 @@ class java_simple_method_stubst const typet &expected_type, const exprt &ptr, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &parent_block, unsigned insert_before_index, bool is_constructor, @@ -49,7 +49,7 @@ class java_simple_method_stubst void create_method_stub(symbolt &symbol); - void check_method_stub(const irep_idt &); + void check_method_stub(irep_idt); protected: symbol_table_baset &symbol_table; @@ -82,7 +82,7 @@ void java_simple_method_stubst::create_method_stub_at( const typet &expected_type, const exprt &ptr, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, code_blockt &parent_block, const unsigned insert_before_index, const bool is_constructor, @@ -250,7 +250,7 @@ void java_simple_method_stubst::create_method_stub(symbolt &symbol) /// Replaces `sym` with a function stub per the function above if it is /// of suitable type. /// \param symname: Symbol name to consider stubbing -void java_simple_method_stubst::check_method_stub(const irep_idt &symname) +void java_simple_method_stubst::check_method_stub(irep_idt symname) { const symbolt &sym = symbol_table.lookup_ref(symname); if(!sym.is_type && sym.value.id() == ID_nil && @@ -270,7 +270,7 @@ void java_simple_method_stubst::check_method_stub(const irep_idt &symname) } void java_generate_simple_method_stub( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, bool assume_non_null, const java_object_factory_parameterst &object_factory_parameters, diff --git a/jbmc/src/java_bytecode/simple_method_stubbing.h b/jbmc/src/java_bytecode/simple_method_stubbing.h index 165d26835e7..5b4cb9d4b2b 100644 --- a/jbmc/src/java_bytecode/simple_method_stubbing.h +++ b/jbmc/src/java_bytecode/simple_method_stubbing.h @@ -19,7 +19,7 @@ struct java_object_factory_parameterst; class symbol_table_baset; void java_generate_simple_method_stub( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, bool assume_non_null, const java_object_factory_parameterst &object_factory_parameters, diff --git a/jbmc/src/jbmc/jbmc_parse_options.cpp b/jbmc/src/jbmc/jbmc_parse_options.cpp index 7ed4105af63..033c28e8f84 100644 --- a/jbmc/src/jbmc/jbmc_parse_options.cpp +++ b/jbmc/src/jbmc/jbmc_parse_options.cpp @@ -697,7 +697,8 @@ void jbmc_parse_optionst::process_goto_function( // Java virtual functions -> explicit dispatch tables: remove_virtual_functions(function, *class_hierarchy); - auto function_is_stub = [&symbol_table, &model](const irep_idt &id) { + auto function_is_stub = [&symbol_table, &model](irep_idt id) + { return symbol_table.lookup_ref(id).value.is_nil() && !model.can_produce_function(id); }; @@ -915,7 +916,7 @@ bool jbmc_parse_optionst::process_goto_functions( return false; } -bool jbmc_parse_optionst::can_generate_function_body(const irep_idt &name) +bool jbmc_parse_optionst::can_generate_function_body(irep_idt name) { static const irep_idt initialize_id = INITIALIZE_FUNCTION; @@ -923,7 +924,7 @@ bool jbmc_parse_optionst::can_generate_function_body(const irep_idt &name) } bool jbmc_parse_optionst::generate_function_body( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, goto_functiont &function, bool body_available) diff --git a/jbmc/src/jbmc/jbmc_parse_options.h b/jbmc/src/jbmc/jbmc_parse_options.h index 80a11dc1b52..faa68779789 100644 --- a/jbmc/src/jbmc/jbmc_parse_options.h +++ b/jbmc/src/jbmc/jbmc_parse_options.h @@ -111,10 +111,10 @@ class jbmc_parse_optionst : public parse_options_baset const optionst &); bool process_goto_functions(goto_modelt &goto_model, const optionst &options); - bool can_generate_function_body(const irep_idt &name); + bool can_generate_function_body(irep_idt name); bool generate_function_body( - const irep_idt &function_name, + irep_idt function_name, symbol_table_baset &symbol_table, goto_functiont &function, bool body_available); diff --git a/jbmc/unit/java-testing-utils/load_java_class.cpp b/jbmc/unit/java-testing-utils/load_java_class.cpp index 54617050f2c..6d7e4e157f9 100644 --- a/jbmc/unit/java-testing-utils/load_java_class.cpp +++ b/jbmc/unit/java-testing-utils/load_java_class.cpp @@ -99,10 +99,9 @@ goto_modelt load_goto_model_from_java_class( lazy_goto_modelt lazy_goto_model( [](goto_model_functiont &, const abstract_goto_modelt &) {}, [](goto_modelt &) { return false; }, - [](const irep_idt &) { return false; }, - [](const irep_idt &, symbol_table_baset &, goto_functiont &, bool) { - return false; - }, + [](irep_idt) { return false; }, + [](irep_idt, symbol_table_baset &, goto_functiont &, bool) + { return false; }, null_message_handler); // Configure the path loading diff --git a/jbmc/unit/java-testing-utils/require_goto_statements.cpp b/jbmc/unit/java-testing-utils/require_goto_statements.cpp index f95bbcff992..230e919e896 100644 --- a/jbmc/unit/java-testing-utils/require_goto_statements.cpp +++ b/jbmc/unit/java-testing-utils/require_goto_statements.cpp @@ -70,9 +70,9 @@ require_goto_statements::require_entry_point_statements( require_goto_statements::pointer_assignment_locationt require_goto_statements::find_struct_component_assignments( const std::vector &statements, - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &component_name, + irep_idt component_name, const symbol_table_baset &symbol_table) { pointer_assignment_locationt locations{}; @@ -167,7 +167,7 @@ require_goto_statements::find_struct_component_assignments( require_goto_statements::pointer_assignment_locationt require_goto_statements::find_this_component_assignment( const std::vector &statements, - const irep_idt &component_name) + irep_idt component_name) { pointer_assignment_locationt locations; @@ -217,7 +217,7 @@ require_goto_statements::find_this_component_assignment( /// vector of all other assignments require_goto_statements::pointer_assignment_locationt require_goto_statements::find_pointer_assignments( - const irep_idt &pointer_name, + irep_idt pointer_name, const std::vector &instructions) { INFO("Looking for symbol: " << pointer_name); @@ -283,7 +283,7 @@ require_goto_statements::find_pointer_assignments( /// \throws no_decl_found_exceptiont if no declaration of the specific /// variable is found const code_declt &require_goto_statements::require_declaration_of_name( - const irep_idt &variable_name, + irep_idt variable_name, const std::vector &entry_point_instructions) { for(const auto &statement : entry_point_instructions) @@ -308,7 +308,7 @@ const code_declt &require_goto_statements::require_declaration_of_name( /// \return The unique non-null expression assigned to the symbol const exprt &get_unique_non_null_expression_assigned_to_symbol( const std::vector &entry_point_instructions, - const irep_idt &symbol_identifier) + irep_idt symbol_identifier) { const auto &assignments = require_goto_statements::find_pointer_assignments( symbol_identifier, entry_point_instructions) @@ -327,9 +327,9 @@ const exprt &get_unique_non_null_expression_assigned_to_symbol( /// pointer if no symbols are assigned to it const symbol_exprt *try_get_unique_symbol_assigned_to_symbol( const std::vector &entry_point_instructions, - const irep_idt &symbol_identifier) + irep_idt symbol_identifier) { - const auto &expr = get_unique_non_null_expression_assigned_to_symbol( + const auto expr = get_unique_non_null_expression_assigned_to_symbol( entry_point_instructions, symbol_identifier); return expr_try_dynamic_cast(skip_typecast(expr)); @@ -349,10 +349,9 @@ const symbol_exprt *try_get_unique_symbol_assigned_to_symbol( /// \return The identifier of the symbol which is (possibly indirectly) assigned /// to \p input_symbol_identifier and which does not have any symbol assigned /// to it -static const irep_idt & -get_ultimate_source_symbol( +static irep_idt get_ultimate_source_symbol( const std::vector &entry_point_instructions, - const irep_idt &input_symbol_identifier) + irep_idt input_symbol_identifier) { const symbol_exprt *symbol_assigned_to_input_symbol = try_get_unique_symbol_assigned_to_symbol( @@ -382,10 +381,10 @@ get_ultimate_source_symbol( /// which will be used for future calls to /// `require_struct_component_assignment`. irep_idt require_goto_statements::require_struct_component_assignment( - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &component_name, - const irep_idt &component_type_name, + irep_idt component_name, + irep_idt component_type_name, const std::optional &typecast_name, const std::vector &entry_point_instructions, const symbol_table_baset &symbol_table) @@ -420,7 +419,7 @@ irep_idt require_goto_statements::require_struct_component_assignment( // right hand side, then we want to identify that the type // is the one we expect, e.g.: // struct java.lang.Integer *malloc_site$0; - const auto &component_declaration = + const auto component_declaration = require_goto_statements::require_declaration_of_name( symbol_identifier, entry_point_instructions); const typet &component_type = @@ -444,10 +443,10 @@ irep_idt require_goto_statements::require_struct_component_assignment( /// \return The identifier of the variable assigned to the field const irep_idt & require_goto_statements::require_struct_array_component_assignment( - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &array_component_name, - const irep_idt &array_type_name, + irep_idt array_component_name, + irep_idt array_type_name, const std::vector &entry_point_instructions, const symbol_table_baset &symbol_table) { @@ -515,7 +514,7 @@ require_goto_statements::require_struct_array_component_assignment( /// \param entry_point_statements: The statements to look through /// \return The identifier of the variable assigned to the input argument irep_idt require_goto_statements::require_entry_point_argument_assignment( - const irep_idt &argument_name, + irep_idt argument_name, const std::vector &entry_point_statements) { // Trace the creation of the object that is being supplied as the input @@ -548,7 +547,7 @@ irep_idt require_goto_statements::require_entry_point_argument_assignment( /// \return All calls to the matching function inside the statements std::vector require_goto_statements::find_function_calls( const std::vector &statements, - const irep_idt &function_call_identifier) + irep_idt function_call_identifier) { std::vector function_calls; for(const codet &statement : statements) diff --git a/jbmc/unit/java-testing-utils/require_goto_statements.h b/jbmc/unit/java-testing-utils/require_goto_statements.h index 991286e7c2a..c58f855c156 100644 --- a/jbmc/unit/java-testing-utils/require_goto_statements.h +++ b/jbmc/unit/java-testing-utils/require_goto_statements.h @@ -46,14 +46,14 @@ class no_decl_found_exceptiont : public std::exception pointer_assignment_locationt find_struct_component_assignments( const std::vector &statements, - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &component_name, + irep_idt component_name, const symbol_table_baset &symbol_table); pointer_assignment_locationt find_this_component_assignment( const std::vector &statements, - const irep_idt &component_name); + irep_idt component_name); std::vector get_all_statements(const exprt &function_value); @@ -61,7 +61,7 @@ const std::vector require_entry_point_statements(const symbol_table_baset &symbol_table); pointer_assignment_locationt find_pointer_assignments( - const irep_idt &pointer_name, + irep_idt pointer_name, const std::vector &instructions); pointer_assignment_locationt find_pointer_assignments( @@ -69,33 +69,33 @@ pointer_assignment_locationt find_pointer_assignments( const std::vector &instructions); const code_declt &require_declaration_of_name( - const irep_idt &variable_name, + irep_idt variable_name, const std::vector &entry_point_instructions); irep_idt require_struct_component_assignment( - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &component_name, - const irep_idt &component_type_name, + irep_idt component_name, + irep_idt component_type_name, const std::optional &typecast_name, const std::vector &entry_point_instructions, const symbol_table_baset &symbol_table); const irep_idt &require_struct_array_component_assignment( - const irep_idt &structure_name, + irep_idt structure_name, const std::optional &superclass_name, - const irep_idt &array_component_name, - const irep_idt &array_type_name, + irep_idt array_component_name, + irep_idt array_type_name, const std::vector &entry_point_instructions, const symbol_table_baset &symbol_table); irep_idt require_entry_point_argument_assignment( - const irep_idt &argument_name, + irep_idt argument_name, const std::vector &entry_point_statements); std::vector find_function_calls( const std::vector &statements, - const irep_idt &function_call_identifier); + irep_idt function_call_identifier); } #endif // CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H diff --git a/jbmc/unit/java-testing-utils/require_parse_tree.cpp b/jbmc/unit/java-testing-utils/require_parse_tree.cpp index 02331ca2ba5..91fcbe4d10d 100644 --- a/jbmc/unit/java-testing-utils/require_parse_tree.cpp +++ b/jbmc/unit/java-testing-utils/require_parse_tree.cpp @@ -51,7 +51,7 @@ require_parse_tree::require_lambda_entry_for_descriptor( /// \return The methodt structure with the corresponding name const require_parse_tree::methodt require_parse_tree::require_method( const java_bytecode_parse_treet::classt &parsed_class, - const irep_idt &method_name) + irep_idt method_name) { const auto method = std::find_if( parsed_class.methods.begin(), diff --git a/jbmc/unit/java-testing-utils/require_parse_tree.h b/jbmc/unit/java-testing-utils/require_parse_tree.h index 7496443c4eb..85fded0c700 100644 --- a/jbmc/unit/java-testing-utils/require_parse_tree.h +++ b/jbmc/unit/java-testing-utils/require_parse_tree.h @@ -28,12 +28,12 @@ typedef java_bytecode_parse_treet::methodt methodt; const methodt require_method( const java_bytecode_parse_treet::classt &parsed_class, - const irep_idt &method_name); + irep_idt method_name); struct expected_instructiont { expected_instructiont( - const irep_idt &instruction_mnemoic, + irep_idt instruction_mnemoic, const std::vector &instruction_arguments) : instruction_mnemoic(instruction_mnemoic), instruction_arguments(instruction_arguments) diff --git a/jbmc/unit/java-testing-utils/require_type.cpp b/jbmc/unit/java-testing-utils/require_type.cpp index 4559d4348c5..407c10073a9 100644 --- a/jbmc/unit/java-testing-utils/require_type.cpp +++ b/jbmc/unit/java-testing-utils/require_type.cpp @@ -34,7 +34,7 @@ pointer_typet require_type::require_pointer( /// \return The component with the specified name java_class_typet::componentt require_type::require_component( const java_class_typet &java_class_type, - const irep_idt &component_name) + irep_idt component_name) { const auto &component = std::find_if( java_class_type.components().begin(), @@ -53,7 +53,7 @@ java_class_typet::componentt require_type::require_component( /// \return The component with the specified name struct_typet::componentt require_type::require_component( const struct_typet &struct_type, - const irep_idt &component_name) + irep_idt component_name) { const auto &componet = std::find_if( struct_type.components().begin(), @@ -119,7 +119,7 @@ require_type::require_java_method(const typet &type, const size_t num_params) /// parameter name. code_typet::parametert require_type::require_parameter( const code_typet &function_type, - const irep_idt ¶m_name) + irep_idt param_name) { const auto param = std::find_if( function_type.parameters().begin(), @@ -224,7 +224,7 @@ require_type::require_java_generic_parameter(const typet &type) /// \return The given type, cast to a java_generic_parametert java_generic_parametert require_type::require_java_generic_parameter( const typet &type, - const irep_idt ¶meter) + irep_idt parameter) { const java_generic_parametert &generic_param = require_type::require_java_generic_parameter(type); @@ -314,17 +314,16 @@ java_generic_class_typet require_type::require_java_generic_class( const java_generic_class_typet::generic_typest &generic_type_vars = java_generic_class_type.generic_types(); REQUIRE(generic_type_vars.size() == type_variables.size()); - REQUIRE( - std::equal( - type_variables.begin(), - type_variables.end(), - generic_type_vars.begin(), - []( - const irep_idt &type_var_name, - const java_generic_parametert ¶m) { //NOLINT - REQUIRE(is_java_generic_parameter(param)); - return param.type_variable().get_identifier() == type_var_name; - })); + REQUIRE(std::equal( + type_variables.begin(), + type_variables.end(), + generic_type_vars.begin(), + []( + irep_idt type_var_name, + const java_generic_parametert ¶m) { //NOLINT + REQUIRE(is_java_generic_parameter(param)); + return param.type_variable().get_identifier() == type_var_name; + })); return java_generic_class_type; } @@ -459,7 +458,7 @@ require_type::require_complete_java_non_generic_class(const typet &class_type) /// \param identifier: The identifier the symbol type should have /// \return The cast version of the input type const struct_tag_typet & -require_type::require_struct_tag(const typet &type, const irep_idt &identifier) +require_type::require_struct_tag(const typet &type, irep_idt identifier) { REQUIRE(type.id() == ID_struct_tag); const struct_tag_typet &result = to_struct_tag_type(type); @@ -471,7 +470,7 @@ require_type::require_struct_tag(const typet &type, const irep_idt &identifier) } pointer_typet -require_type::require_pointer_to_tag(const typet &type, const irep_idt &tag) +require_type::require_pointer_to_tag(const typet &type, irep_idt tag) { const auto pointer_type = require_type::require_pointer(type, {}); require_type::require_struct_tag(pointer_type.base_type(), tag); diff --git a/jbmc/unit/java-testing-utils/require_type.h b/jbmc/unit/java-testing-utils/require_type.h index 84f3b51015e..d5764188064 100644 --- a/jbmc/unit/java-testing-utils/require_type.h +++ b/jbmc/unit/java-testing-utils/require_type.h @@ -28,25 +28,23 @@ require_pointer(const typet &type, const std::optional &subtype); [[gnu::no_dangling]] #endif const struct_tag_typet & -require_struct_tag(const typet &type, const irep_idt &identifier = ""); +require_struct_tag(const typet &type, irep_idt identifier = ""); -pointer_typet require_pointer_to_tag( - const typet &type, - const irep_idt &identifier = irep_idt()); +pointer_typet +require_pointer_to_tag(const typet &type, irep_idt identifier = irep_idt()); java_class_typet::componentt require_component( const java_class_typet &java_class_type, - const irep_idt &component_name); + irep_idt component_name); -struct_typet::componentt require_component( - const struct_typet &struct_type, - const irep_idt &component_name); +struct_typet::componentt +require_component(const struct_typet &struct_type, irep_idt component_name); code_typet require_code(const typet &type); java_method_typet require_java_method(const typet &type); code_typet::parametert -require_parameter(const code_typet &function_type, const irep_idt ¶m_name); +require_parameter(const code_typet &function_type, irep_idt param_name); code_typet require_code(const typet &type, const size_t num_params); java_method_typet @@ -75,9 +73,8 @@ java_generic_typet require_java_generic_type( java_generic_parametert require_java_generic_parameter(const typet &type); -java_generic_parametert require_java_generic_parameter( - const typet &type, - const irep_idt ¶meter); +java_generic_parametert +require_java_generic_parameter(const typet &type, irep_idt parameter); const typet &require_java_non_generic_type( const typet &type, diff --git a/jbmc/unit/java_bytecode/goto-programs/remove_virtual_functions_without_fallback.cpp b/jbmc/unit/java_bytecode/goto-programs/remove_virtual_functions_without_fallback.cpp index 82721843801..2ea8d6f1410 100644 --- a/jbmc/unit/java_bytecode/goto-programs/remove_virtual_functions_without_fallback.cpp +++ b/jbmc/unit/java_bytecode/goto-programs/remove_virtual_functions_without_fallback.cpp @@ -19,7 +19,7 @@ Author: Diffblue Ltd. /// classid has value `actual_class_id` exprt resolve_classid_test( const exprt &expr, - const irep_idt &actual_class_id, + irep_idt actual_class_id, const namespacet &ns) { if(expr.id() == ID_or || expr.id() == ID_and) @@ -56,8 +56,7 @@ exprt resolve_classid_test( return expr; } -static bool is_call_to( - goto_programt::const_targett inst, const irep_idt &callee) +static bool is_call_to(goto_programt::const_targett inst, irep_idt callee) { if(!inst->is_function_call()) return false; @@ -78,7 +77,7 @@ static bool is_assume_false(goto_programt::const_targett inst) /// way. static goto_programt::const_targett interpret_classid_comparison( const goto_programt &program, - const irep_idt &actual_class_id, + irep_idt actual_class_id, const namespacet &ns) { REQUIRE(!program.instructions.empty()); diff --git a/jbmc/unit/java_bytecode/goto_program_generics/generic_parameters_test.cpp b/jbmc/unit/java_bytecode/goto_program_generics/generic_parameters_test.cpp index 849d8861d2f..ab15f0853be 100644 --- a/jbmc/unit/java_bytecode/goto_program_generics/generic_parameters_test.cpp +++ b/jbmc/unit/java_bytecode/goto_program_generics/generic_parameters_test.cpp @@ -312,7 +312,7 @@ SCENARIO( THEN("Object 'v' is of type Wrapper") { - const auto &tmp_object_declaration = + const auto tmp_object_declaration = require_goto_statements::require_declaration_of_name( tmp_object_name, entry_point_code); @@ -362,7 +362,7 @@ SCENARIO( THEN("Object 'v' is of type Wrapper") { - const auto &tmp_object_declaration = + const auto tmp_object_declaration = require_goto_statements::require_declaration_of_name( tmp_object_name, entry_point_code); @@ -412,7 +412,7 @@ SCENARIO( THEN("Object 'v' is of type Outer") { - const auto &tmp_object_declaration = + const auto tmp_object_declaration = require_goto_statements::require_declaration_of_name( tmp_object_name, entry_point_code); @@ -477,7 +477,7 @@ SCENARIO( THEN("Object 'v' is of type A") { - const auto &tmp_object_declaration = + const auto tmp_object_declaration = require_goto_statements::require_declaration_of_name( tmp_object_name, entry_point_code); diff --git a/jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp b/jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp index 9d49647a013..51eebfea7b7 100644 --- a/jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp +++ b/jbmc/unit/java_bytecode/goto_program_generics/mutually_recursive_generics.cpp @@ -91,10 +91,9 @@ SCENARIO( const std::vector &entry_point_code = require_goto_statements::require_entry_point_statements(symbol_table); - const auto has_key_and_value_field = [&]( - const irep_idt &field, - const irep_idt &key_type, - const irep_idt &val_type) { + const auto has_key_and_value_field = + [&](irep_idt field, irep_idt key_type, irep_idt val_type) + { require_goto_statements::require_struct_component_assignment( field, {}, "key", key_type, {}, entry_point_code, symbol_table); require_goto_statements::require_struct_component_assignment( @@ -169,11 +168,9 @@ SCENARIO( entry_point_code, symbol_table); - const auto has_x_e_u_fields = [&]( - const irep_idt &field, - const irep_idt &x_type, - const irep_idt &e_type, - const irep_idt &u_type) { + const auto has_x_e_u_fields = + [&](irep_idt field, irep_idt x_type, irep_idt e_type, irep_idt u_type) + { require_goto_statements::require_struct_component_assignment( field, {}, "x", x_type, {}, entry_point_code, symbol_table); require_goto_statements::require_struct_component_assignment( diff --git a/jbmc/unit/java_bytecode/inherited_static_fields/inherited_static_fields.cpp b/jbmc/unit/java_bytecode/inherited_static_fields/inherited_static_fields.cpp index 30f57f2b615..23d12280e67 100644 --- a/jbmc/unit/java_bytecode/inherited_static_fields/inherited_static_fields.cpp +++ b/jbmc/unit/java_bytecode/inherited_static_fields/inherited_static_fields.cpp @@ -19,7 +19,7 @@ Author: Diffblue Ltd. /// \param expr: expr to check /// \param id: symbol id to look for /// \return true if a suitable symbol_exprt is found -static bool contains_symbol_reference(const exprt &expr, const irep_idt &id) +static bool contains_symbol_reference(const exprt &expr, irep_idt id) { return std::any_of( expr.depth_begin(), diff --git a/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_method.cpp b/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_method.cpp index 7509b736f2a..f2d5b798b77 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_method.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_method.cpp @@ -335,15 +335,14 @@ SCENARIO( class java_bytecode_convert_method_unit_testt { public: - static exprt - convert_aload(const irep_idt &statement, const exprt::operandst &op) + static exprt convert_aload(irep_idt statement, const exprt::operandst &op) { return java_bytecode_convert_methodt::convert_aload(statement, op); } static code_blockt convert_astore( java_bytecode_convert_methodt &converter, - const irep_idt &statement, + irep_idt statement, const exprt::operandst &op, const source_locationt &location) { @@ -383,7 +382,7 @@ class java_bytecode_convert_method_unit_testt static code_blockt convert_store( java_bytecode_convert_methodt &converter, - const irep_idt &statement, + irep_idt statement, const exprt &arg0, const exprt::operandst &op, const java_bytecode_convert_methodt::method_offsett address, diff --git a/jbmc/unit/java_bytecode/java_bytecode_parser/parse_java_annotations.cpp b/jbmc/unit/java_bytecode/java_bytecode_parser/parse_java_annotations.cpp index 6ea155a486d..c36812c22a6 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_parser/parse_java_annotations.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_parser/parse_java_annotations.cpp @@ -32,8 +32,8 @@ class test_java_bytecode_languaget : public java_bytecode_languaget return parsed_class_names; } - java_class_loadert::parse_tree_with_overlayst &get_parse_trees_for_class( - const irep_idt &class_name) + java_class_loadert::parse_tree_with_overlayst & + get_parse_trees_for_class(irep_idt class_name) { return java_class_loader.get_class_with_overlays_map().at(class_name); } diff --git a/jbmc/unit/java_bytecode/java_object_factory/struct_tag_types.cpp b/jbmc/unit/java_bytecode/java_object_factory/struct_tag_types.cpp index 8594be44be2..e023f128219 100644 --- a/jbmc/unit/java_bytecode/java_object_factory/struct_tag_types.cpp +++ b/jbmc/unit/java_bytecode/java_object_factory/struct_tag_types.cpp @@ -17,7 +17,7 @@ Author: Diffblue Ltd. #include -static bool is_decl_with_struct_tag(const codet &code, const irep_idt &id) +static bool is_decl_with_struct_tag(const codet &code, irep_idt id) { if(code.get_statement() != ID_decl) return false; @@ -72,7 +72,7 @@ static bool contains_decl_of_type(const codet &code, const typet &type) }); } -static bool contains_decl_with_struct_tag(const codet &code, const irep_idt &id) +static bool contains_decl_with_struct_tag(const codet &code, irep_idt id) { return contains(code, [&id](const codet &subcode) { return is_decl_with_struct_tag(subcode, id); diff --git a/jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp b/jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp index 2ad12a18031..964332746e7 100644 --- a/jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp +++ b/jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp @@ -143,7 +143,7 @@ void load_and_test_method( // Then test both situations. THEN("Replace nondet should work after remove returns has been called.") { - remove_returns(model_function, [](const irep_idt &) { return false; }); + remove_returns(model_function, [](irep_idt) { return false; }); replace_java_nondet(model_function); @@ -154,7 +154,7 @@ void load_and_test_method( { replace_java_nondet(model_function); - remove_returns(model_function, [](const irep_idt &) { return false; }); + remove_returns(model_function, [](irep_idt) { return false; }); validate_nondet_method_removed(goto_function.body.instructions); } @@ -165,7 +165,7 @@ void load_and_test_method( "Replace and convert nondet should work after remove returns has been " "called.") { - remove_returns(model_function, [](const irep_idt &) { return false; }); + remove_returns(model_function, [](irep_idt) { return false; }); replace_java_nondet(model_function); @@ -182,7 +182,7 @@ void load_and_test_method( convert_nondet(model_function, null_message_handler, params, ID_java); - remove_returns(model_function, [](const irep_idt &) { return false; }); + remove_returns(model_function, [](irep_idt) { return false; }); validate_nondets_converted(goto_function.body.instructions); } diff --git a/jbmc/unit/java_bytecode/java_string_library_preprocess/convert_exprt_to_string_exprt.cpp b/jbmc/unit/java_bytecode/java_string_library_preprocess/convert_exprt_to_string_exprt.cpp index 389564dd7a1..f339b08a737 100644 --- a/jbmc/unit/java_bytecode/java_string_library_preprocess/convert_exprt_to_string_exprt.cpp +++ b/jbmc/unit/java_bytecode/java_string_library_preprocess/convert_exprt_to_string_exprt.cpp @@ -24,7 +24,7 @@ refined_string_exprt convert_exprt_to_string_exprt_unit_test( java_string_library_preprocesst &preprocess, const exprt &deref, const source_locationt &loc, - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, code_blockt &init_code) { diff --git a/jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp b/jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp index 019b9a34509..5dd00aa3cec 100644 --- a/jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp +++ b/jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp @@ -20,8 +20,8 @@ Author: Diffblue Ltd. void check_function_call( const equal_exprt &eq_expr, - const irep_idt &class_name, - const irep_idt &function_name, + irep_idt class_name, + irep_idt function_name, const goto_programt::targetst &targets) { REQUIRE(eq_expr.op0().is_constant()); diff --git a/jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp b/jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp index 92cca9f876c..136b8ddabbf 100644 --- a/jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp +++ b/jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp @@ -147,8 +147,7 @@ typedef #define TEST_FUNCTION_NAME TEST_PREFIX "test:()V" #define TEST_LOCAL_PREFIX TEST_FUNCTION_NAME "::" -static std::size_t -exprs_with_id(const std::vector &exprs, const irep_idt &id) +static std::size_t exprs_with_id(const std::vector &exprs, irep_idt id) { return std::count_if( exprs.begin(), diff --git a/scripts/check_pass_by_value.cpp b/scripts/check_pass_by_value.cpp new file mode 100644 index 00000000000..6b72593caf8 --- /dev/null +++ b/scripts/check_pass_by_value.cpp @@ -0,0 +1,443 @@ +// Detect parameters of cheap-to-copy types passed by const reference. +// +// Implements C++ Core Guidelines F.16 ("for `in` parameters, pass cheaply +// copied types by value and others by reference to const"). The set of +// "cheap" types is configured below in CHEAP_TYPES; it currently lists +// dstringt (= irep_idt), which is a wrapper around a single unsigned +// table index and is strictly cheaper to copy than to take by reference. +// +// The matcher is `parmVarDecl()`. Real method/function parameters and +// named parameters of function-type template arguments inside +// *instantiated* class templates (e.g. +// `std::function` inside `sharing_mapt` +// when instantiated with K = irep_idt) are flagged. --fix can rewrite +// the former in place; the latter are flagged but not auto-rewritten, +// because changing the in-class declaration without the matching +// out-of-class definition would not compile. +// +// Limitation: anonymous parameters in non-instantiated typedefs of +// std::function (e.g. `using cb = std::function`) +// don't produce a ParmVarDecl in Clang's AST and therefore are not +// caught here. A complementary `FunctionProtoTypeLoc` walker would +// close this gap; for now, regressions of that specific shape need +// to be caught by code review or a follow-up grep sweep. +// +// Build: +// clang++-18 -o check-pass-by-value scripts/check_pass_by_value.cpp \ +// $(llvm-config-18 --cxxflags | sed 's/-Werror//g') \ +// -L/usr/lib/llvm-18/lib -lclang-cpp \ +// $(llvm-config-18 --ldflags --libs --system-libs) -fno-rtti +// +// Usage (check): +// ./check-pass-by-value -p build/compile_commands.json src/foo/*.cpp +// Usage (rewrite in-place): +// ./check-pass-by-value --fix -p build/compile_commands.json src/foo/*.cpp + +#include +#include + +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/ASTMatchers/ASTMatchers.h" +#include "clang/Frontend/FrontendActions.h" +#include "clang/Tooling/CommonOptionsParser.h" +#include "clang/Tooling/Refactoring.h" +#include "clang/Tooling/Tooling.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/MemoryBuffer.h" +#include "llvm/Support/raw_ostream.h" + +using namespace clang; +using namespace clang::ast_matchers; +using namespace clang::tooling; + +static llvm::cl::OptionCategory Cat("check-pass-by-value"); +static llvm::cl::opt Fix( + "fix", + llvm::cl::desc("Rewrite each finding in place: replace 'const T &' " + "with 'T '"), + llvm::cl::cat(Cat)); +static llvm::cl::opt PathFilter( + "path-filter", + llvm::cl::desc("Only act on findings whose absolute path contains this " + "substring (matches anywhere). Default: act everywhere."), + llvm::cl::cat(Cat)); + +/// Types that are "cheap to copy" per C++ Core Guidelines F.16, expressed +/// as canonical (typedef-stripped) names. To extend, add the canonical +/// name here; for example, `goto_programt::const_targett` resolves to +/// `std::__cxx11::list::const_iterator`. +static const std::set CHEAP_TYPES = { + // dstringt holds a single unsigned table index. irep_idt is a typedef + // for dstringt, so the canonical name we match against is "dstringt". + "dstringt", +}; + +/// Return true if QT is one of the configured cheap-to-copy types. +static bool isCheapType(QualType QT) +{ + if(QT.isNull()) + return false; + // Strip references and cv-qualifiers; we want the underlying record. + if(QT->isReferenceType()) + QT = QT.getNonReferenceType(); + QT = QT.getLocalUnqualifiedType(); + // Resolve typedefs to the canonical record (e.g., irep_idt -> dstringt). + const CXXRecordDecl *RD = QT->getAsCXXRecordDecl(); + if(!RD) + return false; + return CHEAP_TYPES.count(RD->getNameAsString()) > 0; +} + +/// Reconstruct a short signature snippet for the parameter, of the form +/// "const T &name", using the source spelling where possible (so users +/// see "const irep_idt &" rather than "const dstringt &"). +static std::string spellingFor( + const ParmVarDecl *PVD, + const SourceManager &SM, + const LangOptions &LO) +{ + SourceRange R = PVD->getSourceRange(); + if(R.isInvalid()) + return PVD->getType().getAsString() + " " + PVD->getNameAsString(); + CharSourceRange CSR = CharSourceRange::getTokenRange(R); + StringRef Text = Lexer::getSourceText(CSR, SM, LO); + // Collapse consecutive whitespace for readability of multi-line decls. + std::string Out; + Out.reserve(Text.size()); + bool PrevSpace = false; + for(char c : Text) + { + if(c == '\n' || c == '\r' || c == '\t' || c == ' ') + { + if(!PrevSpace) + Out.push_back(' '); + PrevSpace = true; + } + else + { + Out.push_back(c); + PrevSpace = false; + } + } + return Out; +} + +/// Walk through reference/qualified TypeLoc layers to reach the bare +/// type spelling (e.g., the `irep_idt` or `dstringt` token). +static TypeLoc innerTypeLoc(TypeLoc TL) +{ + while(true) + { + if(auto Ref = TL.getAs()) + { + TL = Ref.getPointeeLoc(); + continue; + } + if(auto Qual = TL.getAs()) + { + TL = Qual.getUnqualifiedLoc(); + continue; + } + break; + } + return TL; +} + +class ParamCallback : public MatchFinder::MatchCallback +{ +public: + std::map *Replace = nullptr; + + void run(const MatchFinder::MatchResult &Result) override + { + const auto *PVD = Result.Nodes.getNodeAs("param"); + if(!PVD) + return; + + const auto &SM = *Result.SourceManager; + SourceLocation Loc = PVD->getLocation(); + if(Loc.isInvalid()) + return; + + // Skip parameters declared in system headers (e.g., libstdc++ + // template specialisations of std::less): these are not + // ours to fix and would create thousands of spurious findings. + if(SM.isInSystemHeader(Loc)) + return; + + // We do *not* restrict to "main" files: most parameter declarations + // live in headers (class definitions, function declarations), so we + // need to follow #includes. Duplicates that arise from the same + // header being parsed by many TUs are removed below via the Seen + // set, keyed by (file, line, column). + + // The parameter type must be a const lvalue reference to one of our + // cheap-to-copy types. + QualType PT = PVD->getType(); + if(!PT->isLValueReferenceType()) + return; + QualType Pointee = PT->getPointeeType(); + if(!Pointee.isConstQualified()) + return; + if(!isCheapType(Pointee)) + return; + + // Skip parameters of special member functions whose signature is + // dictated by the language: copy/move constructors and copy/move + // assignment operators must take `const T &` (or `T &&`) and + // returning by value would not compile. + const auto *FD = dyn_cast(PVD->getDeclContext()); + + // Whether the parameter is one we are willing to rewrite in place. + // Parameter names that appear inside function-type template + // arguments (e.g. `std::function`) have + // their enclosing FunctionDecl in DeclContext but are NOT in that + // FunctionDecl's getParamDecl() list. Rewriting them in isolation + // desynchronises an in-class declaration from its out-of-class + // definition, so we still flag them (so CI can catch any new + // ones), but we don't auto-rewrite them. + bool isFixable = false; + if(FD) + { + for(unsigned i = 0; i < FD->getNumParams(); ++i) + { + if(FD->getParamDecl(i) == PVD) + { + isFixable = true; + break; + } + } + } + + if(FD) + { + if(const auto *CtorD = dyn_cast(FD)) + { + if(CtorD->isCopyConstructor() || CtorD->isMoveConstructor()) + return; + } + if(const auto *MD = dyn_cast(FD)) + { + if(MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator()) + return; + } + // Skip parameters of function template *instantiations*. We still + // see the original template's parameters separately (and flag + // those when the type is spelled as e.g. `const irep_idt &`); the + // instantiations only pop up because Clang substituted a template + // parameter to one of our cheap types, which is not something the + // user can fix locally without changing the template signature + // (and thereby pessimising other instantiations). + if(FD->isTemplateInstantiation()) + return; + // Same reasoning for member functions of class template + // specialisations: the source-as-written signature may use a + // template type parameter (e.g. `const keyT &`) that happens to + // have been substituted to one of our cheap types. + if(const auto *MD = dyn_cast(FD)) + { + if(isa(MD->getParent())) + return; + } + } + + // Skip if the parameter's source-as-written type is a (substituted) + // template type parameter or otherwise dependent. Only flag when + // the user actually wrote one of our cheap types, e.g. + // `const irep_idt &x` or `const dstringt &x`. We walk the type + // sugar chain rather than only inspecting the top-level type, so + // that constructs like `const value_type &` -- where `value_type` + // is a typedef whose substituted form is `dstringt` only because + // the enclosing class template was instantiated with a cheap key + // type -- are recognised and skipped. + if(const TypeSourceInfo *TSI = PVD->getTypeSourceInfo()) + { + QualType AsWritten = TSI->getType().getNonReferenceType(); + ASTContext &Ctx = *Result.Context; + QualType Cur = AsWritten; + while(!Cur.isNull()) + { + const Type *T = Cur.getTypePtr(); + if( + isa(T) || isa(T) || + isa(T) || isa(T)) + return; + QualType Next = Cur.getSingleStepDesugaredType(Ctx); + if(Next == Cur) + break; + Cur = Next; + } + } + + PresumedLoc PL = SM.getPresumedLoc(Loc); + if(PL.isInvalid()) + return; + + // If --path-filter is set, drop findings whose file path doesn't + // contain that substring (after path normalisation). + if(!PathFilter.empty()) + { + StringRef FN = PL.getFilename(); + if(FN.find(PathFilter) == StringRef::npos) + return; + } + + // Deduplicate: a single parameter declaration in source can match + // multiple times via template instantiations. Keying by absolute + // (file, line, column) collapses these to a single warning. + Key K{PL.getFilename(), PL.getLine(), PL.getColumn()}; + if(!Seen.insert(K).second) + return; + + std::string Spelling = spellingFor(PVD, SM, Result.Context->getLangOpts()); + + // Build the entire diagnostic line in a string and emit it with a + // single write, so that concurrent parallel runs do not interleave + // partial lines on stdout. + std::string Line; + { + llvm::raw_string_ostream OS(Line); + OS << PL.getFilename() << ":" << PL.getLine() << ":" << PL.getColumn() + << ": warning: parameter '" << PVD->getNameAsString() << "' has type '" + << PT.getAsString() + << "' which is cheap to copy; pass by value " + "[cprover-pass-cheap-by-value]: " + << Spelling << "\n"; + } + llvm::outs() << Line; + llvm::outs().flush(); + + // In --fix mode, also queue an in-place replacement that rewrites + // the parameter's type from `const T &` to `T `. We replace the + // half-open character range from the start of the parameter + // declaration (which covers the leading `const`) up to the start + // of the parameter name, with ` `. This preserves the + // user's choice of spelling (`irep_idt` vs. `dstringt`) and + // absorbs any whitespace between `&` and the name. + if(Replace == nullptr) + return; + // Only auto-rewrite parameters that are real method/function + // parameters; see the isFixable comment above. + if(!isFixable) + return; + const TypeSourceInfo *TSI = PVD->getTypeSourceInfo(); + if(!TSI) + return; + TypeLoc TL = TSI->getTypeLoc(); + SourceLocation Begin = PVD->getBeginLoc(); + SourceLocation End = PVD->getLocation(); + if(Begin.isInvalid() || End.isInvalid() || Begin == End) + return; + // Only safe to rewrite if both endpoints map to the same file, in + // file (not macro-expansion) locations. + Begin = SM.getFileLoc(Begin); + End = SM.getFileLoc(End); + if(SM.getFileID(Begin) != SM.getFileID(End)) + return; + // Extract the spelled inner type so we preserve `irep_idt` vs. + // `dstringt` exactly as the user wrote it. + TypeLoc Inner = innerTypeLoc(TL); + CharSourceRange InnerCSR = + CharSourceRange::getTokenRange(Inner.getSourceRange()); + StringRef InnerText = + Lexer::getSourceText(InnerCSR, SM, Result.Context->getLangOpts()); + if(InnerText.empty()) + return; + std::string ReplaceText = InnerText.str(); + ReplaceText.push_back(' '); + CharSourceRange Range = CharSourceRange::getCharRange(Begin, End); + Replacement R(SM, Range, ReplaceText); + std::string FilePath = std::string(R.getFilePath()); + if(FilePath.empty()) + return; + if(auto Err = (*Replace)[FilePath].add(R)) + { + llvm::errs() << "warning: failed to add replacement for " << FilePath + << ": " << llvm::toString(std::move(Err)) << "\n"; + } + } + +private: + struct Key + { + std::string File; + unsigned Line; + unsigned Column; + bool operator<(const Key &O) const + { + if(File != O.File) + return File < O.File; + if(Line != O.Line) + return Line < O.Line; + return Column < O.Column; + } + }; + std::set Seen; +}; + +int main(int argc, const char **argv) +{ + auto EP = CommonOptionsParser::create(argc, argv, Cat); + if(!EP) + { + llvm::errs() << EP.takeError(); + return 1; + } + + ParamCallback CB; + MatchFinder Finder; + Finder.addMatcher(parmVarDecl().bind("param"), &CB); + + if(Fix) + { + RefactoringTool Tool(EP->getCompilations(), EP->getSourcePathList()); + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster( + "-Wno-unknown-warning-option", ArgumentInsertPosition::BEGIN)); + CB.Replace = &Tool.getReplacements(); + int RC = Tool.run(newFrontendActionFactory(&Finder).get()); + // Manually apply replacements rather than using runAndSave: the + // latter returns early when any TU has a parse error (e.g., + // optional solver back-ends with missing third-party headers), + // and we still want fixes for the TUs that parsed cleanly. + unsigned Saved = 0; + for(auto &Entry : Tool.getReplacements()) + { + const std::string &FilePath = Entry.first; + const Replacements &Reps = Entry.second; + auto Buffer = llvm::MemoryBuffer::getFile(FilePath); + if(!Buffer) + { + llvm::errs() << "warning: could not read " << FilePath << ": " + << Buffer.getError().message() << "\n"; + continue; + } + llvm::Expected NewContent = + applyAllReplacements((*Buffer)->getBuffer(), Reps); + if(!NewContent) + { + llvm::errs() << "warning: failed to apply replacements for " << FilePath + << ": " << llvm::toString(NewContent.takeError()) << "\n"; + continue; + } + std::error_code EC; + llvm::raw_fd_ostream Out(FilePath, EC); + if(EC) + { + llvm::errs() << "warning: could not write " << FilePath << ": " + << EC.message() << "\n"; + continue; + } + Out << *NewContent; + ++Saved; + } + llvm::errs() << "Saved " << Saved << " files.\n"; + return RC; + } + else + { + ClangTool Tool(EP->getCompilations(), EP->getSourcePathList()); + Tool.appendArgumentsAdjuster(getInsertArgumentAdjuster( + "-Wno-unknown-warning-option", ArgumentInsertPosition::BEGIN)); + return Tool.run(newFrontendActionFactory(&Finder).get()); + } +} diff --git a/scripts/pass_by_value_baseline.txt b/scripts/pass_by_value_baseline.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/run_diff.sh b/scripts/run_diff.sh index 3f41b836994..8f9644b81cb 100755 --- a/scripts/run_diff.sh +++ b/scripts/run_diff.sh @@ -37,7 +37,7 @@ then echo "Ensure cpplint.py is inside the $script_folder directory then run again" exit 1 else - cmd='${script_folder}/cpplint.py --exclude=jbmc/src/miniz/* --filter=-whitespace/operators,-readability/identifier_spacing $file 2>&1 >/dev/null' + cmd='${script_folder}/cpplint.py --exclude=jbmc/src/miniz/* --exclude=scripts/check_pass_by_value.cpp --filter=-whitespace/operators,-readability/identifier_spacing $file 2>&1 >/dev/null' fi else echo "Mode $mode not recognized" diff --git a/scripts/run_pass_by_value_check.sh b/scripts/run_pass_by_value_check.sh new file mode 100755 index 00000000000..50f562d71a4 --- /dev/null +++ b/scripts/run_pass_by_value_check.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# CI script: check for F.16 pass-by-const-reference violations on cheap +# types (C++ Core Guidelines F.16). Uses scripts/check_pass_by_value.cpp +# (Clang LibTooling) and diffs the output against +# scripts/pass_by_value_baseline.txt. +# +# Build directory is taken from the first argument and defaults to "build". +# A compile_commands.json must exist there. +# +# Exit codes: +# 0 no new findings (existing baseline entries may have disappeared, +# in which case a notice is printed and the user is invited to +# regenerate the baseline) +# 1 new findings appeared, or the tool failed to build/run +# +# Usage: +# scripts/run_pass_by_value_check.sh [build-dir] + +set -euo pipefail + +BUILD_DIR="${1:-build}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +TOOL="$SCRIPT_DIR/check-pass-by-value" +BASELINE="$SCRIPT_DIR/pass_by_value_baseline.txt" +SOURCE="$SCRIPT_DIR/check_pass_by_value.cpp" + +# --------------------------------------------------------------------------- +# Build the tool if it isn't present or is older than its source. +# --------------------------------------------------------------------------- +if [ ! -x "$TOOL" ] || [ "$SOURCE" -nt "$TOOL" ]; then + echo "Building check-pass-by-value..." + LLVM_VER="$(llvm-config --version 2>/dev/null | cut -d. -f1 || echo "")" + if [ -z "$LLVM_VER" ]; then + for v in 20 18 15; do + if command -v "llvm-config-$v" >/dev/null 2>&1; then + LLVM_VER="$v" + break + fi + done + fi + if [ -z "$LLVM_VER" ]; then + echo "Error: no LLVM installation found" >&2 + exit 1 + fi + # shellcheck disable=SC2046 + clang++-"$LLVM_VER" -o "$TOOL" "$SOURCE" \ + $(llvm-config-"$LLVM_VER" --cxxflags | sed 's/-Werror//g') \ + -L/usr/lib/llvm-"$LLVM_VER"/lib -lclang-cpp \ + $(llvm-config-"$LLVM_VER" --ldflags --libs --system-libs) \ + -fno-rtti +fi + +if [ ! -f "$BUILD_DIR/compile_commands.json" ]; then + echo "Error: $BUILD_DIR/compile_commands.json not found" >&2 + echo "Run: cmake -S . -B$BUILD_DIR -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" >&2 + exit 1 +fi + +# --------------------------------------------------------------------------- +# Run the tool over all C++ TUs in src/ and jbmc/src/, in parallel. Each +# `xargs` worker writes to its own per-pid temp file to avoid stdout +# interleaving across workers; we concatenate at the end. +# --------------------------------------------------------------------------- +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +export TMP TOOL BUILD_DIR +# Per-TU parsing errors return non-zero from the tool; that propagates +# through `xargs` and would normally trip `set -e`. Tolerate it: any TUs +# that genuinely produced output have done so via the `>>` redirection, +# and we error out below if the aggregate result is empty. +set +e +find "$REPO_ROOT/src" "$REPO_ROOT/jbmc/src" -name '*.cpp' -print0 \ + | xargs -0 -P "$(nproc)" -n 8 sh -c ' + "$TOOL" -p "$BUILD_DIR/compile_commands.json" "$@" \ + 2>/dev/null >> "$TMP/$$.out" + ' _ +set -e + +# Collapse to repo-relative paths so that the baseline is portable. +CURRENT="$TMP/current.txt" +cat "$TMP"/*.out 2>/dev/null \ + | sed "s|$REPO_ROOT/||g" \ + | sort -u > "$CURRENT" + +# --------------------------------------------------------------------------- +# Diff against the baseline. +# comm -13 baseline current -> new in current (NEW VIOLATIONS, fail) +# comm -23 baseline current -> removed (notice, pass) +# --------------------------------------------------------------------------- +if [ ! -f "$BASELINE" ]; then + echo "Error: baseline file $BASELINE not found." >&2 + echo "Generate it with:" >&2 + echo " $0 $BUILD_DIR --regenerate-baseline" >&2 + exit 1 +fi + +if [ "${2:-}" = "--regenerate-baseline" ]; then + cp "$CURRENT" "$BASELINE" + echo "Baseline regenerated at $BASELINE ($(wc -l < "$BASELINE") entries)." + exit 0 +fi + +NEW="$TMP/new.txt" +REMOVED="$TMP/removed.txt" +comm -13 <(sort "$BASELINE") "$CURRENT" > "$NEW" +comm -23 <(sort "$BASELINE") "$CURRENT" > "$REMOVED" + +NEW_COUNT="$(wc -l < "$NEW")" +REMOVED_COUNT="$(wc -l < "$REMOVED")" +TOTAL_COUNT="$(wc -l < "$CURRENT")" +BASELINE_COUNT="$(wc -l < "$BASELINE")" + +echo "Pass-by-value check: $TOTAL_COUNT findings (baseline: $BASELINE_COUNT)." + +if [ "$REMOVED_COUNT" -gt 0 ]; then + echo "" + echo "Note: $REMOVED_COUNT baseline entries no longer present —" + echo "consider regenerating the baseline:" + echo " $0 $BUILD_DIR --regenerate-baseline" +fi + +if [ "$NEW_COUNT" -gt 0 ]; then + echo "" + echo "$NEW_COUNT NEW pass-by-value violation(s) found:" >&2 + cat "$NEW" >&2 + echo "" >&2 + echo "These parameters take a cheap-to-copy type by const reference," >&2 + echo "violating C++ Core Guidelines F.16. Pass them by value instead." >&2 + exit 1 +fi + +echo "No new pass-by-value violations." +exit 0 diff --git a/src/analyses/ai.cpp b/src/analyses/ai.cpp index adc509d019e..5883bc61373 100644 --- a/src/analyses/ai.cpp +++ b/src/analyses/ai.cpp @@ -38,7 +38,7 @@ void ai_baset::output( void ai_baset::output( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, std::ostream &out) const { @@ -82,7 +82,7 @@ jsont ai_baset::output_json( jsont ai_baset::output_json( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) const { (void)function_id; // unused parameter @@ -135,7 +135,7 @@ xmlt ai_baset::output_xml( xmlt ai_baset::output_xml( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) const { (void)function_id; // unused parameter @@ -188,13 +188,13 @@ ai_baset::trace_ptrt ai_baset::entry_state(const goto_programt &goto_program) } void ai_baset::initialize( - const irep_idt &function_id, + irep_idt function_id, const goto_functionst::goto_functiont &goto_function) { initialize(function_id, goto_function.body); } -void ai_baset::initialize(const irep_idt &, const goto_programt &goto_program) +void ai_baset::initialize(irep_idt, const goto_programt &goto_program) { // Domains are created and set to bottom on access. // So we do not need to set them to be bottom before hand. @@ -231,7 +231,7 @@ ai_baset::trace_ptrt ai_baset::get_next(working_sett &working_set) bool ai_baset::fixedpoint( trace_ptrt start_trace, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const goto_functionst &goto_functions, const namespacet &ns) @@ -268,7 +268,7 @@ void ai_baset::fixedpoint( } bool ai_baset::visit( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, working_sett &working_set, const goto_programt &goto_program, @@ -329,9 +329,9 @@ bool ai_baset::visit( } bool ai_baset::visit_edge( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, - const irep_idt &to_function_id, + irep_idt to_function_id, locationt to_l, trace_ptrt caller_history, const namespacet &ns, @@ -414,10 +414,10 @@ bool ai_baset::visit_edge( } bool ai_baset::visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &, + irep_idt, working_sett &working_set, const goto_programt &, const goto_functionst &, @@ -442,7 +442,7 @@ bool ai_baset::visit_edge_function_call( } bool ai_baset::visit_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, working_sett &working_set, const goto_programt &caller, @@ -521,7 +521,7 @@ bool ai_baset::visit_function_call( } bool ai_baset::visit_end_function( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, working_sett &working_set, const goto_programt &goto_program, @@ -540,10 +540,10 @@ bool ai_baset::visit_end_function( } bool ai_recursive_interproceduralt::visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &callee_function_id, + irep_idt callee_function_id, working_sett &working_set, const goto_programt &callee, const goto_functionst &goto_functions, diff --git a/src/analyses/ai.h b/src/analyses/ai.h index 04fbcc9c127..42c09b6bca2 100644 --- a/src/analyses/ai.h +++ b/src/analyses/ai.h @@ -67,7 +67,7 @@ Author: Daniel Kroening, kroening@kroening.com /// It breaks into three categories: /// /// 1. Running an analysis, via \ref -/// #operator()(const irep_idt&,const goto_programt&, const namespacet&), +/// #operator()(irep_idt,const goto_programt&, const namespacet&), /// \ref ai_baset#operator()(const goto_functionst&,const namespacet&) /// and \ref ai_baset#operator()(const abstract_goto_modelt&) /// 2. Accessing the results of an analysis, by looking up the history objects @@ -76,7 +76,7 @@ Author: Daniel Kroening, kroening@kroening.com /// or the domains using /// \ref ai_baset#abstract_state_before(locationt)const /// 3. Outputting the results of the analysis; see -/// \ref ai_baset#output(const namespacet&, const irep_idt&, +/// \ref ai_baset#output(const namespacet&, irep_idt, /// const goto_programt&, std::ostream&)const et cetera. /// /// Where possible, uses should be agnostic of the particular configuration of @@ -99,8 +99,8 @@ Author: Daniel Kroening, kroening@kroening.com /// concurrency_aware_ait does this to compute a fixed point over threads. /// /// D. For pre-analysis initialization -/// \ref ait#initialize(const irep_idt&, const goto_programt&), -/// \ref ait#initialize(const irep_idt&, +/// \ref ait#initialize(irep_idt, const goto_programt&), +/// \ref ait#initialize(irep_idt, /// const goto_functionst::goto_functiont&) and /// \ref ait#initialize(const goto_functionst&), /// @@ -141,7 +141,7 @@ class ai_baset /// Run abstract interpretation on a single function void operator()( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const namespacet &ns) { @@ -178,7 +178,7 @@ class ai_baset /// Run abstract interpretation on a single function void operator()( - const irep_idt &function_id, + irep_idt function_id, const goto_functionst::goto_functiont &goto_function, const namespacet &ns) { @@ -279,7 +279,7 @@ class ai_baset /// \param out: The ostream to direct output to virtual void output( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, std::ostream &out) const; @@ -291,7 +291,7 @@ class ai_baset /// \return The JSON object virtual jsont output_json( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) const; /// Output the abstract states for a single function as XML @@ -302,7 +302,7 @@ class ai_baset /// \return The XML object virtual xmlt output_xml( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) const; /// Output the abstract states for a whole program @@ -391,11 +391,11 @@ class ai_baset /// Initialize all the abstract states for a single function. Override this to /// do custom per-domain initialization. virtual void - initialize(const irep_idt &function_id, const goto_programt &goto_program); + initialize(irep_idt function_id, const goto_programt &goto_program); /// Initialize all the abstract states for a single function. virtual void initialize( - const irep_idt &function_id, + irep_idt function_id, const goto_functionst::goto_functiont &goto_function); /// Initialize all the abstract states for a whole program. Override this to @@ -429,7 +429,7 @@ class ai_baset /// \return True if we found something new virtual bool fixedpoint( trace_ptrt starting_trace, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const goto_functionst &goto_functions, const namespacet &ns); @@ -444,7 +444,7 @@ class ai_baset /// or applications of the abstract transformer /// \return True if the state was changed virtual bool visit( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, working_sett &working_set, const goto_programt &goto_program, @@ -456,7 +456,7 @@ class ai_baset // visit_function_call handles which function(s) to call, // while visit_edge_function_call handles a single call virtual bool visit_function_call( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p_call, working_sett &working_set, const goto_programt &goto_program, @@ -464,7 +464,7 @@ class ai_baset const namespacet &ns); virtual bool visit_end_function( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, working_sett &working_set, const goto_programt &goto_program, @@ -473,19 +473,19 @@ class ai_baset // The most basic step, computing one edge / transformer application. bool visit_edge( - const irep_idt &function_id, + irep_idt function_id, trace_ptrt p, - const irep_idt &to_function_id, + irep_idt to_function_id, locationt to_l, trace_ptrt caller_history, const namespacet &ns, working_sett &working_set); virtual bool visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &callee_function_id, + irep_idt callee_function_id, working_sett &working_set, const goto_programt &callee, const goto_functionst &goto_functions, @@ -542,10 +542,10 @@ class ai_recursive_interproceduralt : public ai_baset protected: // Override the function that handles a single function call edge bool visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &callee_function_id, + irep_idt callee_function_id, working_sett &working_set, const goto_programt &callee, const goto_functionst &goto_functions, @@ -701,7 +701,7 @@ class concurrency_aware_ait:public ait struct wl_entryt { wl_entryt( - const irep_idt &_function_id, + irep_idt _function_id, const goto_programt &_goto_program, locationt _location) : function_id(_function_id), diff --git a/src/analyses/ai_domain.h b/src/analyses/ai_domain.h index 85d6dcb1dfb..ab4f9a26f75 100644 --- a/src/analyses/ai_domain.h +++ b/src/analyses/ai_domain.h @@ -93,9 +93,9 @@ class ai_domain_baset /// The history aware version is used by the abstract interpreter /// for backwards compatability it calls the older signature virtual void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt to, ai_baset &ai, const namespacet &ns) = 0; diff --git a/src/analyses/call_graph.cpp b/src/analyses/call_graph.cpp index 27c13458271..a6d6e1f719d 100644 --- a/src/analyses/call_graph.cpp +++ b/src/analyses/call_graph.cpp @@ -51,7 +51,7 @@ call_grapht::call_grapht( static void forall_callsites( const goto_programt &body, - std::function call_task) + std::function call_task) { forall_goto_program_instructions(i_it, body) { @@ -74,9 +74,9 @@ static void forall_callsites( /// the calling instruction recorded in `callsites` map. call_grapht::call_grapht( const goto_functionst &goto_functions, - const irep_idt &root, - bool collect_callsites): - collect_callsites(collect_callsites) + irep_idt root, + bool collect_callsites) + : collect_callsites(collect_callsites) { std::stack> pending_stack; pending_stack.push(root); @@ -97,13 +97,12 @@ call_grapht::call_grapht( forall_callsites( goto_program, - [&](goto_programt::const_targett i_it, const irep_idt &callee) + [&](goto_programt::const_targett i_it, irep_idt callee) { add(function, callee, i_it); if(edges.find(callee)==edges.end()) pending_stack.push(callee); - } - ); // NOLINT + }); // NOLINT } } @@ -114,31 +113,24 @@ call_grapht::call_grapht( /// the calling instruction recorded in `callsites` map. call_grapht::call_grapht( const goto_modelt &goto_model, - const irep_idt &root, - bool collect_callsites): - call_grapht(goto_model.goto_functions, root, collect_callsites) + irep_idt root, + bool collect_callsites) + : call_grapht(goto_model.goto_functions, root, collect_callsites) { } -void call_grapht::add( - const irep_idt &function, - const goto_programt &body) +void call_grapht::add(irep_idt function, const goto_programt &body) { forall_callsites( body, - [&](goto_programt::const_targett i_it, const irep_idt &callee) - { - add(function, callee, i_it); - } - ); // NOLINT + [&](goto_programt::const_targett i_it, irep_idt callee) + { add(function, callee, i_it); }); // NOLINT } /// Add edge /// \param caller: caller function /// \param callee: callee function -void call_grapht::add( - const irep_idt &caller, - const irep_idt &callee) +void call_grapht::add(irep_idt caller, irep_idt callee) { edges.insert({caller, callee}); nodes.insert(caller); @@ -150,10 +142,7 @@ void call_grapht::add( /// \param callee: callee function /// \param callsite: call instruction responsible for this edge. Note this is /// only stored if `collect_callsites` was specified during construction. -void call_grapht::add( - const irep_idt &caller, - const irep_idt &callee, - locationt callsite) +void call_grapht::add(irep_idt caller, irep_idt callee, locationt callsite) { add(caller, callee); if(collect_callsites) @@ -186,7 +175,7 @@ class function_indicest { } - node_indext operator[](const irep_idt &function) + node_indext operator[](irep_idt function) { auto findit=function_indices.insert({function, 0}); if(findit.second) @@ -297,7 +286,7 @@ void call_grapht::output_xml(std::ostream &out) const } std::optional -call_grapht::directed_grapht::get_node_index(const irep_idt &function) const +call_grapht::directed_grapht::get_node_index(irep_idt function) const { auto findit=nodes_by_name.find(function); if(findit==nodes_by_name.end()) diff --git a/src/analyses/call_graph.h b/src/analyses/call_graph.h index 630f277f306..2def76b2f3c 100644 --- a/src/analyses/call_graph.h +++ b/src/analyses/call_graph.h @@ -52,7 +52,7 @@ class call_grapht static call_grapht create_from_root_function( const goto_modelt &model, - const irep_idt &root, + irep_idt root, bool collect_callsites) { return call_grapht(model, root, collect_callsites); @@ -60,7 +60,7 @@ class call_grapht static call_grapht create_from_root_function( const goto_functionst &functions, - const irep_idt &root, + irep_idt root, bool collect_callsites) { return call_grapht(functions, root, collect_callsites); @@ -69,13 +69,10 @@ class call_grapht // Constructors used to implement the above: private: - call_grapht( - const goto_modelt &model, - const irep_idt &root, - bool collect_callsites); + call_grapht(const goto_modelt &model, irep_idt root, bool collect_callsites); call_grapht( const goto_functionst &functions, - const irep_idt &root, + irep_idt root, bool collect_callsites); public: @@ -115,8 +112,8 @@ class call_grapht /// Map from call-graph edges to a set of callsites that make the given call. callsitest callsites; - void add(const irep_idt &caller, const irep_idt &callee); - void add(const irep_idt &caller, const irep_idt &callee, locationt callsite); + void add(irep_idt caller, irep_idt callee); + void add(irep_idt caller, irep_idt callee, locationt callsite); call_grapht get_inverted() const; @@ -147,7 +144,7 @@ class call_grapht /// Find the graph node by function name /// \param function: function to find /// \return none if function is not in this graph, or some index otherwise. - std::optional get_node_index(const irep_idt &function) const; + std::optional get_node_index(irep_idt function) const; /// Type of the node name -> node index map. typedef std::unordered_map nodes_by_namet; @@ -163,8 +160,8 @@ class call_grapht directed_grapht get_directed_graph() const; protected: - void add(const irep_idt &function, - const goto_programt &body); + void add(irep_idt function, const goto_programt &body); + private: bool collect_callsites; std::string format_callsites(const edget &edge) const; diff --git a/src/analyses/call_graph_helpers.cpp b/src/analyses/call_graph_helpers.cpp index 0723e3eb181..836b2b33835 100644 --- a/src/analyses/call_graph_helpers.cpp +++ b/src/analyses/call_graph_helpers.cpp @@ -17,7 +17,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com /// \param forwards: if true, get callees; otherwise get callers. static std::set get_neighbours( const call_grapht::directed_grapht &graph, - const irep_idt &function, + irep_idt function, bool forwards) { std::set result; @@ -28,14 +28,14 @@ static std::set get_neighbours( return result; } -std::set get_callees( - const call_grapht::directed_grapht &graph, const irep_idt &function) +std::set +get_callees(const call_grapht::directed_grapht &graph, irep_idt function) { return get_neighbours(graph, function, true); } -std::set get_callers( - const call_grapht::directed_grapht &graph, const irep_idt &function) +std::set +get_callers(const call_grapht::directed_grapht &graph, irep_idt function) { return get_neighbours(graph, function, false); } @@ -48,7 +48,7 @@ std::set get_callers( /// that can reach the given function. static std::set get_connected_functions( const call_grapht::directed_grapht &graph, - const irep_idt &function, + irep_idt function, bool forwards) { std::vector connected_nodes = @@ -60,13 +60,15 @@ static std::set get_connected_functions( } std::set get_reachable_functions( - const call_grapht::directed_grapht &graph, const irep_idt &function) + const call_grapht::directed_grapht &graph, + irep_idt function) { return get_connected_functions(graph, function, true); } std::set get_reaching_functions( - const call_grapht::directed_grapht &graph, const irep_idt &function) + const call_grapht::directed_grapht &graph, + irep_idt function) { return get_connected_functions(graph, function, false); } @@ -90,7 +92,7 @@ std::set get_functions_reachable_within_n_steps( std::set get_functions_reachable_within_n_steps( const call_grapht::directed_grapht &graph, - const irep_idt &start_function, + irep_idt start_function, std::size_t n) { std::set start_functions({start_function}); @@ -99,15 +101,15 @@ std::set get_functions_reachable_within_n_steps( void disconnect_unreachable_functions( call_grapht::directed_grapht &graph, - const irep_idt &function) + irep_idt function) { graph.disconnect_unreachable(*(graph.get_node_index(function))); } std::list get_shortest_function_path( const call_grapht::directed_grapht &graph, - const irep_idt &src, - const irep_idt &dest) + irep_idt src, + irep_idt dest) { std::list result; std::list path; diff --git a/src/analyses/call_graph_helpers.h b/src/analyses/call_graph_helpers.h index 202590e5543..db559a4319e 100644 --- a/src/analyses/call_graph_helpers.h +++ b/src/analyses/call_graph_helpers.h @@ -25,29 +25,31 @@ Author: Chris Smowton, chris.smowton@diffblue.com /// \param graph: call graph /// \param function: function to query /// \return set of called functions -std::set get_callees( - const call_grapht::directed_grapht &graph, const irep_idt &function); +std::set +get_callees(const call_grapht::directed_grapht &graph, irep_idt function); /// Get functions that call a given function /// \param graph: call graph /// \param function: function to query /// \return set of caller functions -std::set get_callers( - const call_grapht::directed_grapht &graph, const irep_idt &function); +std::set +get_callers(const call_grapht::directed_grapht &graph, irep_idt function); /// Get functions reachable from a given function /// \param graph: call graph /// \param function: function to query /// \return set of reachable functions, including `function` std::set get_reachable_functions( - const call_grapht::directed_grapht &graph, const irep_idt &function); + const call_grapht::directed_grapht &graph, + irep_idt function); /// Get functions that can reach a given function /// \param graph: call graph /// \param function: function to query /// \return set of functions that can reach the target, including `function` std::set get_reaching_functions( - const call_grapht::directed_grapht &graph, const irep_idt &function); + const call_grapht::directed_grapht &graph, + irep_idt function); /// Get either callers or callees reachable from a given /// list of functions within N steps @@ -70,7 +72,7 @@ std::set get_functions_reachable_within_n_steps( /// including the start function std::set get_functions_reachable_within_n_steps( const call_grapht::directed_grapht &graph, - const irep_idt &start_function, + irep_idt start_function, std::size_t n); /// Get list of functions on the shortest path between two functions @@ -80,8 +82,8 @@ std::set get_functions_reachable_within_n_steps( /// \return list of functions on shortest path std::list get_shortest_function_path( const call_grapht::directed_grapht &graph, - const irep_idt &src, - const irep_idt &dest); + irep_idt src, + irep_idt dest); /// Disconnects all functions in the call graph that are unreachable from /// a given start function. @@ -92,6 +94,6 @@ std::list get_shortest_function_path( /// \param function: start function void disconnect_unreachable_functions( call_grapht::directed_grapht &graph, - const irep_idt &function); + irep_idt function); #endif diff --git a/src/analyses/constant_propagator.cpp b/src/analyses/constant_propagator.cpp index d0fb72f8f0e..2d77023f9df 100644 --- a/src/analyses/constant_propagator.cpp +++ b/src/analyses/constant_propagator.cpp @@ -122,9 +122,9 @@ void constant_propagator_domaint::assign_rec( } void constant_propagator_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) @@ -426,7 +426,7 @@ class constant_propagator_can_forward_propagatet : public can_forward_propagatet { } - bool is_constant(const irep_idt &id) const + bool is_constant(irep_idt id) const { return replace_const.replaces_symbol(id); } @@ -451,7 +451,7 @@ bool constant_propagator_domaint::valuest::is_constant( } bool constant_propagator_domaint::valuest::is_constant( - const irep_idt &id, + irep_idt id, const namespacet &ns) const { return constant_propagator_can_forward_propagatet(replace_const, ns) diff --git a/src/analyses/constant_propagator.h b/src/analyses/constant_propagator.h index fd249904404..297d1548675 100644 --- a/src/analyses/constant_propagator.h +++ b/src/analyses/constant_propagator.h @@ -34,9 +34,9 @@ class constant_propagator_domaint:public ai_domain_baset { public: virtual void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai_base, const namespacet &ns) final override; @@ -120,7 +120,7 @@ class constant_propagator_domaint:public ai_domain_baset bool is_constant(const exprt &expr, const namespacet &ns) const; - bool is_constant(const irep_idt &id, const namespacet &ns) const; + bool is_constant(irep_idt id, const namespacet &ns) const; bool is_empty() const { @@ -201,7 +201,7 @@ class constant_propagator_ait:public ait } constant_propagator_ait( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &goto_function, const namespacet &ns, should_track_valuet should_track_value = track_all_values) diff --git a/src/analyses/custom_bitvector_analysis.cpp b/src/analyses/custom_bitvector_analysis.cpp index 6e3a56a16e7..a89a7ac6511 100644 --- a/src/analyses/custom_bitvector_analysis.cpp +++ b/src/analyses/custom_bitvector_analysis.cpp @@ -22,7 +22,7 @@ Author: Daniel Kroening, kroening@kroening.com #include void custom_bitvector_domaint::set_bit( - const irep_idt &identifier, + irep_idt identifier, unsigned bit_nr, modet mode) { @@ -118,7 +118,7 @@ void custom_bitvector_domaint::assign_lhs( } void custom_bitvector_domaint::assign_lhs( - const irep_idt &identifier, + irep_idt identifier, const vectorst &vectors) { // we erase blank ones to avoid noise @@ -135,7 +135,7 @@ void custom_bitvector_domaint::assign_lhs( } custom_bitvector_domaint::vectorst - custom_bitvector_domaint::get_rhs(const irep_idt &identifier) const +custom_bitvector_domaint::get_rhs(irep_idt identifier) const { vectorst vectors; @@ -269,9 +269,9 @@ void custom_bitvector_domaint::assign_struct_rec( } void custom_bitvector_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/custom_bitvector_analysis.h b/src/analyses/custom_bitvector_analysis.h index 786811365dd..788dc0d8fcd 100644 --- a/src/analyses/custom_bitvector_analysis.h +++ b/src/analyses/custom_bitvector_analysis.h @@ -24,9 +24,9 @@ class custom_bitvector_domaint:public ai_domain_baset { public: void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; @@ -98,9 +98,9 @@ class custom_bitvector_domaint:public ai_domain_baset const namespacet &); void assign_lhs(const exprt &, const vectorst &); - void assign_lhs(const irep_idt &, const vectorst &); + void assign_lhs(irep_idt, const vectorst &); vectorst get_rhs(const exprt &) const; - vectorst get_rhs(const irep_idt &) const; + vectorst get_rhs(irep_idt) const; tvt has_values; @@ -117,7 +117,7 @@ class custom_bitvector_domaint:public ai_domain_baset enum class modet { SET_MUST, CLEAR_MUST, SET_MAY, CLEAR_MAY }; void set_bit(const exprt &, unsigned bit_nr, modet); - void set_bit(const irep_idt &, unsigned bit_nr, modet); + void set_bit(irep_idt, unsigned bit_nr, modet); static inline void set_bit(bit_vectort &dest, unsigned bit_nr) { diff --git a/src/analyses/dependence_graph.cpp b/src/analyses/dependence_graph.cpp index efb7c6ae8fc..73240ad02f0 100644 --- a/src/analyses/dependence_graph.cpp +++ b/src/analyses/dependence_graph.cpp @@ -50,7 +50,7 @@ bool dep_graph_domaint::merge( } void dep_graph_domaint::control_dependencies( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett from, goto_programt::const_targett to, dependence_grapht &dep_graph) @@ -153,7 +153,7 @@ static bool may_be_def_use_pair( void dep_graph_domaint::data_dependencies( goto_programt::const_targett, - const irep_idt &function_to, + irep_idt function_to, goto_programt::const_targett to, dependence_grapht &dep_graph, const namespacet &ns) @@ -215,9 +215,9 @@ void dep_graph_domaint::data_dependencies( } void dep_graph_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/dependence_graph.h b/src/analyses/dependence_graph.h index c053dc2a699..573282efd20 100644 --- a/src/analyses/dependence_graph.h +++ b/src/analyses/dependence_graph.h @@ -79,9 +79,9 @@ class dep_graph_domaint:public ai_domain_baset bool merge(const dep_graph_domaint &src, trace_ptrt from, trace_ptrt to); void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; @@ -200,14 +200,14 @@ class dep_graph_domaint:public ai_domain_baset dependence_graph_test_get_data_deps(const dep_graph_domaint &); void control_dependencies( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett from, goto_programt::const_targett to, dependence_grapht &dep_graph); void data_dependencies( goto_programt::const_targett from, - const irep_idt &function_to, + irep_idt function_to, goto_programt::const_targett to, dependence_grapht &dep_graph, const namespacet &ns); @@ -243,7 +243,7 @@ class dependence_grapht: } } - void initialize(const irep_idt &function, const goto_programt &goto_program) + void initialize(irep_idt function, const goto_programt &goto_program) { ait::initialize(function, goto_program); diff --git a/src/analyses/dirty.cpp b/src/analyses/dirty.cpp index 941d6b79622..a52e36d3c4e 100644 --- a/src/analyses/dirty.cpp +++ b/src/analyses/dirty.cpp @@ -110,7 +110,7 @@ void dirtyt::output(std::ostream &out) const /// \param id: function id to analyse /// \param function: function to analyse void incremental_dirtyt::populate_dirty_for_function( - const irep_idt &id, + irep_idt id, const goto_functionst::goto_functiont &function) { auto insert_result = dirty_processed_functions.insert(id); diff --git a/src/analyses/dirty.h b/src/analyses/dirty.h index 0f91890e333..326760041c8 100644 --- a/src/analyses/dirty.h +++ b/src/analyses/dirty.h @@ -63,7 +63,7 @@ class dirtyt void output(std::ostream &out) const; - bool operator()(const irep_idt &id) const + bool operator()(irep_idt id) const { die_if_uninitialized(); return dirty.find(id) != dirty.end(); @@ -118,10 +118,10 @@ class incremental_dirtyt { public: void populate_dirty_for_function( - const irep_idt &id, + irep_idt id, const goto_functionst::goto_functiont &function); - bool operator()(const irep_idt &id) const + bool operator()(irep_idt id) const { return dirty(id); } diff --git a/src/analyses/escape_analysis.cpp b/src/analyses/escape_analysis.cpp index 5e85c86248c..6f14d813d18 100644 --- a/src/analyses/escape_analysis.cpp +++ b/src/analyses/escape_analysis.cpp @@ -165,9 +165,9 @@ void escape_domaint::get_rhs_aliases_address_of( } void escape_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/escape_analysis.h b/src/analyses/escape_analysis.h index c5cb40ec9f6..a1688a0a59f 100644 --- a/src/analyses/escape_analysis.h +++ b/src/analyses/escape_analysis.h @@ -27,9 +27,9 @@ class escape_domaint:public ai_domain_baset } void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; diff --git a/src/analyses/flow_insensitive_analysis.cpp b/src/analyses/flow_insensitive_analysis.cpp index 23baf81a93f..98ca065571b 100644 --- a/src/analyses/flow_insensitive_analysis.cpp +++ b/src/analyses/flow_insensitive_analysis.cpp @@ -47,8 +47,9 @@ void flow_insensitive_analysis_baset::operator()( fixedpoint(goto_functions); } -void flow_insensitive_analysis_baset:: -operator()(const irep_idt &function_id, const goto_programt &goto_program) +void flow_insensitive_analysis_baset::operator()( + irep_idt function_id, + const goto_programt &goto_program) { initialize(goto_program); goto_functionst goto_functions; @@ -69,7 +70,7 @@ void flow_insensitive_analysis_baset::output( } void flow_insensitive_analysis_baset::output( - const irep_idt &, + irep_idt, const goto_programt &, std::ostream &out) { @@ -94,7 +95,7 @@ flow_insensitive_analysis_baset::get_next( } bool flow_insensitive_analysis_baset::fixedpoint( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const goto_functionst &goto_functions) { @@ -123,7 +124,7 @@ bool flow_insensitive_analysis_baset::fixedpoint( } bool flow_insensitive_analysis_baset::visit( - const irep_idt &function_id, + irep_idt function_id, locationt l, working_sett &working_set, const goto_programt &goto_program, @@ -188,7 +189,7 @@ bool flow_insensitive_analysis_baset::visit( } bool flow_insensitive_analysis_baset::do_function_call( - const irep_idt &calling_function, + irep_idt calling_function, locationt l_call, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, @@ -271,7 +272,7 @@ bool flow_insensitive_analysis_baset::do_function_call( } bool flow_insensitive_analysis_baset::do_function_call_rec( - const irep_idt &calling_function, + irep_idt calling_function, locationt l_call, const exprt &function, const exprt::operandst &arguments, diff --git a/src/analyses/flow_insensitive_analysis.h b/src/analyses/flow_insensitive_analysis.h index 15689382bd2..def3d84b93d 100644 --- a/src/analyses/flow_insensitive_analysis.h +++ b/src/analyses/flow_insensitive_analysis.h @@ -47,9 +47,9 @@ class flow_insensitive_abstract_domain_baset virtual bool transform( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from, - const irep_idt &function_to, + irep_idt function_to, locationt to) = 0; virtual ~flow_insensitive_abstract_domain_baset() @@ -129,7 +129,7 @@ class flow_insensitive_analysis_baset virtual void update(const goto_functionst &goto_functions); virtual void - operator()(const irep_idt &function_id, const goto_programt &goto_program); + operator()(irep_idt function_id, const goto_programt &goto_program); virtual void operator()( const goto_functionst &goto_functions); @@ -148,7 +148,7 @@ class flow_insensitive_analysis_baset std::ostream &out); virtual void output( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, std::ostream &out); @@ -172,7 +172,7 @@ class flow_insensitive_analysis_baset // true = found something new bool fixedpoint( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const goto_functionst &goto_functions); @@ -181,7 +181,7 @@ class flow_insensitive_analysis_baset // true = found something new bool visit( - const irep_idt &function_id, + irep_idt function_id, locationt l, working_sett &working_set, const goto_programt &goto_program, @@ -203,7 +203,7 @@ class flow_insensitive_analysis_baset // function calls bool do_function_call_rec( - const irep_idt &calling_function, + irep_idt calling_function, locationt l_call, const exprt &function, const exprt::operandst &arguments, @@ -211,7 +211,7 @@ class flow_insensitive_analysis_baset const goto_functionst &goto_functions); bool do_function_call( - const irep_idt &calling_function, + irep_idt calling_function, locationt l_call, const goto_functionst &goto_functions, const goto_functionst::function_mapt::const_iterator f_it, diff --git a/src/analyses/global_may_alias.cpp b/src/analyses/global_may_alias.cpp index 812737517ec..97ed37b53f2 100644 --- a/src/analyses/global_may_alias.cpp +++ b/src/analyses/global_may_alias.cpp @@ -93,9 +93,9 @@ void global_may_alias_domaint::get_rhs_aliases_address_of( } void global_may_alias_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/global_may_alias.h b/src/analyses/global_may_alias.h index 91935163ad6..7b948c092c5 100644 --- a/src/analyses/global_may_alias.h +++ b/src/analyses/global_may_alias.h @@ -27,9 +27,9 @@ class global_may_alias_domaint:public ai_domain_baset /// Abstract Interpretation domain transform function. void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; diff --git a/src/analyses/goto_rw.cpp b/src/analyses/goto_rw.cpp index 312540e22e7..685e0e3e390 100644 --- a/src/analyses/goto_rw.cpp +++ b/src/analyses/goto_rw.cpp @@ -519,7 +519,7 @@ void rw_range_sett::get_objects_address_of(const exprt &object) void rw_range_sett::add( get_modet mode, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end) { @@ -662,7 +662,7 @@ void rw_range_sett::get_objects_rec(const typet &type) } void rw_range_sett::get_array_objects( - const irep_idt &, + irep_idt, goto_programt::const_targett, get_modet mode, const exprt &pointer) @@ -757,7 +757,7 @@ void rw_guarded_range_set_value_sett::get_objects_if( void rw_guarded_range_set_value_sett::add( get_modet mode, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end) { @@ -776,7 +776,7 @@ void rw_guarded_range_set_value_sett::add( } static void goto_rw_assign( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, const exprt &lhs, const exprt &rhs, @@ -788,7 +788,7 @@ static void goto_rw_assign( } static void goto_rw_other( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, const codet &code, rw_range_sett &rw_set) @@ -843,7 +843,7 @@ static void goto_rw_other( } static void goto_rw( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, const exprt &lhs, const exprt &function_expr, @@ -865,7 +865,7 @@ static void goto_rw( } void goto_rw( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, rw_range_sett &rw_set) { @@ -933,7 +933,7 @@ void goto_rw( } void goto_rw( - const irep_idt &function, + irep_idt function, const goto_programt &goto_program, rw_range_sett &rw_set) { @@ -941,9 +941,10 @@ void goto_rw( goto_rw(function, i_it, rw_set); } -void goto_rw(const goto_functionst &goto_functions, - const irep_idt &function, - rw_range_sett &rw_set) +void goto_rw( + const goto_functionst &goto_functions, + irep_idt function, + rw_range_sett &rw_set) { goto_functionst::function_mapt::const_iterator f_it= goto_functions.function_map.find(function); diff --git a/src/analyses/goto_rw.h b/src/analyses/goto_rw.h index 43391173885..c997d6ec0f2 100644 --- a/src/analyses/goto_rw.h +++ b/src/analyses/goto_rw.h @@ -27,18 +27,13 @@ class message_handlert; class rw_range_sett; void goto_rw( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, rw_range_sett &rw_set); -void goto_rw( - const irep_idt &function, - const goto_programt &, - rw_range_sett &rw_set); +void goto_rw(irep_idt function, const goto_programt &, rw_range_sett &rw_set); -void goto_rw(const goto_functionst &, - const irep_idt &function, - rw_range_sett &rw_set); +void goto_rw(const goto_functionst &, irep_idt function, rw_range_sett &rw_set); class range_domain_baset { @@ -234,7 +229,7 @@ class rw_range_sett enum class get_modet { LHS_W, READ }; virtual void get_objects_rec( - const irep_idt &, + irep_idt, goto_programt::const_targett, get_modet mode, const exprt &expr) @@ -242,16 +237,14 @@ class rw_range_sett get_objects_rec(mode, expr); } - virtual void get_objects_rec( - const irep_idt &, - goto_programt::const_targett, - const typet &type) + virtual void + get_objects_rec(irep_idt, goto_programt::const_targett, const typet &type) { get_objects_rec(type); } virtual void get_array_objects( - const irep_idt &, + irep_idt, goto_programt::const_targett, get_modet, const exprt &); @@ -348,7 +341,7 @@ class rw_range_sett virtual void add( get_modet mode, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end); }; @@ -375,7 +368,7 @@ class rw_range_set_value_sett:public rw_range_sett } void get_objects_rec( - const irep_idt &_function, + irep_idt _function, goto_programt::const_targett _target, get_modet mode, const exprt &expr) override @@ -387,7 +380,7 @@ class rw_range_set_value_sett:public rw_range_sett } void get_objects_rec( - const irep_idt &_function, + irep_idt _function, goto_programt::const_targett _target, const typet &type) override { @@ -398,7 +391,7 @@ class rw_range_set_value_sett:public rw_range_sett } void get_array_objects( - const irep_idt &_function, + irep_idt _function, goto_programt::const_targett _target, get_modet mode, const exprt &pointer) override @@ -478,7 +471,7 @@ class rw_guarded_range_set_value_sett:public rw_range_set_value_sett } void get_objects_rec( - const irep_idt &_function, + irep_idt _function, goto_programt::const_targett _target, get_modet mode, const exprt &expr) override @@ -489,7 +482,7 @@ class rw_guarded_range_set_value_sett:public rw_range_set_value_sett } void get_objects_rec( - const irep_idt &function, + irep_idt function, goto_programt::const_targett target, const typet &type) override { @@ -510,7 +503,7 @@ class rw_guarded_range_set_value_sett:public rw_range_set_value_sett void add( get_modet mode, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end) override; }; diff --git a/src/analyses/interval_domain.cpp b/src/analyses/interval_domain.cpp index dcc22a1ac34..18f82dfc5a6 100644 --- a/src/analyses/interval_domain.cpp +++ b/src/analyses/interval_domain.cpp @@ -57,9 +57,9 @@ void interval_domaint::output( } void interval_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/interval_domain.h b/src/analyses/interval_domain.h index 31638097c4a..08530f2f7f7 100644 --- a/src/analyses/interval_domain.h +++ b/src/analyses/interval_domain.h @@ -32,9 +32,9 @@ class interval_domaint:public ai_domain_baset } void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; diff --git a/src/analyses/invariant_propagation.cpp b/src/analyses/invariant_propagation.cpp index a8fb79e2a77..3ad7d1754df 100644 --- a/src/analyses/invariant_propagation.cpp +++ b/src/analyses/invariant_propagation.cpp @@ -241,7 +241,7 @@ bool invariant_propagationt::check_type(const typet &type) const } void invariant_propagationt::initialize( - const irep_idt &function, + irep_idt function, const goto_programt &goto_program) { baset::initialize(function, goto_program); diff --git a/src/analyses/invariant_propagation.h b/src/analyses/invariant_propagation.h index 09bf46207f4..7dbc1eea65d 100644 --- a/src/analyses/invariant_propagation.h +++ b/src/analyses/invariant_propagation.h @@ -29,8 +29,8 @@ class invariant_propagationt:public return (*this)[l].invariant_set; } - void initialize(const irep_idt &function, const goto_programt &goto_program) - override; + void + initialize(irep_idt function, const goto_programt &goto_program) override; void make_all_true(); void make_all_false(); diff --git a/src/analyses/invariant_set_domain.cpp b/src/analyses/invariant_set_domain.cpp index cdcb145d02a..241d0ee515a 100644 --- a/src/analyses/invariant_set_domain.cpp +++ b/src/analyses/invariant_set_domain.cpp @@ -15,9 +15,9 @@ Author: Daniel Kroening, kroening@kroening.com #include void invariant_set_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) diff --git a/src/analyses/invariant_set_domain.h b/src/analyses/invariant_set_domain.h index cc6f8c0aa0e..1a984d87580 100644 --- a/src/analyses/invariant_set_domain.h +++ b/src/analyses/invariant_set_domain.h @@ -54,9 +54,9 @@ class invariant_set_domaint:public ai_domain_baset } virtual void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; diff --git a/src/analyses/is_threaded.cpp b/src/analyses/is_threaded.cpp index 631f4d19c03..b39e0d0b14f 100644 --- a/src/analyses/is_threaded.cpp +++ b/src/analyses/is_threaded.cpp @@ -44,9 +44,9 @@ class is_threaded_domaint:public ai_domain_baset } void transform( - const irep_idt &, + irep_idt, trace_ptrt trace_from, - const irep_idt &, + irep_idt, trace_ptrt, ai_baset &, const namespacet &) override diff --git a/src/analyses/local_bitvector_analysis.cpp b/src/analyses/local_bitvector_analysis.cpp index 20907f36f5f..2c60f758b66 100644 --- a/src/analyses/local_bitvector_analysis.cpp +++ b/src/analyses/local_bitvector_analysis.cpp @@ -52,7 +52,7 @@ bool local_bitvector_analysist::merge(points_tot &a, points_tot &b) } /// \return return 'true' iff we track the object with given identifier -bool local_bitvector_analysist::is_tracked(const irep_idt &identifier) +bool local_bitvector_analysist::is_tracked(irep_idt identifier) { localst::locals_sett::const_iterator it = locals.locals.find(identifier); return it != locals.locals.end() && ns.lookup(*it).type.id() == ID_pointer && diff --git a/src/analyses/local_bitvector_analysis.h b/src/analyses/local_bitvector_analysis.h index 429a1d2ad24..1e172b3b069 100644 --- a/src/analyses/local_bitvector_analysis.h +++ b/src/analyses/local_bitvector_analysis.h @@ -201,7 +201,7 @@ class local_bitvector_analysist const exprt &rhs, points_tot &loc_info_src); - bool is_tracked(const irep_idt &identifier); + bool is_tracked(irep_idt identifier); }; inline std::ostream &operator<<( diff --git a/src/analyses/local_may_alias.h b/src/analyses/local_may_alias.h index febc741dbae..b28222e47ba 100644 --- a/src/analyses/local_may_alias.h +++ b/src/analyses/local_may_alias.h @@ -109,7 +109,7 @@ class local_may_alias_factoryt } } - local_may_aliast &operator()(const irep_idt &fkt) + local_may_aliast &operator()(irep_idt fkt) { PRECONDITION(goto_functions!=nullptr); fkt_mapt::iterator f_it=fkt_map.find(fkt); diff --git a/src/analyses/locals.h b/src/analyses/locals.h index 5b275223597..b98d4b3079a 100644 --- a/src/analyses/locals.h +++ b/src/analyses/locals.h @@ -34,7 +34,7 @@ class localst // Returns true for all procedure-local variables, // not including those with static storage duration, // but including the function parameters. - bool is_local(const irep_idt &identifier) const + bool is_local(irep_idt identifier) const { return locals.find(identifier) != locals.end(); } diff --git a/src/analyses/reaching_definitions.cpp b/src/analyses/reaching_definitions.cpp index c5d4adeb209..0285246e266 100644 --- a/src/analyses/reaching_definitions.cpp +++ b/src/analyses/reaching_definitions.cpp @@ -70,7 +70,7 @@ reaching_definitions_analysist::~reaching_definitions_analysist()=default; /// /// This function is only used to fill in the cache `export_cache` for the /// `output` method. -void rd_range_domaint::populate_cache(const irep_idt &identifier) const +void rd_range_domaint::populate_cache(irep_idt identifier) const { PRECONDITION(bv_container); @@ -91,9 +91,9 @@ void rd_range_domaint::populate_cache(const irep_idt &identifier) const } void rd_range_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) @@ -177,9 +177,9 @@ void rd_range_domaint::transform_start_thread( void rd_range_domaint::transform_function_call( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from, - const irep_idt &function_to, + irep_idt function_to, reaching_definitions_analysist &rd) { // only if there is an actual call, i.e., we have a body @@ -242,9 +242,9 @@ void rd_range_domaint::transform_function_call( void rd_range_domaint::transform_end_function( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from, - const irep_idt &function_to, + irep_idt function_to, locationt to, reaching_definitions_analysist &rd) { @@ -305,7 +305,7 @@ void rd_range_domaint::transform_end_function( void rd_range_domaint::transform_assign( const namespacet &ns, locationt from, - const irep_idt &function_to, + irep_idt function_to, locationt to, reaching_definitions_analysist &rd) { @@ -341,7 +341,7 @@ void rd_range_domaint::transform_assign( } void rd_range_domaint::kill( - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end) { @@ -440,9 +440,7 @@ void rd_range_domaint::kill( } } -void rd_range_domaint::kill_inf( - const irep_idt &, - const range_spect &range_start) +void rd_range_domaint::kill_inf(irep_idt, const range_spect &range_start) { PRECONDITION(range_start >= range_spect{0}); @@ -480,7 +478,7 @@ void rd_range_domaint::kill_inf( /// by `range_start` and `range_end`. bool rd_range_domaint::gen( locationt from, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end) { @@ -718,8 +716,8 @@ bool rd_range_domaint::merge_shared( return changed; } -const rd_range_domaint::ranges_at_loct &rd_range_domaint::get( - const irep_idt &identifier) const +const rd_range_domaint::ranges_at_loct & +rd_range_domaint::get(irep_idt identifier) const { populate_cache(identifier); diff --git a/src/analyses/reaching_definitions.h b/src/analyses/reaching_definitions.h index faa8c46224a..e16b0a4b8cb 100644 --- a/src/analyses/reaching_definitions.h +++ b/src/analyses/reaching_definitions.h @@ -96,7 +96,7 @@ struct reaching_definitiont range_spect bit_end; reaching_definitiont( - const irep_idt &identifier, + irep_idt identifier, const ai_domain_baset::locationt &definition_at, const range_spect &bit_begin, const range_spect &bit_end) @@ -182,9 +182,9 @@ class rd_range_domaint:public ai_domain_baset /// \param ai: A reference to 'reaching_definitions_analysist' instance. /// \param ns: Just passed to callees. void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; @@ -252,8 +252,8 @@ class rd_range_domaint:public ai_domain_baset typedef std::map ranges_at_loct; - const ranges_at_loct &get(const irep_idt &identifier) const; - void clear_cache(const irep_idt &identifier) const + const ranges_at_loct &get(irep_idt identifier) const; + void clear_cache(irep_idt identifier) const { export_cache[identifier].clear(); } @@ -296,7 +296,7 @@ class rd_range_domaint:public ai_domain_baset /// moved to the `output` method or removed entirely. mutable export_cachet export_cache; - void populate_cache(const irep_idt &identifier) const; + void populate_cache(irep_idt identifier) const; void transform_dead( const namespacet &ns, @@ -306,34 +306,32 @@ class rd_range_domaint:public ai_domain_baset reaching_definitions_analysist &rd); void transform_function_call( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from, - const irep_idt &function_to, + irep_idt function_to, reaching_definitions_analysist &rd); void transform_end_function( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from, - const irep_idt &function_to, + irep_idt function_to, locationt to, reaching_definitions_analysist &rd); void transform_assign( const namespacet &ns, locationt from, - const irep_idt &function_to, + irep_idt function_to, locationt to, reaching_definitions_analysist &rd); void kill( - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end); - void kill_inf( - const irep_idt &identifier, - const range_spect &range_start); + void kill_inf(irep_idt identifier, const range_spect &range_start); bool gen( locationt from, - const irep_idt &identifier, + irep_idt identifier, const range_spect &range_start, const range_spect &range_end); diff --git a/src/analyses/uncaught_exceptions_analysis.cpp b/src/analyses/uncaught_exceptions_analysis.cpp index aa6b3c0e6e4..8764f2d620f 100644 --- a/src/analyses/uncaught_exceptions_analysis.cpp +++ b/src/analyses/uncaught_exceptions_analysis.cpp @@ -39,8 +39,7 @@ exprt uncaught_exceptions_domaint::get_exception_symbol(const exprt &expr) } /// The join operator for the uncaught exceptions domain -void uncaught_exceptions_domaint::join( - const irep_idt &element) +void uncaught_exceptions_domaint::join(irep_idt element) { thrown.insert(element); } diff --git a/src/analyses/uncaught_exceptions_analysis.h b/src/analyses/uncaught_exceptions_analysis.h index 617371efdbc..17102769d91 100644 --- a/src/analyses/uncaught_exceptions_analysis.h +++ b/src/analyses/uncaught_exceptions_analysis.h @@ -32,7 +32,7 @@ class uncaught_exceptions_domaint uncaught_exceptions_analysist &, const namespacet &); - void join(const irep_idt &); + void join(irep_idt); void join(const std::set &); void join(const std::vector &); diff --git a/src/analyses/uninitialized_domain.cpp b/src/analyses/uninitialized_domain.cpp index fef7b2a8708..e8c19260fd7 100644 --- a/src/analyses/uninitialized_domain.cpp +++ b/src/analyses/uninitialized_domain.cpp @@ -18,9 +18,9 @@ Date: January 2010 #include void uninitialized_domaint::transform( - const irep_idt &, + irep_idt, trace_ptrt trace_from, - const irep_idt &, + irep_idt, trace_ptrt, ai_baset &, const namespacet &ns) diff --git a/src/analyses/uninitialized_domain.h b/src/analyses/uninitialized_domain.h index 89789dc4c09..61f448e6b4a 100644 --- a/src/analyses/uninitialized_domain.h +++ b/src/analyses/uninitialized_domain.h @@ -30,9 +30,9 @@ class uninitialized_domaint:public ai_domain_baset uninitializedt uninitialized; void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override; diff --git a/src/analyses/variable-sensitivity/abstract_environment.cpp b/src/analyses/variable-sensitivity/abstract_environment.cpp index c5fa3a3f6fd..f20ad83e1a2 100644 --- a/src/analyses/variable-sensitivity/abstract_environment.cpp +++ b/src/analyses/variable-sensitivity/abstract_environment.cpp @@ -86,7 +86,7 @@ static bool is_access_expr(const exprt &expr) expr.id() == ID_dereference; } -static bool is_object_creation(const irep_idt &id) +static bool is_object_creation(irep_idt id) { return id == ID_array || id == ID_struct || id == ID_constant || id == ID_address_of; diff --git a/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp b/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp index 76fb1a6d7b7..224eec403c1 100644 --- a/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp +++ b/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp @@ -321,7 +321,7 @@ static exprt to_bool_expr(bool v) } exprt struct_member_ptr_comparison_expr( - irep_idt const &id, + irep_idt id, exprt const &lhs, exprt const &rhs) { @@ -336,7 +336,7 @@ exprt struct_member_ptr_comparison_expr( } exprt symbol_ptr_comparison_expr( - irep_idt const &id, + irep_idt id, exprt const &lhs, exprt const &rhs) { diff --git a/src/analyses/variable-sensitivity/interval_abstract_value.cpp b/src/analyses/variable-sensitivity/interval_abstract_value.cpp index f939bbfea3e..8efd3bb35a6 100644 --- a/src/analyses/variable-sensitivity/interval_abstract_value.cpp +++ b/src/analyses/variable-sensitivity/interval_abstract_value.cpp @@ -172,7 +172,7 @@ static inline constant_interval_exprt make_interval_expr(const exprt &expr) } } -static inline irep_idt invert_relation(const irep_idt &relation) +static inline irep_idt invert_relation(irep_idt relation) { PRECONDITION( relation == ID_le || relation == ID_lt || relation == ID_ge || diff --git a/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.cpp b/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.cpp index 86b588e4c28..1807093c3ed 100644 --- a/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.cpp +++ b/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.cpp @@ -23,10 +23,10 @@ Date: August 2020 #include bool ai_three_way_merget::visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &callee_function_id, + irep_idt callee_function_id, working_sett &working_set, const goto_programt &callee, const goto_functionst &goto_functions, diff --git a/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.h b/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.h index e60d94f73b5..d3349543d6e 100644 --- a/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.h +++ b/src/analyses/variable-sensitivity/three_way_merge_abstract_interpreter.h @@ -45,10 +45,10 @@ class ai_three_way_merget : public ai_recursive_interproceduralt // Much of this is the same as ai_recursive_interproceduralt's handling but // on function return the three-way merge is used. bool visit_edge_function_call( - const irep_idt &calling_function_id, + irep_idt calling_function_id, trace_ptrt p_call, locationt l_return, - const irep_idt &callee_function_id, + irep_idt callee_function_id, working_sett &working_set, const goto_programt &callee, const goto_functionst &goto_functions, diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.cpp b/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.cpp index 80afe243632..73e136d5cea 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.cpp +++ b/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.cpp @@ -66,9 +66,9 @@ void variable_sensitivity_dependence_domaint::eval_data_deps( * \param ns: the namespace */ void variable_sensitivity_dependence_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) @@ -202,9 +202,9 @@ void variable_sensitivity_dependence_domaint::data_dependencies( } void variable_sensitivity_dependence_domaint::control_dependencies( - const irep_idt &from_function, + irep_idt from_function, goto_programt::const_targett from, - const irep_idt &to_function, + irep_idt to_function, goto_programt::const_targett to, variable_sensitivity_dependence_grapht &dep_graph) { diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.h b/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.h index c3a8cad69f3..1edb551a853 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.h +++ b/src/analyses/variable-sensitivity/variable_sensitivity_dependence_graph.h @@ -85,9 +85,9 @@ class variable_sensitivity_dependence_domaint } void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) override; @@ -193,9 +193,9 @@ class variable_sensitivity_dependence_domaint const; void control_dependencies( - const irep_idt &from_function, + irep_idt from_function, goto_programt::const_targett from, - const irep_idt &to_function, + irep_idt to_function, goto_programt::const_targett to, variable_sensitivity_dependence_grapht &dep_graph); @@ -247,8 +247,7 @@ class variable_sensitivity_dependence_grapht : public ai_three_way_merget, const vsd_configt &_configuration, message_handlert &message_handler); - void - initialize(const irep_idt &function_id, const goto_programt &goto_program) + void initialize(irep_idt function_id, const goto_programt &goto_program) { ai_recursive_interproceduralt::initialize(function_id, goto_program); } diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp b/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp index 10efb04e147..0010b26dd62 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp +++ b/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp @@ -22,9 +22,9 @@ Date: April 2016 #endif void variable_sensitivity_domaint::transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) @@ -401,7 +401,7 @@ void variable_sensitivity_domaint::transform_function_call( } bool variable_sensitivity_domaint::ignore_function_call_transform( - const irep_idt &function_id) const + irep_idt function_id) const { static const std::set ignored_internal_function = { CPROVER_PREFIX "set_must", @@ -437,7 +437,7 @@ void variable_sensitivity_domaint::merge_three_way_function_return( modified_symbol_names.begin(), modified_symbol_names.end(), std::back_inserter(modified_symbols), - [&ns](const irep_idt &id) { return ns.lookup(id).symbol_expr(); }); + [&ns](irep_idt id) { return ns.lookup(id).symbol_expr(); }); for(const auto &symbol : modified_symbols) { diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_domain.h b/src/analyses/variable-sensitivity/variable_sensitivity_domain.h index 707de155078..6a181e40bfb 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_domain.h +++ b/src/analyses/variable-sensitivity/variable_sensitivity_domain.h @@ -132,9 +132,9 @@ class variable_sensitivity_domaint : public ai_domain_baset /// \param ai: the abstract interpreter /// \param ns: the namespace void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt trace_from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) override; @@ -238,7 +238,7 @@ class variable_sensitivity_domaint : public ai_domain_baset /// \param function_id: the name of the function being called /// /// \return Returns true if the function should be ignored - bool ignore_function_call_transform(const irep_idt &function_id) const; + bool ignore_function_call_transform(irep_idt function_id) const; void assume(exprt expr, namespacet ns); diff --git a/src/ansi-c/allocate_objects.cpp b/src/ansi-c/allocate_objects.cpp index b691e06e0a9..ec9724c7c2a 100644 --- a/src/ansi-c/allocate_objects.cpp +++ b/src/ansi-c/allocate_objects.cpp @@ -36,7 +36,7 @@ exprt allocate_objectst::allocate_object( const exprt &target_expr, const typet &allocate_type, const lifetimet lifetime, - const irep_idt &basename_prefix) + irep_idt basename_prefix) { switch(lifetime) { @@ -73,7 +73,7 @@ exprt allocate_objectst::allocate_automatic_local_object( code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, - const irep_idt &basename_prefix) + irep_idt basename_prefix) { return allocate_non_dynamic_object( assignments, target_expr, allocate_type, false, basename_prefix); @@ -94,7 +94,7 @@ exprt allocate_objectst::allocate_static_global_object( code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, - const irep_idt &basename_prefix) + irep_idt basename_prefix) { return allocate_non_dynamic_object( assignments, target_expr, allocate_type, true, basename_prefix); @@ -108,7 +108,7 @@ exprt allocate_objectst::allocate_static_global_object( /// \return A symbol expression denoting the variable symbol_exprt allocate_objectst::allocate_automatic_local_object( const typet &allocate_type, - const irep_idt &basename_prefix) + irep_idt basename_prefix) { symbolt &aux_symbol = get_fresh_aux_symbol( allocate_type, @@ -185,7 +185,7 @@ exprt allocate_objectst::allocate_non_dynamic_object( const exprt &target_expr, const typet &allocate_type, const bool static_lifetime, - const irep_idt &basename_prefix) + irep_idt basename_prefix) { symbolt &aux_symbol = get_fresh_aux_symbol( allocate_type, diff --git a/src/ansi-c/allocate_objects.h b/src/ansi-c/allocate_objects.h index bdef7c5edf8..3b175fec292 100644 --- a/src/ansi-c/allocate_objects.h +++ b/src/ansi-c/allocate_objects.h @@ -27,9 +27,9 @@ class allocate_objectst { public: allocate_objectst( - const irep_idt &symbol_mode, + irep_idt symbol_mode, const source_locationt &source_location, - const irep_idt &name_prefix, + irep_idt name_prefix, symbol_table_baset &symbol_table) : symbol_mode(symbol_mode), source_location(source_location), @@ -44,19 +44,19 @@ class allocate_objectst const exprt &target_expr, const typet &allocate_type, const lifetimet lifetime, - const irep_idt &basename_prefix = "tmp"); + irep_idt basename_prefix = "tmp"); exprt allocate_automatic_local_object( code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, - const irep_idt &basename_prefix = "tmp"); + irep_idt basename_prefix = "tmp"); exprt allocate_static_global_object( code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, - const irep_idt &basename_prefix = "tmp"); + irep_idt basename_prefix = "tmp"); /// Generates code for allocating a dynamic object. A new variable with /// basename prefix `alloc_site` is introduced to which the allocated memory @@ -88,7 +88,7 @@ class allocate_objectst symbol_exprt allocate_automatic_local_object( const typet &allocate_type, - const irep_idt &basename_prefix = "tmp"); + irep_idt basename_prefix = "tmp"); void add_created_symbol(const symbolt &symbol); @@ -111,7 +111,7 @@ class allocate_objectst const exprt &target_expr, const typet &allocate_type, const bool static_lifetime, - const irep_idt &basename_prefix); + irep_idt basename_prefix); }; /// Create code allocating an object of size `size` and assigning it to `lhs` diff --git a/src/ansi-c/anonymous_member.cpp b/src/ansi-c/anonymous_member.cpp index e2ed779df93..6ee7e68c0cb 100644 --- a/src/ansi-c/anonymous_member.cpp +++ b/src/ansi-c/anonymous_member.cpp @@ -39,7 +39,7 @@ static member_exprt make_member_expr( exprt get_component_rec( const exprt &struct_union, - const irep_idt &component_name, + irep_idt component_name, const namespacet &ns) { const auto &tag_type = to_struct_or_union_tag_type(struct_union.type()); @@ -68,7 +68,7 @@ exprt get_component_rec( bool has_component_rec( const typet &type, - const irep_idt &component_name, + irep_idt component_name, const namespacet &ns) { const auto &tag_type = to_struct_or_union_tag_type(type); diff --git a/src/ansi-c/anonymous_member.h b/src/ansi-c/anonymous_member.h index ee490ddc4ab..085cb6cbd68 100644 --- a/src/ansi-c/anonymous_member.h +++ b/src/ansi-c/anonymous_member.h @@ -18,12 +18,12 @@ class namespacet; exprt get_component_rec( const exprt &struct_union, - const irep_idt &component_name, + irep_idt component_name, const namespacet &ns); bool has_component_rec( const typet &struct_union_type, - const irep_idt &component_name, + irep_idt component_name, const namespacet &ns); #endif // CPROVER_ANSI_C_ANONYMOUS_MEMBER_H diff --git a/src/ansi-c/ansi_c_declaration.h b/src/ansi-c/ansi_c_declaration.h index 7088c93f884..7e91de67e90 100644 --- a/src/ansi-c/ansi_c_declaration.h +++ b/src/ansi-c/ansi_c_declaration.h @@ -33,7 +33,7 @@ class ansi_c_declaratort : public nullary_exprt return static_cast(find(ID_value)); } - void set_name(const irep_idt &name) + void set_name(irep_idt name) { return set(ID_name, name); } @@ -48,7 +48,7 @@ class ansi_c_declaratort : public nullary_exprt return get(ID_base_name); } - void set_base_name(const irep_idt &base_name) + void set_base_name(irep_idt base_name) { return set(ID_base_name, base_name); } diff --git a/src/ansi-c/ansi_c_parser.cpp b/src/ansi-c/ansi_c_parser.cpp index 749d9f92fa5..dc178e6dc7e 100644 --- a/src/ansi-c/ansi_c_parser.cpp +++ b/src/ansi-c/ansi_c_parser.cpp @@ -11,7 +11,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "c_storage_spec.h" ansi_c_id_classt ansi_c_parsert::lookup( - const irep_idt &base_name, + irep_idt base_name, irep_idt &identifier, // output bool tag, bool label) @@ -181,9 +181,7 @@ void ansi_c_parsert::pragma_cprover_pop() pragma_cprover_stack.pop_back(); } -void ansi_c_parsert::pragma_cprover_add_check( - const irep_idt &name, - bool enabled) +void ansi_c_parsert::pragma_cprover_add_check(irep_idt name, bool enabled) { if(pragma_cprover_stack.empty()) pragma_cprover_push(); @@ -191,7 +189,7 @@ void ansi_c_parsert::pragma_cprover_add_check( pragma_cprover_stack.back()[name] = enabled; } -bool ansi_c_parsert::pragma_cprover_clash(const irep_idt &name, bool enabled) +bool ansi_c_parsert::pragma_cprover_clash(irep_idt name, bool enabled) { auto top = pragma_cprover_stack.back(); auto found = top.find(name); diff --git a/src/ansi-c/ansi_c_parser.h b/src/ansi-c/ansi_c_parser.h index 169a74dc4cf..7354729fd1a 100644 --- a/src/ansi-c/ansi_c_parser.h +++ b/src/ansi-c/ansi_c_parser.h @@ -123,7 +123,7 @@ class ansi_c_parsert:public parsert } ansi_c_id_classt lookup( - const irep_idt &base_name, // in + irep_idt base_name, // in irep_idt &identifier, // out bool tag, bool label); @@ -147,11 +147,11 @@ class ansi_c_parsert:public parsert void pragma_cprover_pop(); /// \brief Adds a check to the CPROVER pragma stack - void pragma_cprover_add_check(const irep_idt &name, bool enabled); + void pragma_cprover_add_check(irep_idt name, bool enabled); /// Returns true iff the same check with polarity /// is already present at top of the stack - bool pragma_cprover_clash(const irep_idt &name, bool enabled); + bool pragma_cprover_clash(irep_idt name, bool enabled); /// \brief Tags \ref source_location with /// the current CPROVER pragma stack diff --git a/src/ansi-c/builtin_factory.cpp b/src/ansi-c/builtin_factory.cpp index 172cb96b05a..b4f15dcb468 100644 --- a/src/ansi-c/builtin_factory.cpp +++ b/src/ansi-c/builtin_factory.cpp @@ -40,7 +40,7 @@ static bool find_pattern( } static bool convert( - const irep_idt &identifier, + irep_idt identifier, const std::ostringstream &s, symbol_table_baset &symbol_table, message_handlert &message_handler) @@ -102,7 +102,7 @@ static bool convert( //! If so, add declaration to symbol table. //! \return 'true' on error bool builtin_factory( - const irep_idt &identifier, + irep_idt identifier, bool support_float16_type, symbol_table_baset &symbol_table, message_handlert &mh) diff --git a/src/ansi-c/builtin_factory.h b/src/ansi-c/builtin_factory.h index 6a74b3c6759..520b12c05f4 100644 --- a/src/ansi-c/builtin_factory.h +++ b/src/ansi-c/builtin_factory.h @@ -16,7 +16,7 @@ class symbol_table_baset; //! \return 'true' in case of error bool builtin_factory( - const irep_idt &identifier, + irep_idt identifier, bool support_float16_type, symbol_table_baset &, message_handlert &); diff --git a/src/ansi-c/c_expr.h b/src/ansi-c/c_expr.h index d0bac3fc77b..7fe73259f9f 100644 --- a/src/ansi-c/c_expr.h +++ b/src/ansi-c/c_expr.h @@ -118,7 +118,7 @@ class side_effect_expr_overflowt : public side_effect_exprt { public: side_effect_expr_overflowt( - const irep_idt &kind, + irep_idt kind, exprt _lhs, exprt _rhs, exprt _result, @@ -205,7 +205,7 @@ inline side_effect_expr_overflowt &to_side_effect_expr_overflow(exprt &expr) class history_exprt : public unary_exprt { public: - explicit history_exprt(exprt variable, const irep_idt &id) + explicit history_exprt(exprt variable, irep_idt id) : unary_exprt(id, std::move(variable)) { } @@ -216,8 +216,7 @@ class history_exprt : public unary_exprt } }; -inline const history_exprt & -to_history_expr(const exprt &expr, const irep_idt &id) +inline const history_exprt &to_history_expr(const exprt &expr, irep_idt id) { PRECONDITION(id == ID_old || id == ID_loop_entry); PRECONDITION(expr.id() == id); diff --git a/src/ansi-c/c_nondet_symbol_factory.h b/src/ansi-c/c_nondet_symbol_factory.h index 2d7d768233c..b57f0bb090c 100644 --- a/src/ansi-c/c_nondet_symbol_factory.h +++ b/src/ansi-c/c_nondet_symbol_factory.h @@ -35,7 +35,7 @@ class symbol_factoryt symbol_factoryt( symbol_table_baset &_symbol_table, const source_locationt &loc, - const irep_idt &name_prefix, + irep_idt name_prefix, const c_object_factory_parameterst &object_factory_params, const lifetimet lifetime) : symbol_table(_symbol_table), diff --git a/src/ansi-c/c_typecheck_base.cpp b/src/ansi-c/c_typecheck_base.cpp index 41c7d532690..4135685314e 100644 --- a/src/ansi-c/c_typecheck_base.cpp +++ b/src/ansi-c/c_typecheck_base.cpp @@ -654,9 +654,7 @@ void c_typecheck_baset::typecheck_function_body(symbolt &symbol) } } -void c_typecheck_baset::apply_asm_label( - const irep_idt &asm_label, - symbolt &symbol) +void c_typecheck_baset::apply_asm_label(irep_idt asm_label, symbolt &symbol) { const irep_idt orig_name=symbol.name; diff --git a/src/ansi-c/c_typecheck_base.h b/src/ansi-c/c_typecheck_base.h index 11f106995e5..7a8225315d3 100644 --- a/src/ansi-c/c_typecheck_base.h +++ b/src/ansi-c/c_typecheck_base.h @@ -227,24 +227,22 @@ class c_typecheck_baset: virtual exprt do_special_functions(side_effect_expr_function_callt &expr); exprt typecheck_builtin_overflow( side_effect_expr_function_callt &expr, - const irep_idt &arith_op); + irep_idt arith_op); exprt typecheck_saturating_arithmetic(const side_effect_expr_function_callt &expr); virtual std::optional typecheck_gcc_polymorphic_builtin( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location); virtual code_blockt instantiate_gcc_polymorphic_builtin( - const irep_idt &identifier, + irep_idt identifier, const symbol_exprt &function_symbol); virtual std::optional typecheck_shadow_memory_builtin(const side_effect_expr_function_callt &expr); virtual exprt typecheck_shuffle_vector(const side_effect_expr_function_callt &expr); - void disallow_subexpr_by_id( - const exprt &, - const irep_idt &, - const std::string &) const; + void + disallow_subexpr_by_id(const exprt &, irep_idt, const std::string &) const; virtual void make_index_type(exprt &expr); virtual void make_constant(exprt &expr); @@ -252,7 +250,7 @@ class c_typecheck_baset: virtual bool gcc_types_compatible_p(const typet &, const typet &); - virtual bool builtin_factory(const irep_idt &); + virtual bool builtin_factory(irep_idt); // types virtual void typecheck_type(typet &type); @@ -319,7 +317,7 @@ class c_typecheck_baset: typedef std::unordered_map asm_label_mapt; asm_label_mapt asm_label_map; - void apply_asm_label(const irep_idt &asm_label, symbolt &symbol); + void apply_asm_label(irep_idt asm_label, symbolt &symbol); }; class already_typechecked_exprt : public expr_protectedt diff --git a/src/ansi-c/c_typecheck_expr.cpp b/src/ansi-c/c_typecheck_expr.cpp index afc0f3ca884..093059d5f71 100644 --- a/src/ansi-c/c_typecheck_expr.cpp +++ b/src/ansi-c/c_typecheck_expr.cpp @@ -2122,7 +2122,7 @@ void c_typecheck_baset::typecheck_obeys_contract_call( expr.type() = bool_typet(); } -bool c_typecheck_baset::builtin_factory(const irep_idt &identifier) +bool c_typecheck_baset::builtin_factory(irep_idt identifier) { return ::builtin_factory( identifier, @@ -3888,7 +3888,7 @@ exprt c_typecheck_baset::do_special_functions( exprt c_typecheck_baset::typecheck_builtin_overflow( side_effect_expr_function_callt &expr, - const irep_idt &arith_op) + irep_idt arith_op) { const irep_idt &identifier = to_symbol_expr(expr.function()).identifier(); @@ -4843,7 +4843,7 @@ void c_typecheck_baset::make_constant_index(exprt &expr) void c_typecheck_baset::disallow_subexpr_by_id( const exprt &expr, - const irep_idt &id, + irep_idt id, const std::string &message) const { if(!has_subexpr(expr, id)) diff --git a/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp b/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp index dd56ef7b239..54a715c4f88 100644 --- a/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp +++ b/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp @@ -25,7 +25,7 @@ Author: Daniel Kroening, kroening@kroening.com #include static symbol_exprt typecheck_sync_with_pointer_parameter( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -64,7 +64,7 @@ static symbol_exprt typecheck_sync_with_pointer_parameter( } static symbol_exprt typecheck_sync_compare_swap( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -107,7 +107,7 @@ static symbol_exprt typecheck_sync_compare_swap( } static symbol_exprt typecheck_sync_lock_release( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -142,7 +142,7 @@ static symbol_exprt typecheck_sync_lock_release( } static symbol_exprt typecheck_atomic_load_n( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -177,7 +177,7 @@ static symbol_exprt typecheck_atomic_load_n( } static symbol_exprt typecheck_atomic_store_n( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -215,7 +215,7 @@ static symbol_exprt typecheck_atomic_store_n( } static symbol_exprt typecheck_atomic_exchange_n( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -253,7 +253,7 @@ static symbol_exprt typecheck_atomic_exchange_n( } static symbol_exprt typecheck_atomic_load_store( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -298,7 +298,7 @@ static symbol_exprt typecheck_atomic_load_store( } static symbol_exprt typecheck_atomic_exchange( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -351,7 +351,7 @@ static symbol_exprt typecheck_atomic_exchange( } static symbol_exprt typecheck_atomic_compare_exchange( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -417,7 +417,7 @@ static symbol_exprt typecheck_atomic_compare_exchange( } static symbol_exprt typecheck_atomic_op_fetch( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -454,7 +454,7 @@ static symbol_exprt typecheck_atomic_op_fetch( } static symbol_exprt typecheck_atomic_fetch_op( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location, message_handlert &message_handler) @@ -492,7 +492,7 @@ static symbol_exprt typecheck_atomic_fetch_op( std::optional c_typecheck_baset::typecheck_gcc_polymorphic_builtin( - const irep_idt &identifier, + irep_idt identifier, const exprt::operandst &arguments, const source_locationt &source_location) { @@ -608,7 +608,7 @@ c_typecheck_baset::typecheck_gcc_polymorphic_builtin( } static symbolt result_symbol( - const irep_idt &identifier, + irep_idt identifier, const typet &type, const source_locationt &source_location, symbol_table_baset &symbol_table) @@ -626,8 +626,8 @@ static symbolt result_symbol( } static void instantiate_atomic_fetch_op( - const irep_idt &identifier, - const irep_idt &identifier_with_type, + irep_idt identifier, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -689,8 +689,8 @@ static void instantiate_atomic_fetch_op( } static void instantiate_atomic_op_fetch( - const irep_idt &identifier, - const irep_idt &identifier_with_type, + irep_idt identifier, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -753,8 +753,8 @@ static void instantiate_atomic_op_fetch( } static void instantiate_sync_fetch( - const irep_idt &identifier, - const irep_idt &identifier_with_type, + irep_idt identifier, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -777,7 +777,7 @@ static void instantiate_sync_fetch( } static void instantiate_sync_bool_compare_and_swap( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -805,7 +805,7 @@ static void instantiate_sync_bool_compare_and_swap( } static void instantiate_sync_val_compare_and_swap( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -855,7 +855,7 @@ static void instantiate_sync_val_compare_and_swap( } static void instantiate_sync_lock_test_and_set( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -911,7 +911,7 @@ static void instantiate_sync_lock_test_and_set( } static void instantiate_sync_lock_release( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -951,7 +951,7 @@ static void instantiate_sync_lock_release( } static void instantiate_atomic_load( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -985,7 +985,7 @@ static void instantiate_atomic_load( } static void instantiate_atomic_load_n( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1013,7 +1013,7 @@ static void instantiate_atomic_load_n( } static void instantiate_atomic_store( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1047,7 +1047,7 @@ static void instantiate_atomic_store( } static void instantiate_atomic_store_n( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1068,7 +1068,7 @@ static void instantiate_atomic_store_n( } static void instantiate_atomic_exchange( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1104,7 +1104,7 @@ static void instantiate_atomic_exchange( } static void instantiate_atomic_exchange_n( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1135,7 +1135,7 @@ static void instantiate_atomic_exchange_n( } static void instantiate_atomic_compare_exchange( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1213,7 +1213,7 @@ static void instantiate_atomic_compare_exchange( } static void instantiate_atomic_compare_exchange_n( - const irep_idt &identifier_with_type, + irep_idt identifier_with_type, const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, @@ -1236,7 +1236,7 @@ static void instantiate_atomic_compare_exchange_n( } code_blockt c_typecheck_baset::instantiate_gcc_polymorphic_builtin( - const irep_idt &identifier, + irep_idt identifier, const symbol_exprt &function_symbol) { const irep_idt &identifier_with_type = function_symbol.identifier(); diff --git a/src/ansi-c/c_typecheck_shadow_memory_builtin.cpp b/src/ansi-c/c_typecheck_shadow_memory_builtin.cpp index 7c6ee139a76..2decd9b4e4d 100644 --- a/src/ansi-c/c_typecheck_shadow_memory_builtin.cpp +++ b/src/ansi-c/c_typecheck_shadow_memory_builtin.cpp @@ -16,7 +16,7 @@ /// \throws invalid_source_file_exceptiont if the typecheck fails. static symbol_exprt typecheck_field_decl( const side_effect_expr_function_callt &expr, - const irep_idt &identifier, + irep_idt identifier, const namespacet &ns) { // Check correct number of arguments @@ -81,7 +81,7 @@ static symbol_exprt typecheck_field_decl( /// \throws invalid_source_file_exceptiont if the typecheck fails. static symbol_exprt typecheck_get_field( const side_effect_expr_function_callt &expr, - const irep_idt &identifier, + irep_idt identifier, const namespacet &ns) { // Check correct number of arguments @@ -146,7 +146,7 @@ static symbol_exprt typecheck_get_field( /// \throws invalid_source_file_exceptiont if the typecheck fails. static symbol_exprt typecheck_set_field( const side_effect_expr_function_callt &expr, - const irep_idt &identifier, + irep_idt identifier, const namespacet &ns) { // Check correct number of arguments diff --git a/src/ansi-c/expr2c.cpp b/src/ansi-c/expr2c.cpp index 19416c4ac96..6f79df68467 100644 --- a/src/ansi-c/expr2c.cpp +++ b/src/ansi-c/expr2c.cpp @@ -72,7 +72,7 @@ Precedences are as follows. Higher values mean higher precedence. */ -irep_idt expr2ct::id_shorthand(const irep_idt &identifier) const +irep_idt expr2ct::id_shorthand(irep_idt identifier) const { const symbolt *symbol; @@ -90,7 +90,7 @@ irep_idt expr2ct::id_shorthand(const irep_idt &identifier) const return sh; } -static std::string clean_identifier(const irep_idt &id) +static std::string clean_identifier(irep_idt id) { std::string dest=id2string(id); diff --git a/src/ansi-c/expr2c_class.h b/src/ansi-c/expr2c_class.h index e60af80fa33..25508b806c2 100644 --- a/src/ansi-c/expr2c_class.h +++ b/src/ansi-c/expr2c_class.h @@ -90,7 +90,7 @@ class expr2ct unsigned sizeof_nesting; - irep_idt id_shorthand(const irep_idt &identifier) const; + irep_idt id_shorthand(irep_idt identifier) const; std::string convert_typecast( const typecast_exprt &src, unsigned &precedence); diff --git a/src/ansi-c/goto-conversion/builtin_functions.cpp b/src/ansi-c/goto-conversion/builtin_functions.cpp index 3a825087932..db3d0ce6b21 100644 --- a/src/ansi-c/goto-conversion/builtin_functions.cpp +++ b/src/ansi-c/goto-conversion/builtin_functions.cpp @@ -568,7 +568,7 @@ exprt goto_convertt::get_array_argument(const exprt &src) } void goto_convertt::do_array_op( - const irep_idt &id, + irep_idt id, const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, @@ -631,7 +631,7 @@ void goto_convertt::do_havoc_slice( const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { irep_idt identifier = CPROVER_PREFIX "havoc_slice"; @@ -714,7 +714,7 @@ void goto_convertt::do_alloca( const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const source_locationt &source_location = function.source_location(); const auto alloca_type = to_code_type(function.type()); @@ -823,7 +823,7 @@ void goto_convertt::do_function_call_symbol( const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { if(function.get_bool(ID_C_invalid_object)) return; // ignore diff --git a/src/ansi-c/goto-conversion/goto_check_c.cpp b/src/ansi-c/goto-conversion/goto_check_c.cpp index ad0419853a9..f6822a03347 100644 --- a/src/ansi-c/goto-conversion/goto_check_c.cpp +++ b/src/ansi-c/goto-conversion/goto_check_c.cpp @@ -82,9 +82,7 @@ class goto_check_ct typedef goto_functionst::goto_functiont goto_functiont; - void goto_check( - const irep_idt &function_identifier, - goto_functiont &goto_function); + void goto_check(irep_idt function_identifier, goto_functiont &goto_function); /// Fill the list of allocations \ref allocationst with for /// every allocation instruction. Also check that each allocation is @@ -189,7 +187,7 @@ class goto_check_ct void undefined_shift_check(const shift_exprt &, const guardt &); void pointer_rel_check(const binary_exprt &, const guardt &); void pointer_overflow_check(const exprt &, const guardt &); - void memory_leak_check(const irep_idt &function_id); + void memory_leak_check(irep_idt function_id); /// Generates VCCs for the validity of the given dereferencing operation. /// \param expr the expression to be checked @@ -339,7 +337,7 @@ class goto_check_ct /// /// \returns a pair (name, status) if the match succeeds /// and the name is known, nothing otherwise. - named_check_statust match_named_check(const irep_idt &named_check) const; + named_check_statust match_named_check(irep_idt named_check) const; }; /// Allows to: @@ -362,7 +360,7 @@ class flag_overridet /// /// - calling `set_flag` after `disable_flag` is a no-op /// - calling `set_flag` twice triggers an INVARIANT - void set_flag(bool &flag, bool new_value, const irep_idt &flag_name) + void set_flag(bool &flag, bool new_value, irep_idt flag_name) { // make this a no-op if the flag is disabled if(disabled_flags.find(&flag) != disabled_flags.end()) @@ -384,7 +382,7 @@ class flag_overridet /// /// - calling `disable_flag` after `set_flag` overrides the set value /// - calling `disable_flag` twice triggers an INVARIANT - void disable_flag(bool &flag, const irep_idt &flag_name) + void disable_flag(bool &flag, irep_idt flag_name) { INVARIANT( disabled_flags.find(&flag) == disabled_flags.end(), @@ -2076,7 +2074,7 @@ void goto_check_ct::check(const exprt &expr, bool is_assigned) check_rec(expr, identity, is_assigned); } -void goto_check_ct::memory_leak_check(const irep_idt &function_id) +void goto_check_ct::memory_leak_check(irep_idt function_id) { const symbolt &leak = ns.lookup(CPROVER_PREFIX "memory_leak"); const symbol_exprt leak_expr = leak.symbol_expr(); @@ -2100,7 +2098,7 @@ void goto_check_ct::memory_leak_check(const irep_idt &function_id) } void goto_check_ct::goto_check( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functiont &goto_function) { const auto &function_symbol = ns.lookup(function_identifier); @@ -2468,7 +2466,7 @@ exprt goto_check_ct::is_in_bounds_of_some_explicit_allocation( } void goto_check_c( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &goto_function, const namespacet &ns, const optionst &options, @@ -2519,7 +2517,7 @@ void goto_check_ct::add_all_checked_named_check_pragmas( } goto_check_ct::named_check_statust -goto_check_ct::match_named_check(const irep_idt &named_check) const +goto_check_ct::match_named_check(irep_idt named_check) const { auto s = id2string(named_check); auto col = s.find(":"); diff --git a/src/ansi-c/goto-conversion/goto_check_c.h b/src/ansi-c/goto-conversion/goto_check_c.h index e560634cf16..1487c42b8a7 100644 --- a/src/ansi-c/goto-conversion/goto_check_c.h +++ b/src/ansi-c/goto-conversion/goto_check_c.h @@ -26,7 +26,7 @@ void goto_check_c( message_handlert &message_handler); void goto_check_c( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_functionst::goto_functiont &goto_function, const namespacet &ns, const optionst &options, diff --git a/src/ansi-c/goto-conversion/goto_clean_expr.cpp b/src/ansi-c/goto-conversion/goto_clean_expr.cpp index 72217bac88a..6cf086755c7 100644 --- a/src/ansi-c/goto-conversion/goto_clean_expr.cpp +++ b/src/ansi-c/goto-conversion/goto_clean_expr.cpp @@ -60,7 +60,7 @@ static symbol_exprt find_base_symbol(const exprt &expr) static exprt convert_statement_expression( const quantifier_exprt &qex, const code_expressiont &code, - const irep_idt &mode, + irep_idt mode, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -278,7 +278,7 @@ static exprt convert_statement_expression( symbol_exprt goto_convertt::make_compound_literal( const exprt &expr, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const source_locationt source_location = expr.find_source_location(); @@ -437,10 +437,8 @@ void goto_convertt::rewrite_boolean(exprt &expr) expr.swap(tmp); } -goto_convertt::clean_expr_resultt goto_convertt::clean_expr( - exprt &expr, - const irep_idt &mode, - bool result_is_used) +goto_convertt::clean_expr_resultt +goto_convertt::clean_expr(exprt &expr, irep_idt mode, bool result_is_used) { // this cleans: // && || ==> ?: comma (control-dependency) @@ -754,7 +752,7 @@ goto_convertt::clean_expr_resultt goto_convertt::clean_expr( } goto_convertt::clean_expr_resultt -goto_convertt::clean_expr_address_of(exprt &expr, const irep_idt &mode) +goto_convertt::clean_expr_address_of(exprt &expr, irep_idt mode) { clean_expr_resultt side_effects; @@ -827,9 +825,7 @@ goto_convertt::clean_expr_address_of(exprt &expr, const irep_idt &mode) } goto_convertt::clean_expr_resultt -goto_convertt::remove_gcc_conditional_expression( - exprt &expr, - const irep_idt &mode) +goto_convertt::remove_gcc_conditional_expression(exprt &expr, irep_idt mode) { clean_expr_resultt side_effects; diff --git a/src/ansi-c/goto-conversion/goto_convert.cpp b/src/ansi-c/goto-conversion/goto_convert.cpp index 4ef706f24dd..c3ee39a9c79 100644 --- a/src/ansi-c/goto-conversion/goto_convert.cpp +++ b/src/ansi-c/goto-conversion/goto_convert.cpp @@ -249,7 +249,7 @@ Function: goto_convertt::finish_gotos \*******************************************************************/ -void goto_convertt::finish_gotos(goto_programt &dest, const irep_idt &mode) +void goto_convertt::finish_gotos(goto_programt &dest, irep_idt mode) { std::unordered_map label_flags; declaration_hop_instrumentationt instructions_to_insert; @@ -459,7 +459,7 @@ void goto_convertt::optimize_guarded_gotos(goto_programt &dest) void goto_convertt::goto_convert( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { goto_convert_rec(code, dest, mode); } @@ -467,7 +467,7 @@ void goto_convertt::goto_convert( void goto_convertt::goto_convert_rec( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { convert(code, dest, mode); @@ -489,7 +489,7 @@ void goto_convertt::copy( void goto_convertt::convert_label( const code_labelt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // grab the label const irep_idt &label = code.get_label(); @@ -535,7 +535,7 @@ void goto_convertt::convert_gcc_local_label(const codet &, goto_programt &) void goto_convertt::convert_switch_case( const code_switch_caset &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { goto_programt tmp; convert(code.code(), tmp, mode); @@ -575,7 +575,7 @@ void goto_convertt::convert_switch_case( void goto_convertt::convert_gcc_switch_case_range( const code_gcc_switch_case_ranget &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const auto lb = numeric_cast(code.lower()); const auto ub = numeric_cast(code.upper()); @@ -616,7 +616,7 @@ void goto_convertt::convert_gcc_switch_case_range( void goto_convertt::convert( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const irep_idt &statement = code.get_statement(); @@ -730,7 +730,7 @@ void goto_convertt::convert( void goto_convertt::convert_block( const code_blockt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const source_locationt &end_location = code.end_location(); @@ -759,7 +759,7 @@ void goto_convertt::convert_block( void goto_convertt::convert_expression( const code_expressiont &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { exprt expr = code.expression(); @@ -800,7 +800,7 @@ void goto_convertt::convert_expression( void goto_convertt::convert_frontend_decl( const code_frontend_declt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const irep_idt &identifier = code.get_identifier(); @@ -877,7 +877,7 @@ void goto_convertt::convert_decl_type(const codet &, goto_programt &) void goto_convertt::convert_assign( const code_assignt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { exprt lhs = code.lhs(), rhs = code.rhs(); @@ -1035,7 +1035,7 @@ void goto_convertt::convert_cpp_delete(const codet &code, goto_programt &dest) void goto_convertt::convert_assert( const code_assertt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { exprt cond = code.assertion(); @@ -1058,7 +1058,7 @@ void goto_convertt::convert_skip(const codet &code, goto_programt &dest) void goto_convertt::convert_assume( const code_assumet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { exprt op = code.assumption(); @@ -1101,7 +1101,7 @@ void goto_convertt::convert_loop_contracts( void goto_convertt::convert_for( const code_fort &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // turn for(A; c; B) { P } into // A; while(c) { P; B; } @@ -1199,7 +1199,7 @@ void goto_convertt::convert_for( void goto_convertt::convert_while( const code_whilet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const exprt &cond = code.cond(); const source_locationt &source_location = code.source_location(); @@ -1255,7 +1255,7 @@ void goto_convertt::convert_while( void goto_convertt::convert_dowhile( const code_dowhilet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() == 2, @@ -1363,7 +1363,7 @@ exprt goto_convertt::case_guard( void goto_convertt::convert_switch( const code_switcht &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // switch(v) { // case x: Px; @@ -1503,7 +1503,7 @@ void goto_convertt::convert_switch( void goto_convertt::convert_break( const code_breakt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( targets.break_set, "break without target", code.find_source_location()); @@ -1520,7 +1520,7 @@ void goto_convertt::convert_break( void goto_convertt::convert_return( const code_frontend_returnt &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { if(!targets.return_set) { @@ -1580,7 +1580,7 @@ void goto_convertt::convert_return( void goto_convertt::convert_continue( const code_continuet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( targets.continue_set, @@ -1664,7 +1664,7 @@ void goto_convertt::convert_atomic_end(const codet &code, goto_programt &dest) void goto_convertt::convert_ifthenelse( const code_ifthenelset &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { DATA_INVARIANT(code.then_case().is_not_nil(), "cannot accept an empty body"); @@ -1728,7 +1728,7 @@ void goto_convertt::convert_ifthenelse( void goto_convertt::collect_operands( const exprt &expr, - const irep_idt &id, + irep_idt id, std::list &dest) { if(expr.id() != id) @@ -1761,7 +1761,7 @@ void goto_convertt::generate_ifthenelse( goto_programt &false_case, const source_locationt &else_end_location, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { if(is_empty(true_case) && is_empty(false_case)) { @@ -1938,7 +1938,7 @@ void goto_convertt::generate_conditional_branch( goto_programt::targett target_true, const source_locationt &source_location, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { if(has_and_or(guard) && needs_cleaning(guard)) { @@ -1978,7 +1978,7 @@ void goto_convertt::generate_conditional_branch( goto_programt::targett target_false, const source_locationt &source_location, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { if(guard.id() == ID_not) { @@ -2143,7 +2143,7 @@ symbolt &goto_convertt::new_tmp_symbol( const std::string &suffix, goto_programt &dest, const source_locationt &source_location, - const irep_idt &mode) + irep_idt mode) { PRECONDITION(!mode.empty()); symbolt &new_symbol = get_fresh_aux_symbol( @@ -2167,7 +2167,7 @@ irep_idt goto_convertt::make_temp_symbol( exprt &expr, const std::string &suffix, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { const source_locationt source_location = expr.find_source_location(); @@ -2191,7 +2191,7 @@ void goto_convert( symbol_table_baset &symbol_table, goto_programt &dest, message_handlert &message_handler, - const irep_idt &mode) + irep_idt mode) { symbol_table_buildert symbol_table_builder = symbol_table_buildert::wrap(symbol_table); @@ -2234,7 +2234,7 @@ void goto_convert( void goto_convertt::generate_thread_block( const code_blockt &thread_body, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { goto_programt preamble, body, postamble; diff --git a/src/ansi-c/goto-conversion/goto_convert.h b/src/ansi-c/goto-conversion/goto_convert.h index 5be10aa9634..d7adfb7cff4 100644 --- a/src/ansi-c/goto-conversion/goto_convert.h +++ b/src/ansi-c/goto-conversion/goto_convert.h @@ -25,7 +25,7 @@ void goto_convert( symbol_table_baset &symbol_table, goto_programt &dest, message_handlert &message_handler, - const irep_idt &mode); + irep_idt mode); // start from "main" void goto_convert( diff --git a/src/ansi-c/goto-conversion/goto_convert_class.h b/src/ansi-c/goto-conversion/goto_convert_class.h index 6ea485eeb59..9aeb403efde 100644 --- a/src/ansi-c/goto-conversion/goto_convert_class.h +++ b/src/ansi-c/goto-conversion/goto_convert_class.h @@ -33,8 +33,7 @@ struct build_declaration_hops_inputst; class goto_convertt : public messaget { public: - void - goto_convert(const codet &code, goto_programt &dest, const irep_idt &mode); + void goto_convert(const codet &code, goto_programt &dest, irep_idt mode); goto_convertt( symbol_table_baset &_symbol_table, @@ -81,16 +80,13 @@ class goto_convertt : public messaget side_effects.destructive_append(other.side_effects); } - void add_temporary(const irep_idt &id) + void add_temporary(irep_idt id) { temporaries.push_front(id); } }; - void goto_convert_rec( - const codet &code, - goto_programt &dest, - const irep_idt &mode); + void goto_convert_rec(const codet &code, goto_programt &dest, irep_idt mode); // // tools for symbols @@ -100,12 +96,10 @@ class goto_convertt : public messaget const std::string &suffix, goto_programt &dest, const source_locationt &, - const irep_idt &mode); + irep_idt mode); - symbol_exprt make_compound_literal( - const exprt &expr, - goto_programt &dest, - const irep_idt &mode); + symbol_exprt + make_compound_literal(const exprt &expr, goto_programt &dest, irep_idt mode); // // translation of C expressions (with side effects) @@ -113,10 +107,10 @@ class goto_convertt : public messaget // [[nodiscard]] clean_expr_resultt - clean_expr(exprt &expr, const irep_idt &mode, bool result_is_used = true); + clean_expr(exprt &expr, irep_idt mode, bool result_is_used = true); [[nodiscard]] clean_expr_resultt - clean_expr_address_of(exprt &expr, const irep_idt &mode); + clean_expr_address_of(exprt &expr, irep_idt mode); static bool needs_cleaning(const exprt &expr); @@ -133,52 +127,48 @@ class goto_convertt : public messaget exprt &expr, const std::string &suffix, goto_programt &, - const irep_idt &mode); + irep_idt mode); void rewrite_boolean(exprt &dest); [[nodiscard]] clean_expr_resultt remove_side_effect( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used, bool address_taken); [[nodiscard]] clean_expr_resultt remove_assignment( side_effect_exprt &expr, bool result_is_used, bool address_taken, - const irep_idt &mode); + irep_idt mode); [[nodiscard]] clean_expr_resultt remove_pre( side_effect_exprt &expr, bool result_is_used, bool address_taken, - const irep_idt &mode); - [[nodiscard]] clean_expr_resultt remove_post( - side_effect_exprt &expr, - const irep_idt &mode, - bool result_is_used); + irep_idt mode); + [[nodiscard]] clean_expr_resultt + remove_post(side_effect_exprt &expr, irep_idt mode, bool result_is_used); [[nodiscard]] clean_expr_resultt remove_function_call( side_effect_expr_function_callt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used); [[nodiscard]] clean_expr_resultt remove_cpp_new(side_effect_exprt &expr, bool result_is_used); [[nodiscard]] clean_expr_resultt remove_cpp_delete(side_effect_exprt &expr); - [[nodiscard]] clean_expr_resultt remove_malloc( - side_effect_exprt &expr, - const irep_idt &mode, - bool result_is_used); + [[nodiscard]] clean_expr_resultt + remove_malloc(side_effect_exprt &expr, irep_idt mode, bool result_is_used); [[nodiscard]] clean_expr_resultt remove_temporary_object(side_effect_exprt &expr); [[nodiscard]] clean_expr_resultt remove_statement_expression( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used); [[nodiscard]] clean_expr_resultt - remove_gcc_conditional_expression(exprt &expr, const irep_idt &mode); + remove_gcc_conditional_expression(exprt &expr, irep_idt mode); [[nodiscard]] clean_expr_resultt remove_overflow( side_effect_expr_overflowt &expr, bool result_is_used, - const irep_idt &mode); + irep_idt mode); virtual void do_cpp_new( const exprt &lhs, @@ -211,21 +201,21 @@ class goto_convertt : public messaget const exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); virtual void do_function_call_if( const exprt &lhs, const if_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); virtual void do_function_call_symbol( const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); virtual void do_function_call_symbol(const symbolt &) { @@ -240,83 +230,66 @@ class goto_convertt : public messaget // // conversion // - void convert_block( - const code_blockt &code, - goto_programt &dest, - const irep_idt &mode); + void + convert_block(const code_blockt &code, goto_programt &dest, irep_idt mode); void convert_frontend_decl( const code_frontend_declt &, goto_programt &, - const irep_idt &mode); + irep_idt mode); void convert_decl_type(const codet &code, goto_programt &dest); void convert_expression( const code_expressiont &code, goto_programt &dest, - const irep_idt &mode); - void convert_assign( - const code_assignt &code, - goto_programt &dest, - const irep_idt &mode); + irep_idt mode); + void + convert_assign(const code_assignt &code, goto_programt &dest, irep_idt mode); void convert_cpp_delete(const codet &code, goto_programt &dest); void convert_loop_contracts(const codet &code, goto_programt::targett loop); + void convert_for(const code_fort &code, goto_programt &dest, irep_idt mode); void - convert_for(const code_fort &code, goto_programt &dest, const irep_idt &mode); - void convert_while( - const code_whilet &code, - goto_programt &dest, - const irep_idt &mode); + convert_while(const code_whilet &code, goto_programt &dest, irep_idt mode); void convert_dowhile( const code_dowhilet &code, goto_programt &dest, - const irep_idt &mode); - void convert_assume( - const code_assumet &code, - goto_programt &dest, - const irep_idt &mode); - void convert_assert( - const code_assertt &code, - goto_programt &dest, - const irep_idt &mode); - void convert_switch( - const code_switcht &code, - goto_programt &dest, - const irep_idt &mode); - void convert_break( - const code_breakt &code, - goto_programt &dest, - const irep_idt &mode); + irep_idt mode); + void + convert_assume(const code_assumet &code, goto_programt &dest, irep_idt mode); + void + convert_assert(const code_assertt &code, goto_programt &dest, irep_idt mode); + void + convert_switch(const code_switcht &code, goto_programt &dest, irep_idt mode); + void + convert_break(const code_breakt &code, goto_programt &dest, irep_idt mode); void convert_return( const code_frontend_returnt &, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_continue( const code_continuet &code, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_ifthenelse( const code_ifthenelset &code, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_goto(const code_gotot &code, goto_programt &dest); void convert_gcc_computed_goto(const codet &code, goto_programt &dest); void convert_skip(const codet &code, goto_programt &dest); - void convert_label( - const code_labelt &code, - goto_programt &dest, - const irep_idt &mode); + void + convert_label(const code_labelt &code, goto_programt &dest, irep_idt mode); void convert_gcc_local_label(const codet &code, goto_programt &dest); void convert_switch_case( const code_switch_caset &code, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_gcc_switch_case_range( const code_gcc_switch_case_ranget &, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_function_call( const code_function_callt &code, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_start_thread(const codet &code, goto_programt &dest); void convert_end_thread(const codet &code, goto_programt &dest); void convert_atomic_begin(const codet &code, goto_programt &dest); @@ -324,34 +297,24 @@ class goto_convertt : public messaget void convert_msc_try_finally( const codet &code, goto_programt &dest, - const irep_idt &mode); - void convert_msc_try_except( - const codet &code, - goto_programt &dest, - const irep_idt &mode); - void convert_msc_leave( - const codet &code, - goto_programt &dest, - const irep_idt &mode); - void convert_try_catch( - const codet &code, - goto_programt &dest, - const irep_idt &mode); + irep_idt mode); + void + convert_msc_try_except(const codet &code, goto_programt &dest, irep_idt mode); + void convert_msc_leave(const codet &code, goto_programt &dest, irep_idt mode); + void convert_try_catch(const codet &code, goto_programt &dest, irep_idt mode); void convert_CPROVER_try_catch( const codet &code, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void convert_CPROVER_try_finally( const codet &code, goto_programt &dest, - const irep_idt &mode); - void convert_CPROVER_throw( - const codet &code, - goto_programt &dest, - const irep_idt &mode); + irep_idt mode); + void + convert_CPROVER_throw(const codet &code, goto_programt &dest, irep_idt mode); void convert_asm(const code_asmt &code, goto_programt &dest); - void convert(const codet &code, goto_programt &dest, const irep_idt &mode); + void convert(const codet &code, goto_programt &dest, irep_idt mode); void copy( const codet &code, @@ -362,12 +325,12 @@ class goto_convertt : public messaget // exceptions // - symbol_exprt exception_flag(const irep_idt &mode); + symbol_exprt exception_flag(irep_idt mode); void unwind_destructor_stack( const source_locationt &source_location, goto_programt &dest, - const irep_idt &mode, + irep_idt mode, std::optional destructor_end_point = {}, std::optional destructor_start_point = {}); @@ -383,7 +346,7 @@ class goto_convertt : public messaget // gotos // - void finish_gotos(goto_programt &dest, const irep_idt &mode); + void finish_gotos(goto_programt &dest, irep_idt mode); void finish_computed_gotos(goto_programt &dest); void optimize_guarded_gotos(goto_programt &dest); @@ -591,7 +554,7 @@ class goto_convertt : public messaget goto_programt &false_case, const source_locationt &, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); // if(guard) goto target_true; else goto target_false; void generate_conditional_branch( @@ -600,7 +563,7 @@ class goto_convertt : public messaget goto_programt::targett target_false, const source_locationt &, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); // if(guard) goto target; void generate_conditional_branch( @@ -608,19 +571,17 @@ class goto_convertt : public messaget goto_programt::targett target_true, const source_locationt &, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); // turn a OP b OP c into a list a, b, c - static void collect_operands( - const exprt &expr, - const irep_idt &id, - std::list &dest); + static void + collect_operands(const exprt &expr, irep_idt id, std::list &dest); // START_THREAD; ... END_THREAD; void generate_thread_block( const code_blockt &thread_body, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); // // misc @@ -651,7 +612,7 @@ class goto_convertt : public messaget const exprt::operandst &arguments, goto_programt &dest); void do_array_op( - const irep_idt &id, + irep_idt id, const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, @@ -689,13 +650,13 @@ class goto_convertt : public messaget const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); void do_alloca( const exprt &lhs, const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode); + irep_idt mode); exprt get_array_argument(const exprt &src); }; diff --git a/src/ansi-c/goto-conversion/goto_convert_exceptions.cpp b/src/ansi-c/goto-conversion/goto_convert_exceptions.cpp index f7a87a0554c..0ad1eefff74 100644 --- a/src/ansi-c/goto-conversion/goto_convert_exceptions.cpp +++ b/src/ansi-c/goto-conversion/goto_convert_exceptions.cpp @@ -17,7 +17,7 @@ Author: Daniel Kroening, kroening@kroening.com void goto_convertt::convert_msc_try_finally( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() == 2, @@ -55,7 +55,7 @@ void goto_convertt::convert_msc_try_finally( void goto_convertt::convert_msc_try_except( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() == 3, @@ -70,7 +70,7 @@ void goto_convertt::convert_msc_try_except( void goto_convertt::convert_msc_leave( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( targets.leave_set, "leave without target", code.find_source_location()); @@ -86,7 +86,7 @@ void goto_convertt::convert_msc_leave( void goto_convertt::convert_try_catch( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() >= 2, @@ -145,7 +145,7 @@ void goto_convertt::convert_try_catch( void goto_convertt::convert_CPROVER_try_catch( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() == 2, @@ -181,7 +181,7 @@ void goto_convertt::convert_CPROVER_try_catch( void goto_convertt::convert_CPROVER_throw( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // set the 'exception' flag dest.add(goto_programt::make_assignment( @@ -212,7 +212,7 @@ void goto_convertt::convert_CPROVER_throw( void goto_convertt::convert_CPROVER_try_finally( const codet &code, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( code.operands().size() == 2, @@ -233,7 +233,7 @@ void goto_convertt::convert_CPROVER_try_finally( convert(to_code(code.op1()), dest, mode); } -symbol_exprt goto_convertt::exception_flag(const irep_idt &mode) +symbol_exprt goto_convertt::exception_flag(irep_idt mode) { irep_idt id = "$exception_flag"; @@ -280,7 +280,7 @@ symbol_exprt goto_convertt::exception_flag(const irep_idt &mode) void goto_convertt::unwind_destructor_stack( const source_locationt &source_location, goto_programt &dest, - const irep_idt &mode, + irep_idt mode, std::optional end_index, std::optional starting_index) { diff --git a/src/ansi-c/goto-conversion/goto_convert_function_call.cpp b/src/ansi-c/goto-conversion/goto_convert_function_call.cpp index 2fdc5c3e616..895d62feeda 100644 --- a/src/ansi-c/goto-conversion/goto_convert_function_call.cpp +++ b/src/ansi-c/goto-conversion/goto_convert_function_call.cpp @@ -20,7 +20,7 @@ Author: Daniel Kroening, kroening@kroening.com void goto_convertt::convert_function_call( const code_function_callt &function_call, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { do_function_call( function_call.lhs(), @@ -35,7 +35,7 @@ void goto_convertt::do_function_call( const exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // make it all side effect free @@ -93,7 +93,7 @@ void goto_convertt::do_function_call_if( const if_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { // case split diff --git a/src/ansi-c/goto-conversion/goto_convert_functions.cpp b/src/ansi-c/goto-conversion/goto_convert_functions.cpp index 8c24dedeee9..9fccf89d3da 100644 --- a/src/ansi-c/goto-conversion/goto_convert_functions.cpp +++ b/src/ansi-c/goto-conversion/goto_convert_functions.cpp @@ -137,7 +137,7 @@ void goto_convert_functionst::add_return( } void goto_convert_functionst::convert_function( - const irep_idt &identifier, + irep_idt identifier, goto_functionst::goto_functiont &f) { const symbolt &symbol = ns.lookup(identifier); @@ -264,7 +264,7 @@ void goto_convert( } void goto_convert( - const irep_idt &identifier, + irep_idt identifier, symbol_table_baset &symbol_table, goto_functionst &functions, message_handlert &message_handler) diff --git a/src/ansi-c/goto-conversion/goto_convert_functions.h b/src/ansi-c/goto-conversion/goto_convert_functions.h index 70d1f856f66..0cc2e8c4791 100644 --- a/src/ansi-c/goto-conversion/goto_convert_functions.h +++ b/src/ansi-c/goto-conversion/goto_convert_functions.h @@ -31,7 +31,7 @@ void goto_convert(goto_modelt &, message_handlert &); // just convert a specific function void goto_convert( - const irep_idt &identifier, + irep_idt identifier, symbol_table_baset &symbol_table, goto_functionst &functions, message_handlert &); @@ -41,7 +41,7 @@ class goto_convert_functionst : public goto_convertt public: void goto_convert(goto_functionst &functions); void convert_function( - const irep_idt &identifier, + irep_idt identifier, goto_functionst::goto_functiont &result); goto_convert_functionst( diff --git a/src/ansi-c/goto-conversion/goto_convert_side_effect.cpp b/src/ansi-c/goto-conversion/goto_convert_side_effect.cpp index 3282bd6dbfc..6aa514f2401 100644 --- a/src/ansi-c/goto-conversion/goto_convert_side_effect.cpp +++ b/src/ansi-c/goto-conversion/goto_convert_side_effect.cpp @@ -28,7 +28,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_assignment( side_effect_exprt &expr, bool result_is_used, bool address_taken, - const irep_idt &mode) + irep_idt mode) { const irep_idt statement = expr.get_statement(); @@ -180,7 +180,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_pre( side_effect_exprt &expr, bool result_is_used, bool address_taken, - const irep_idt &mode) + irep_idt mode) { INVARIANT_WITH_DIAGNOSTICS( expr.operands().size() == 1, @@ -273,7 +273,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_pre( goto_convertt::clean_expr_resultt goto_convertt::remove_post( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used) { goto_programt tmp1, tmp2; @@ -360,7 +360,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_post( goto_convertt::clean_expr_resultt goto_convertt::remove_function_call( side_effect_expr_function_callt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used) { clean_expr_resultt side_effects; @@ -476,7 +476,7 @@ goto_convertt::remove_cpp_delete(side_effect_exprt &expr) goto_convertt::clean_expr_resultt goto_convertt::remove_malloc( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used) { clean_expr_resultt side_effects; @@ -557,7 +557,7 @@ goto_convertt::remove_temporary_object(side_effect_exprt &expr) goto_convertt::clean_expr_resultt goto_convertt::remove_statement_expression( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used) { clean_expr_resultt side_effects; @@ -632,7 +632,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_statement_expression( goto_convertt::clean_expr_resultt goto_convertt::remove_overflow( side_effect_expr_overflowt &expr, bool result_is_used, - const irep_idt &mode) + irep_idt mode) { const irep_idt &statement = expr.get_statement(); const exprt &lhs = expr.lhs(); @@ -710,7 +710,7 @@ goto_convertt::clean_expr_resultt goto_convertt::remove_overflow( goto_convertt::clean_expr_resultt goto_convertt::remove_side_effect( side_effect_exprt &expr, - const irep_idt &mode, + irep_idt mode, bool result_is_used, bool address_taken) { diff --git a/src/ansi-c/goto-conversion/link_to_library.cpp b/src/ansi-c/goto-conversion/link_to_library.cpp index 9885832b970..bf85407837c 100644 --- a/src/ansi-c/goto-conversion/link_to_library.cpp +++ b/src/ansi-c/goto-conversion/link_to_library.cpp @@ -29,7 +29,7 @@ add_one_function( const symbol_tablet &, symbol_tablet &, message_handlert &)> &library, - const irep_idt &missing_function) + irep_idt missing_function) { goto_modelt library_model; library( diff --git a/src/ansi-c/typedef_type.h b/src/ansi-c/typedef_type.h index de19004ed6f..c715f3d73ff 100644 --- a/src/ansi-c/typedef_type.h +++ b/src/ansi-c/typedef_type.h @@ -15,12 +15,12 @@ Author: Daniel Kroening, kroening@kroening.com class typedef_typet : public typet { public: - explicit typedef_typet(const irep_idt &identifier) : typet(ID_typedef_type) + explicit typedef_typet(irep_idt identifier) : typet(ID_typedef_type) { set_identifier(identifier); } - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_identifier, identifier); } diff --git a/src/assembler/remove_asm.cpp b/src/assembler/remove_asm.cpp index 43426ace345..11ce8d60e54 100644 --- a/src/assembler/remove_asm.cpp +++ b/src/assembler/remove_asm.cpp @@ -51,28 +51,26 @@ class remove_asmt goto_functionst &goto_functions; message_handlert &message_handler; - void process_function(const irep_idt &, goto_functionst::goto_functiont &); + void process_function(irep_idt, goto_functionst::goto_functiont &); void process_instruction( - const irep_idt &function_id, + irep_idt function_id, goto_programt::instructiont &instruction, goto_programt &dest); void process_instruction_gcc(const code_asm_gcct &, goto_programt &dest); - void process_instruction_msc( - const irep_idt &, - const code_asmt &, - goto_programt &dest); + void + process_instruction_msc(irep_idt, const code_asmt &, goto_programt &dest); void gcc_asm_function_call( - const irep_idt &function_base_name, + irep_idt function_base_name, const code_asm_gcct &code, std::size_t n_args, goto_programt &dest); void msc_asm_function_call( - const irep_idt &function_base_name, + irep_idt function_base_name, const exprt::operandst &operands, const code_asmt &code, goto_programt &dest); @@ -87,7 +85,7 @@ class remove_asmt /// \param n_args: Number of arguments required by \p function_base_name /// \param dest: Goto program to append the function call to void remove_asmt::gcc_asm_function_call( - const irep_idt &function_base_name, + irep_idt function_base_name, const code_asm_gcct &code, std::size_t n_args, goto_programt &dest) @@ -171,7 +169,7 @@ void remove_asmt::gcc_asm_function_call( /// call /// \param dest: Goto program to append the function call to void remove_asmt::msc_asm_function_call( - const irep_idt &function_base_name, + irep_idt function_base_name, const exprt::operandst &operands, const code_asmt &code, goto_programt &dest) @@ -223,7 +221,7 @@ void remove_asmt::msc_asm_function_call( /// assembly statements /// \param dest: The goto program to append the new instructions to void remove_asmt::process_instruction( - const irep_idt &function_id, + irep_idt function_id, goto_programt::instructiont &instruction, goto_programt &dest) { @@ -415,7 +413,7 @@ void remove_asmt::process_instruction_gcc( /// \param code: The inline assembly code statement to translate /// \param dest: The goto program to append the new instructions to void remove_asmt::process_instruction_msc( - const irep_idt &function_id, + irep_idt function_id, const code_asmt &code, goto_programt &dest) { @@ -542,7 +540,7 @@ void remove_asmt::process_instruction_msc( /// \param function_id: Name of function being processed /// \param goto_function: The goto function void remove_asmt::process_function( - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function) { bool did_something = false; diff --git a/src/cpp/cpp_declaration.h b/src/cpp/cpp_declaration.h index db8088f7222..8c185d5e6a2 100644 --- a/src/cpp/cpp_declaration.h +++ b/src/cpp/cpp_declaration.h @@ -115,7 +115,7 @@ class cpp_declarationt:public exprt find(ID_partial_specialization_args)); } - void set_specialization_of(const irep_idt &id) + void set_specialization_of(irep_idt id) { set(ID_specialization_of, id); } diff --git a/src/cpp/cpp_name.h b/src/cpp/cpp_name.h index 6d6e7cb5931..3de08d48329 100644 --- a/src/cpp/cpp_name.h +++ b/src/cpp/cpp_name.h @@ -30,14 +30,13 @@ class cpp_namet:public irept { } - explicit namet(const irep_idt &base_name):irept(ID_name) + explicit namet(irep_idt base_name) : irept(ID_name) { set(ID_identifier, base_name); } - namet( - const irep_idt &_base_name, - const source_locationt &_source_location):irept(ID_name) + namet(irep_idt _base_name, const source_locationt &_source_location) + : irept(ID_name) { set(ID_identifier, _base_name); add_source_location()=_source_location; @@ -58,14 +57,13 @@ class cpp_namet:public irept { } - explicit cpp_namet(const irep_idt &base_name):irept(ID_cpp_name) + explicit cpp_namet(irep_idt base_name) : irept(ID_cpp_name) { get_sub().push_back(namet(base_name)); } - cpp_namet( - const irep_idt &_base_name, - const source_locationt &_source_location):irept(ID_cpp_name) + cpp_namet(irep_idt _base_name, const source_locationt &_source_location) + : irept(ID_cpp_name) { get_sub().push_back(namet(_base_name, _source_location)); } diff --git a/src/cpp/cpp_namespace_spec.h b/src/cpp/cpp_namespace_spec.h index 68f50206031..f38b7f9dd1c 100644 --- a/src/cpp/cpp_namespace_spec.h +++ b/src/cpp/cpp_namespace_spec.h @@ -41,7 +41,7 @@ class cpp_namespace_spect:public exprt return get(ID_namespace); } - void set_namespace(const irep_idt &_namespace) + void set_namespace(irep_idt _namespace) { set(ID_namespace, _namespace); } diff --git a/src/cpp/cpp_scope.cpp b/src/cpp/cpp_scope.cpp index eb0831dbb73..40015575b73 100644 --- a/src/cpp/cpp_scope.cpp +++ b/src/cpp/cpp_scope.cpp @@ -25,7 +25,7 @@ std::ostream &operator << (std::ostream &out, cpp_scopet::lookup_kindt kind) } void cpp_scopet::lookup_rec( - const irep_idt &base_name_to_lookup, + irep_idt base_name_to_lookup, lookup_kindt kind, id_sett &id_set) { @@ -81,7 +81,7 @@ void cpp_scopet::lookup_rec( } void cpp_scopet::lookup_rec( - const irep_idt &base_name_to_lookup, + irep_idt base_name_to_lookup, lookup_kindt kind, cpp_idt::id_classt identifier_class, id_sett &id_set) @@ -154,9 +154,8 @@ void cpp_scopet::lookup_rec( base_name_to_lookup, kind, identifier_class, id_set); } -cpp_scopet::id_sett cpp_scopet::lookup_identifier( - const irep_idt &id, - cpp_idt::id_classt identifier_class) +cpp_scopet::id_sett +cpp_scopet::lookup_identifier(irep_idt id, cpp_idt::id_classt identifier_class) { id_sett id_set; @@ -187,7 +186,7 @@ cpp_scopet::id_sett cpp_scopet::lookup_identifier( return id_set; } -cpp_scopet &cpp_scopet::new_scope(const irep_idt &new_scope_name) +cpp_scopet &cpp_scopet::new_scope(irep_idt new_scope_name) { cpp_idt &id=insert(new_scope_name); id.identifier=prefix+id2string(new_scope_name); @@ -198,7 +197,7 @@ cpp_scopet &cpp_scopet::new_scope(const irep_idt &new_scope_name) return (cpp_scopet &)id; } -bool cpp_scopet::contains(const irep_idt &base_name_to_lookup) +bool cpp_scopet::contains(irep_idt base_name_to_lookup) { return !lookup(base_name_to_lookup, SCOPE_ONLY).empty(); } diff --git a/src/cpp/cpp_scope.h b/src/cpp/cpp_scope.h index 228734f1c36..a3085dfdf64 100644 --- a/src/cpp/cpp_scope.h +++ b/src/cpp/cpp_scope.h @@ -29,7 +29,7 @@ class cpp_scopet:public cpp_idt enum lookup_kindt { SCOPE_ONLY, QUALIFIED, RECURSIVE }; - id_sett lookup(const irep_idt &base_name_to_lookup, lookup_kindt kind) + id_sett lookup(irep_idt base_name_to_lookup, lookup_kindt kind) { id_sett result; lookup_rec(base_name_to_lookup, kind, result); @@ -37,7 +37,7 @@ class cpp_scopet:public cpp_idt } id_sett lookup( - const irep_idt &base_name_to_lookup, + irep_idt base_name_to_lookup, lookup_kindt kind, cpp_idt::id_classt identifier_class) { @@ -46,10 +46,9 @@ class cpp_scopet:public cpp_idt return result; } - id_sett - lookup_identifier(const irep_idt &id, cpp_idt::id_classt identifier_class); + id_sett lookup_identifier(irep_idt id, cpp_idt::id_classt identifier_class); - cpp_idt &insert(const irep_idt &_base_name) + cpp_idt &insert(irep_idt _base_name) { cpp_id_mapt::iterator it= sub.insert(std::pair @@ -72,7 +71,7 @@ class cpp_scopet:public cpp_idt return it->second; } - bool contains(const irep_idt &base_name_to_lookup); + bool contains(irep_idt base_name_to_lookup); bool is_root_scope() const { @@ -112,13 +111,13 @@ class cpp_scopet:public cpp_idt using_scopes.push_back(&other); } - class cpp_scopet &new_scope(const irep_idt &new_scope_name); + class cpp_scopet &new_scope(irep_idt new_scope_name); protected: - void lookup_rec(const irep_idt &base_name, lookup_kindt kind, id_sett &); + void lookup_rec(irep_idt base_name, lookup_kindt kind, id_sett &); void lookup_rec( - const irep_idt &base_name, + irep_idt base_name, lookup_kindt kind, cpp_idt::id_classt id_class, id_sett &); diff --git a/src/cpp/cpp_scopes.h b/src/cpp/cpp_scopes.h index dd3830003f3..edd65b6ca02 100644 --- a/src/cpp/cpp_scopes.h +++ b/src/cpp/cpp_scopes.h @@ -34,9 +34,7 @@ class cpp_scopest return *current_scope_ptr; } - cpp_scopet &new_scope( - const irep_idt &new_scope_name, - cpp_idt::id_classt id_class) + cpp_scopet &new_scope(irep_idt new_scope_name, cpp_idt::id_classt id_class) { PRECONDITION(!new_scope_name.empty()); cpp_scopet &n=current_scope_ptr->new_scope(new_scope_name); @@ -46,7 +44,7 @@ class cpp_scopest return n; } - cpp_scopet &new_namespace(const irep_idt &new_scope_name) + cpp_scopet &new_namespace(irep_idt new_scope_name) { return new_scope(new_scope_name, cpp_idt::id_classt::NAMESPACE); } @@ -69,7 +67,7 @@ class cpp_scopest cpp_scopet *current_scope_ptr; - cpp_idt &get_id(const irep_idt &identifier) + cpp_idt &get_id(irep_idt identifier) { id_mapt::const_iterator it=id_map.find(identifier); if(it==id_map.end()) @@ -77,14 +75,14 @@ class cpp_scopest return *(it->second); } - cpp_scopet &get_scope(const irep_idt &identifier) + cpp_scopet &get_scope(irep_idt identifier) { cpp_idt &n=get_id(identifier); CHECK_RETURN(n.is_scope); return (cpp_scopet &)n; } - cpp_scopet &set_scope(const irep_idt &identifier) + cpp_scopet &set_scope(irep_idt identifier) { current_scope_ptr=&get_scope(identifier); return current_scope(); diff --git a/src/cpp/cpp_template_parameter.h b/src/cpp/cpp_template_parameter.h index c55b6c30a19..f4a2cd1c850 100644 --- a/src/cpp/cpp_template_parameter.h +++ b/src/cpp/cpp_template_parameter.h @@ -65,13 +65,13 @@ struct template_parametert:public exprt struct template_parameter_symbol_typet : public typet { public: - explicit template_parameter_symbol_typet(const irep_idt &identifier) + explicit template_parameter_symbol_typet(irep_idt identifier) : typet(ID_template_parameter_symbol_type) { set_identifier(identifier); } - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_identifier, identifier); } diff --git a/src/cpp/cpp_typecheck.cpp b/src/cpp/cpp_typecheck.cpp index 4a8fb80c8e7..d372a1db3a8 100644 --- a/src/cpp/cpp_typecheck.cpp +++ b/src/cpp/cpp_typecheck.cpp @@ -375,7 +375,7 @@ void cpp_typecheckt::clean_up() } } -bool cpp_typecheckt::builtin_factory(const irep_idt &identifier) +bool cpp_typecheckt::builtin_factory(irep_idt identifier) { return ::builtin_factory( identifier, support_float16_type, symbol_table, get_message_handler()); diff --git a/src/cpp/cpp_typecheck.h b/src/cpp/cpp_typecheck.h index 3737974fa2f..ef744a92997 100644 --- a/src/cpp/cpp_typecheck.h +++ b/src/cpp/cpp_typecheck.h @@ -111,7 +111,7 @@ class cpp_typecheckt:public c_typecheck_baset void convert_anon_struct_union_member( const cpp_declarationt &declaration, - const irep_idt &access, + irep_idt access, struct_typet::componentst &components); // @@ -138,12 +138,12 @@ class cpp_typecheckt:public c_typecheck_baset void typecheck_class_template_member(cpp_declarationt &declaration); std::string class_template_identifier( - const irep_idt &base_name, + irep_idt base_name, const template_typet &template_type, const cpp_template_args_non_tct &partial_specialization_args); std::string function_template_identifier( - const irep_idt &base_name, + irep_idt base_name, const template_typet &template_type, const typet &function_type); @@ -217,12 +217,10 @@ class cpp_typecheckt:public c_typecheck_baset cpp_scopet &template_scope, const std::string &suffix); - void - convert_parameters(const irep_idt ¤t_mode, code_typet &function_type); + void convert_parameters(irep_idt current_mode, code_typet &function_type); - void convert_parameter( - const irep_idt ¤t_mode, - code_typet::parametert ¶meter); + void + convert_parameter(irep_idt current_mode, code_typet::parametert ¶meter); // // Misc @@ -230,7 +228,7 @@ class cpp_typecheckt:public c_typecheck_baset void default_ctor( const source_locationt &source_location, - const irep_idt &base_name, + irep_idt base_name, cpp_declarationt &ctor) const; void default_cpctor( @@ -263,15 +261,13 @@ class cpp_typecheckt:public c_typecheck_baset bool find_assignop(const symbolt &symbol)const; bool find_dtor(const symbolt &symbol)const; - bool find_parent( - const symbolt &symb, - const irep_idt &base_name, - irep_idt &identifier); + bool + find_parent(const symbolt &symb, irep_idt base_name, irep_idt &identifier); bool get_component( const source_locationt &source_location, const exprt &object, - const irep_idt &component_name, + irep_idt component_name, exprt &member); void new_temporary(const source_locationt &source_location, @@ -289,12 +285,12 @@ class cpp_typecheckt:public c_typecheck_baset void clean_up(); void add_base_components( - const struct_typet &from, - const irep_idt &access, - struct_typet &to, - std::set &bases, - std::set &vbases, - bool is_virtual); + const struct_typet &from, + irep_idt access, + struct_typet &to, + std::set &bases, + std::set &vbases, + bool is_virtual); bool cast_away_constness(const typet &t1, const typet &t2) const; @@ -328,7 +324,7 @@ class cpp_typecheckt:public c_typecheck_baset void add_method_body(symbolt *_method_symbol); - bool builtin_factory(const irep_idt &) override; + bool builtin_factory(irep_idt) override; // types @@ -343,17 +339,15 @@ class cpp_typecheckt:public c_typecheck_baset // determine the scope into which a tag goes // (enums, structs, union, classes) - cpp_scopet &tag_scope( - const irep_idt &_base_name, - bool has_body, - bool tag_only_declaration); + cpp_scopet & + tag_scope(irep_idt _base_name, bool has_body, bool tag_only_declaration); void typecheck_compound_declarator( const symbolt &symbol, const cpp_declarationt &declaration, cpp_declaratort &declarator, struct_typet::componentst &components, - const irep_idt &access, + irep_idt access, bool is_static, bool is_typedef, bool is_mutable); diff --git a/src/cpp/cpp_typecheck_bases.cpp b/src/cpp/cpp_typecheck_bases.cpp index 0cc1f7e57ec..9daeeb6a2c2 100644 --- a/src/cpp/cpp_typecheck_bases.cpp +++ b/src/cpp/cpp_typecheck_bases.cpp @@ -118,7 +118,7 @@ void cpp_typecheckt::typecheck_compound_bases(struct_typet &type) void cpp_typecheckt::add_base_components( const struct_typet &from, - const irep_idt &access, + irep_idt access, struct_typet &to, std::set &bases, std::set &vbases, diff --git a/src/cpp/cpp_typecheck_compound_type.cpp b/src/cpp/cpp_typecheck_compound_type.cpp index 48c62767aae..407a43774b8 100644 --- a/src/cpp/cpp_typecheck_compound_type.cpp +++ b/src/cpp/cpp_typecheck_compound_type.cpp @@ -86,7 +86,7 @@ bool cpp_typecheckt::has_auto(const typet &type) } cpp_scopet &cpp_typecheckt::tag_scope( - const irep_idt &base_name, + irep_idt base_name, bool has_body, bool tag_only_declaration) { @@ -294,7 +294,7 @@ void cpp_typecheckt::typecheck_compound_declarator( const cpp_declarationt &declaration, cpp_declaratort &declarator, struct_typet::componentst &components, - const irep_idt &access, + irep_idt access, bool is_static, bool is_typedef, bool is_mutable) @@ -1425,7 +1425,7 @@ void cpp_typecheckt::add_anonymous_members_to_scope( void cpp_typecheckt::convert_anon_struct_union_member( const cpp_declarationt &declaration, - const irep_idt &access, + irep_idt access, struct_typet::componentst &components) { const struct_union_typet &final_type = @@ -1485,7 +1485,7 @@ void cpp_typecheckt::convert_anon_struct_union_member( bool cpp_typecheckt::get_component( const source_locationt &source_location, const exprt &object, - const irep_idt &component_name, + irep_idt component_name, exprt &member) { PRECONDITION( diff --git a/src/cpp/cpp_typecheck_constructor.cpp b/src/cpp/cpp_typecheck_constructor.cpp index 79709e447a2..7c8a170fbd7 100644 --- a/src/cpp/cpp_typecheck_constructor.cpp +++ b/src/cpp/cpp_typecheck_constructor.cpp @@ -25,8 +25,8 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \param [out] block: non-typechecked block static void copy_parent( const source_locationt &source_location, - const irep_idt &parent_base_name, - const irep_idt &arg_name, + irep_idt parent_base_name, + irep_idt arg_name, exprt &block) { exprt op0( @@ -56,8 +56,8 @@ static void copy_parent( /// \param [out] block: non-typechecked block static void copy_member( const source_locationt &source_location, - const irep_idt &member_base_name, - const irep_idt &arg_name, + irep_idt member_base_name, + irep_idt arg_name, exprt &block) { cpp_namet op0(member_base_name, source_location); @@ -84,9 +84,9 @@ static void copy_member( /// \param [out] block: non-typechecked block static void copy_array( const source_locationt &source_location, - const irep_idt &member_base_name, + irep_idt member_base_name, mp_integer i, - const irep_idt &arg_name, + irep_idt arg_name, exprt &block) { // Build the index expression @@ -117,7 +117,7 @@ static void copy_array( /// Generate code for implicit default constructors void cpp_typecheckt::default_ctor( const source_locationt &source_location, - const irep_idt &base_name, + irep_idt base_name, cpp_declarationt &ctor) const { cpp_declaratort decl; diff --git a/src/cpp/cpp_typecheck_expr.cpp b/src/cpp/cpp_typecheck_expr.cpp index 1201882af20..b309cf6c1fe 100644 --- a/src/cpp/cpp_typecheck_expr.cpp +++ b/src/cpp/cpp_typecheck_expr.cpp @@ -34,7 +34,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu bool cpp_typecheckt::find_parent( const symbolt &symb, - const irep_idt &base_name, + irep_idt base_name, irep_idt &identifier) { for(const auto &b : to_struct_type(symb.type).bases()) diff --git a/src/cpp/cpp_typecheck_function.cpp b/src/cpp/cpp_typecheck_function.cpp index 154b037dae4..b563c1cfb3f 100644 --- a/src/cpp/cpp_typecheck_function.cpp +++ b/src/cpp/cpp_typecheck_function.cpp @@ -17,7 +17,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_typecheck.h" void cpp_typecheckt::convert_parameter( - const irep_idt ¤t_mode, + irep_idt current_mode, code_typet::parametert ¶meter) { irep_idt base_name=id2string(parameter.get_base_name()); @@ -66,7 +66,7 @@ void cpp_typecheckt::convert_parameter( } void cpp_typecheckt::convert_parameters( - const irep_idt ¤t_mode, + irep_idt current_mode, code_typet &function_type) { code_typet::parameterst ¶meters= diff --git a/src/cpp/cpp_typecheck_resolve.cpp b/src/cpp/cpp_typecheck_resolve.cpp index fb8d19068f4..3232522c67e 100644 --- a/src/cpp/cpp_typecheck_resolve.cpp +++ b/src/cpp/cpp_typecheck_resolve.cpp @@ -668,7 +668,7 @@ void cpp_typecheck_resolvet::resolve_argument( } exprt cpp_typecheck_resolvet::do_builtin( - const irep_idt &base_name, + irep_idt base_name, const cpp_typecheck_fargst &fargs, const cpp_template_args_non_tct &template_args) { @@ -998,7 +998,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_scope( /// disambiguate partial specialization struct_tag_typet cpp_typecheck_resolvet::disambiguate_template_classes( - const irep_idt &base_name, + irep_idt base_name, const cpp_scopest::id_sett &id_set, const cpp_template_args_non_tct &full_template_args) { @@ -1277,7 +1277,7 @@ cpp_scopet &cpp_typecheck_resolvet::resolve_namespace( } void cpp_typecheck_resolvet::show_identifiers( - const irep_idt &base_name, + irep_idt base_name, const resolve_identifierst &identifiers, std::ostream &out) { @@ -2343,7 +2343,7 @@ void cpp_typecheck_resolvet::filter_for_namespaces( void cpp_typecheck_resolvet::resolve_with_arguments( cpp_scopest::id_sett &id_set, - const irep_idt &base_name, + irep_idt base_name, const cpp_typecheck_fargst &fargs) { // not clear what this is good for diff --git a/src/cpp/cpp_typecheck_resolve.h b/src/cpp/cpp_typecheck_resolve.h index 82471fa554f..84b1a42b919 100644 --- a/src/cpp/cpp_typecheck_resolve.h +++ b/src/cpp/cpp_typecheck_resolve.h @@ -75,7 +75,7 @@ class cpp_typecheck_resolvet const wantt want); struct_tag_typet disambiguate_template_classes( - const irep_idt &base_name, + irep_idt base_name, const cpp_scopest::id_sett &id_set, const cpp_template_args_non_tct &template_args); @@ -124,18 +124,18 @@ class cpp_typecheck_resolvet const cpp_typecheck_fargst &fargs); exprt do_builtin( - const irep_idt &base_name, + irep_idt base_name, const cpp_typecheck_fargst &fargs, const cpp_template_args_non_tct &template_args); void show_identifiers( - const irep_idt &base_name, + irep_idt base_name, const resolve_identifierst &identifiers, std::ostream &out); void resolve_with_arguments( cpp_scopest::id_sett &id_set, - const irep_idt &base_name, + irep_idt base_name, const cpp_typecheck_fargst &fargs); void filter_for_named_scopes(cpp_scopest::id_sett &id_set); diff --git a/src/cpp/cpp_typecheck_template.cpp b/src/cpp/cpp_typecheck_template.cpp index 6dfcd4a05e2..e7e67ee336e 100644 --- a/src/cpp/cpp_typecheck_template.cpp +++ b/src/cpp/cpp_typecheck_template.cpp @@ -412,7 +412,7 @@ void cpp_typecheckt::typecheck_class_template_member( } std::string cpp_typecheckt::class_template_identifier( - const irep_idt &base_name, + irep_idt base_name, const template_typet &template_type, const cpp_template_args_non_tct &partial_specialization_args) { @@ -471,7 +471,7 @@ std::string cpp_typecheckt::class_template_identifier( } std::string cpp_typecheckt::function_template_identifier( - const irep_idt &base_name, + irep_idt base_name, const template_typet &template_type, const typet &function_type) { diff --git a/src/cpp/parse.cpp b/src/cpp/parse.cpp index 777f4b2f0bd..570b11f6a66 100644 --- a/src/cpp/parse.cpp +++ b/src/cpp/parse.cpp @@ -220,9 +220,9 @@ class Parser // NOLINT(readability/identifiers) new_scopet root_scope; new_scopet *current_scope; new_scopet &add_id(const irept &name, new_scopet::kindt); - new_scopet &add_id(const irep_idt &, new_scopet::kindt); + new_scopet &add_id(irep_idt, new_scopet::kindt); void make_sub_scope(const irept &name, new_scopet::kindt); - void make_sub_scope(const irep_idt &, new_scopet::kindt); + void make_sub_scope(irep_idt, new_scopet::kindt); enum DeclKind { kDeclarator, kArgDeclarator, kCastDeclarator }; enum TemplateDeclKind { tdk_unknown, tdk_decl, tdk_instantiation, @@ -436,7 +436,7 @@ new_scopet &Parser::add_id(const irept &cpp_name, new_scopet::kindt kind) return add_id(id, kind); } -new_scopet &Parser::add_id(const irep_idt &id, new_scopet::kindt kind) +new_scopet &Parser::add_id(irep_idt id, new_scopet::kindt kind) { new_scopet &s=current_scope->id_map[id]; @@ -453,7 +453,7 @@ void Parser::make_sub_scope(const irept &cpp_name, new_scopet::kindt kind) current_scope=&s; } -void Parser::make_sub_scope(const irep_idt &id, new_scopet::kindt kind) +void Parser::make_sub_scope(irep_idt id, new_scopet::kindt kind) { new_scopet &s=add_id(id, kind); current_scope=&s; diff --git a/src/cpp/template_map.cpp b/src/cpp/template_map.cpp index 16767e6e5a3..b12c3ed9ac9 100644 --- a/src/cpp/template_map.cpp +++ b/src/cpp/template_map.cpp @@ -90,7 +90,7 @@ void template_mapt::apply(exprt &expr) const apply(*it); } -exprt template_mapt::lookup(const irep_idt &identifier) const +exprt template_mapt::lookup(irep_idt identifier) const { type_mapt::const_iterator t_it= type_map.find(identifier); @@ -111,7 +111,7 @@ exprt template_mapt::lookup(const irep_idt &identifier) const return static_cast(get_nil_irep()); } -typet template_mapt::lookup_type(const irep_idt &identifier) const +typet template_mapt::lookup_type(irep_idt identifier) const { type_mapt::const_iterator t_it= type_map.find(identifier); @@ -122,7 +122,7 @@ typet template_mapt::lookup_type(const irep_idt &identifier) const return static_cast(get_nil_irep()); } -exprt template_mapt::lookup_expr(const irep_idt &identifier) const +exprt template_mapt::lookup_expr(irep_idt identifier) const { expr_mapt::const_iterator e_it= expr_map.find(identifier); diff --git a/src/cpp/template_map.h b/src/cpp/template_map.h index 52be1f217f9..544eff8bc70 100644 --- a/src/cpp/template_map.h +++ b/src/cpp/template_map.h @@ -40,9 +40,9 @@ class template_mapt expr_map.swap(template_map.expr_map); } - exprt lookup(const irep_idt &identifier) const; - typet lookup_type(const irep_idt &identifier) const; - exprt lookup_expr(const irep_idt &identifier) const; + exprt lookup(irep_idt identifier) const; + typet lookup_type(irep_idt identifier) const; + exprt lookup_expr(irep_idt identifier) const; void print(std::ostream &out) const; diff --git a/src/cprover/instrument_contracts.cpp b/src/cprover/instrument_contracts.cpp index e386f98512d..4306e7d4262 100644 --- a/src/cprover/instrument_contracts.cpp +++ b/src/cprover/instrument_contracts.cpp @@ -24,7 +24,7 @@ Author: Daniel Kroening, dkr@amazon.com #define MAX_TEXT 20 std::optional -get_contract(const irep_idt &function_identifier, const namespacet &ns) +get_contract(irep_idt function_identifier, const namespacet &ns) { // contracts are in a separate symbol, with prefix "contract::" auto contract_identifier = "contract::" + id2string(function_identifier); @@ -35,7 +35,7 @@ get_contract(const irep_idt &function_identifier, const namespacet &ns) return to_code_with_contract_type(symbol_ptr->type); } -bool has_contract(const irep_idt &function_identifier, const namespacet &ns) +bool has_contract(irep_idt function_identifier, const namespacet &ns) { return get_contract(function_identifier, ns).has_value(); } @@ -179,8 +179,7 @@ static exprt make_assigns_assertion( return disjunction(disjuncts); } -static bool -is_procedure_local(const irep_idt &function_identifier, const exprt &lhs) +static bool is_procedure_local(irep_idt function_identifier, const exprt &lhs) { if(lhs.id() == ID_member) return is_procedure_local( diff --git a/src/cprover/instrument_contracts.h b/src/cprover/instrument_contracts.h index 04f269a9970..0f4025370c0 100644 --- a/src/cprover/instrument_contracts.h +++ b/src/cprover/instrument_contracts.h @@ -23,6 +23,6 @@ class namespacet; void instrument_contracts(goto_modelt &); std::optional -get_contract(const irep_idt &function_identifier, const namespacet &); +get_contract(irep_idt function_identifier, const namespacet &); #endif // CPROVER_CPOVER_INSTRUMENT_CONTRACTS_H diff --git a/src/goto-analyzer/unreachable_instructions.cpp b/src/goto-analyzer/unreachable_instructions.cpp index 5f0cc4b8fff..b23d3b33550 100644 --- a/src/goto-analyzer/unreachable_instructions.cpp +++ b/src/goto-analyzer/unreachable_instructions.cpp @@ -66,7 +66,7 @@ static void build_dead_map_from_ai( static void output_dead_plain( const namespacet &ns, - const irep_idt &function_identifier, + irep_idt function_identifier, const goto_programt &goto_program, const dead_mapt &dead_map, std::ostream &os) @@ -80,7 +80,7 @@ static void output_dead_plain( } static void add_to_xml( - const irep_idt &function_identifier, + irep_idt function_identifier, const goto_programt &goto_program, const dead_mapt &dead_map, xmlt &dest) @@ -115,7 +115,7 @@ file_name_string_opt(const source_locationt &source_location) static void add_to_json( const namespacet &ns, - const irep_idt &function_identifier, + irep_idt function_identifier, const goto_programt &goto_program, const dead_mapt &dead_map, json_arrayt &dest) @@ -263,7 +263,7 @@ line_string_opt(const source_locationt &source_location) } static void json_output_function( - const irep_idt &function, + irep_idt function, const source_locationt &first_location, const source_locationt &last_location, json_arrayt &dest) @@ -280,7 +280,7 @@ static void json_output_function( } static void xml_output_function( - const irep_idt &function, + irep_idt function, const source_locationt &first_location, const source_locationt &last_location, xmlt &dest) diff --git a/src/goto-cc/linker_script_merge.cpp b/src/goto-cc/linker_script_merge.cpp index 12319f59021..c7c7d6ae0f9 100644 --- a/src/goto-cc/linker_script_merge.cpp +++ b/src/goto-cc/linker_script_merge.cpp @@ -276,11 +276,11 @@ int linker_script_merget::pointerize_linker_defined_symbols( } int linker_script_merget::replace_expr( - exprt &old_expr, - const linker_valuest &linker_values, - const symbol_exprt &old_symbol, - const irep_idt &ident, - const std::string &shape) + exprt &old_expr, + const linker_valuest &linker_values, + const symbol_exprt &old_symbol, + irep_idt ident, + const std::string &shape) { auto it=linker_values.find(ident); if(it==linker_values.end()) diff --git a/src/goto-cc/linker_script_merge.h b/src/goto-cc/linker_script_merge.h index 37b91d37a65..cbadd96e650 100644 --- a/src/goto-cc/linker_script_merge.h +++ b/src/goto-cc/linker_script_merge.h @@ -173,11 +173,11 @@ class linker_script_merget /// \brief do the actual replacement of an expr with a new pointer expr int replace_expr( - exprt &old_expr, - const linker_valuest &linker_values, - const symbol_exprt &old_symbol, - const irep_idt &ident, - const std::string &shape); + exprt &old_expr, + const linker_valuest &linker_values, + const symbol_exprt &old_symbol, + irep_idt ident, + const std::string &shape); /// \brief fill `to_pointerize` with names of linker symbols appearing in expr void symbols_to_pointerize( diff --git a/src/goto-checker/bmc_util.cpp b/src/goto-checker/bmc_util.cpp index 5bb3d9ce459..09e87b3ebe9 100644 --- a/src/goto-checker/bmc_util.cpp +++ b/src/goto-checker/bmc_util.cpp @@ -47,8 +47,7 @@ void build_error_trace( build_goto_trace(symex_target_equation, decision_procedure, ns, goto_trace); } -ssa_step_predicatet -ssa_step_matches_failing_property(const irep_idt &property_id) +ssa_step_predicatet ssa_step_matches_failing_property(irep_idt property_id) { return [property_id]( symex_target_equationt::SSA_stepst::const_iterator step, @@ -386,9 +385,8 @@ void run_property_decider( << messaget::eom; property_decider.add_constraint_from_goals( - [&properties](const irep_idt &property_id) { - return is_property_to_check(properties.at(property_id).status); - }); + [&properties](irep_idt property_id) + { return is_property_to_check(properties.at(property_id).status); }); auto const sat_solver_start = std::chrono::steady_clock::now(); diff --git a/src/goto-checker/bmc_util.h b/src/goto-checker/bmc_util.h index c604856d7ba..6f2fad7c63c 100644 --- a/src/goto-checker/bmc_util.h +++ b/src/goto-checker/bmc_util.h @@ -41,8 +41,7 @@ void convert_symex_target_equation( /// Returns a function that checks whether an SSA step is an assertion /// with \p property_id. Usually used for `build_goto_trace`. -ssa_step_predicatet -ssa_step_matches_failing_property(const irep_idt &property_id); +ssa_step_predicatet ssa_step_matches_failing_property(irep_idt property_id); /// Outputs a message that an error trace is being built void message_building_error_trace(messaget &); diff --git a/src/goto-checker/fault_localization_provider.h b/src/goto-checker/fault_localization_provider.h index 39a303bfcff..4b0b8d1ad5d 100644 --- a/src/goto-checker/fault_localization_provider.h +++ b/src/goto-checker/fault_localization_provider.h @@ -36,8 +36,7 @@ class fault_localization_providert public: /// Returns the most likely fault locations /// for the given FAILed \p property_id - virtual fault_location_infot - localize_fault(const irep_idt &property_id) const = 0; + virtual fault_location_infot localize_fault(irep_idt property_id) const = 0; virtual ~fault_localization_providert() = default; }; diff --git a/src/goto-checker/goto_symex_fault_localizer.cpp b/src/goto-checker/goto_symex_fault_localizer.cpp index bd7200e3fec..4afa696c505 100644 --- a/src/goto-checker/goto_symex_fault_localizer.cpp +++ b/src/goto-checker/goto_symex_fault_localizer.cpp @@ -29,8 +29,8 @@ goto_symex_fault_localizert::goto_symex_fault_localizert( { } -fault_location_infot goto_symex_fault_localizert:: -operator()(const irep_idt &failed_property_id) +fault_location_infot +goto_symex_fault_localizert::operator()(irep_idt failed_property_id) { fault_location_infot fault_location; localization_pointst localization_points; @@ -51,7 +51,7 @@ operator()(const irep_idt &failed_property_id) } const SSA_stept &goto_symex_fault_localizert::collect_guards( - const irep_idt &failed_property_id, + irep_idt failed_property_id, localization_pointst &localization_points, fault_location_infot &fault_location) { diff --git a/src/goto-checker/goto_symex_fault_localizer.h b/src/goto-checker/goto_symex_fault_localizer.h index 6a6b1d1c5dd..839eceb064e 100644 --- a/src/goto-checker/goto_symex_fault_localizer.h +++ b/src/goto-checker/goto_symex_fault_localizer.h @@ -31,7 +31,7 @@ class goto_symex_fault_localizert const symex_target_equationt &equation, stack_decision_proceduret &solver); - fault_location_infot operator()(const irep_idt &failed_property_id); + fault_location_infot operator()(irep_idt failed_property_id); protected: const optionst &options; @@ -47,7 +47,7 @@ class goto_symex_fault_localizert /// and initializes fault_location_info, and returns the SSA step of /// the failed property const SSA_stept &collect_guards( - const irep_idt &failed_property_id, + irep_idt failed_property_id, localization_pointst &localization_points, fault_location_infot &fault_location); diff --git a/src/goto-checker/goto_symex_property_decider.cpp b/src/goto-checker/goto_symex_property_decider.cpp index fdec0b18c19..63a9d84ad32 100644 --- a/src/goto-checker/goto_symex_property_decider.cpp +++ b/src/goto-checker/goto_symex_property_decider.cpp @@ -81,7 +81,7 @@ void goto_symex_property_decidert::convert_goals() } void goto_symex_property_decidert::add_constraint_from_goals( - std::function select_property) + std::function select_property) { exprt::operandst disjuncts; decision_proceduret &decision_procedure = solver->decision_procedure(); diff --git a/src/goto-checker/goto_symex_property_decider.h b/src/goto-checker/goto_symex_property_decider.h index 368416763b2..c23eb19a47a 100644 --- a/src/goto-checker/goto_symex_property_decider.h +++ b/src/goto-checker/goto_symex_property_decider.h @@ -39,7 +39,7 @@ class goto_symex_property_decidert /// Add disjunction of negated selected properties to the equation void add_constraint_from_goals( - std::function select_property); + std::function select_property); /// Calls solve() on the solver instance decision_proceduret::resultt solve(); diff --git a/src/goto-checker/goto_trace_provider.h b/src/goto-checker/goto_trace_provider.h index e56902c3d3f..a42d553fbb0 100644 --- a/src/goto-checker/goto_trace_provider.h +++ b/src/goto-checker/goto_trace_provider.h @@ -32,7 +32,7 @@ class goto_trace_providert /// Builds and returns the trace for the FAILed property /// with the given \p property_id - virtual goto_tracet build_trace(const irep_idt &property_id) const = 0; + virtual goto_tracet build_trace(irep_idt property_id) const = 0; /// Returns the namespace associated with the traces virtual const namespacet &get_namespace() const = 0; diff --git a/src/goto-checker/goto_trace_storage.cpp b/src/goto-checker/goto_trace_storage.cpp index dfb8c572080..8f07eea2e82 100644 --- a/src/goto-checker/goto_trace_storage.cpp +++ b/src/goto-checker/goto_trace_storage.cpp @@ -56,8 +56,7 @@ const std::list &goto_trace_storaget::all() const return traces; } -const goto_tracet &goto_trace_storaget:: -operator[](const irep_idt &property_id) const +const goto_tracet &goto_trace_storaget::operator[](irep_idt property_id) const { const auto trace_found = property_id_to_trace_index.find(property_id); PRECONDITION(trace_found != property_id_to_trace_index.end()); diff --git a/src/goto-checker/goto_trace_storage.h b/src/goto-checker/goto_trace_storage.h index 36c1596fdc3..0b1c9bc45f9 100644 --- a/src/goto-checker/goto_trace_storage.h +++ b/src/goto-checker/goto_trace_storage.h @@ -33,7 +33,7 @@ class goto_trace_storaget const goto_tracet &insert_all(goto_tracet &&); const std::list &all() const; - const goto_tracet &operator[](const irep_idt &property_id) const; + const goto_tracet &operator[](irep_idt property_id) const; const namespacet &get_namespace() const; diff --git a/src/goto-checker/multi_path_symex_checker.cpp b/src/goto-checker/multi_path_symex_checker.cpp index 40f60b6ed85..56532d72637 100644 --- a/src/goto-checker/multi_path_symex_checker.cpp +++ b/src/goto-checker/multi_path_symex_checker.cpp @@ -123,8 +123,7 @@ goto_tracet multi_path_symex_checkert::build_shortest_trace() const return goto_trace; } -goto_tracet -multi_path_symex_checkert::build_trace(const irep_idt &property_id) const +goto_tracet multi_path_symex_checkert::build_trace(irep_idt property_id) const { goto_tracet goto_trace; build_goto_trace( @@ -154,7 +153,7 @@ void multi_path_symex_checkert::output_error_witness( } fault_location_infot -multi_path_symex_checkert::localize_fault(const irep_idt &property_id) const +multi_path_symex_checkert::localize_fault(irep_idt property_id) const { goto_symex_fault_localizert fault_localizer( options, diff --git a/src/goto-checker/multi_path_symex_checker.h b/src/goto-checker/multi_path_symex_checker.h index b604681a32b..93f55f21c92 100644 --- a/src/goto-checker/multi_path_symex_checker.h +++ b/src/goto-checker/multi_path_symex_checker.h @@ -45,14 +45,13 @@ class multi_path_symex_checkert : public multi_path_symex_only_checkert, goto_tracet build_full_trace() const override; goto_tracet build_shortest_trace() const override; - goto_tracet build_trace(const irep_idt &) const override; + goto_tracet build_trace(irep_idt) const override; const namespacet &get_namespace() const override; void output_error_witness(const goto_tracet &) override; void output_proof() override; - fault_location_infot - localize_fault(const irep_idt &property_id) const override; + fault_location_infot localize_fault(irep_idt property_id) const override; void report() override; diff --git a/src/goto-checker/properties.cpp b/src/goto-checker/properties.cpp index 676b75efdae..871c040e2b2 100644 --- a/src/goto-checker/properties.cpp +++ b/src/goto-checker/properties.cpp @@ -100,14 +100,13 @@ void update_properties_from_goto_model( } } -std::string -as_string(const irep_idt &property_id, const property_infot &property_info) +std::string as_string(irep_idt property_id, const property_infot &property_info) { return "[" + id2string(property_id) + "] " + property_info.description + ": " + as_string(property_info.status); } -xmlt xml(const irep_idt &property_id, const property_infot &property_info) +xmlt xml(irep_idt property_id, const property_infot &property_info) { xmlt xml_result("result"); xml_result.set_attribute("property", id2string(property_id)); @@ -119,7 +118,7 @@ xmlt xml(const irep_idt &property_id, const property_infot &property_info) template static void json( json_objectT &result, - const irep_idt &property_id, + irep_idt property_id, const property_infot &property_info) { result["property"] = json_stringt(property_id); @@ -128,8 +127,7 @@ static void json( result["sourceLocation"] = json(property_info.pc->source_location()); } -json_objectt -json(const irep_idt &property_id, const property_infot &property_info) +json_objectt json(irep_idt property_id, const property_infot &property_info) { json_objectt result; json(result, property_id, property_info); @@ -138,7 +136,7 @@ json(const irep_idt &property_id, const property_infot &property_info) void json( json_stream_objectt &result, - const irep_idt &property_id, + irep_idt property_id, const property_infot &property_info) { json(result, property_id, property_info); diff --git a/src/goto-checker/properties.h b/src/goto-checker/properties.h index 9a74b700fd3..c561e1da96c 100644 --- a/src/goto-checker/properties.h +++ b/src/goto-checker/properties.h @@ -84,15 +84,14 @@ void update_properties_from_goto_model( const abstract_goto_modelt &goto_model); std::string -as_string(const irep_idt &property_id, const property_infot &property_info); +as_string(irep_idt property_id, const property_infot &property_info); -xmlt xml(const irep_idt &property_id, const property_infot &property_info); +xmlt xml(irep_idt property_id, const property_infot &property_info); -json_objectt -json(const irep_idt &property_id, const property_infot &property_info); +json_objectt json(irep_idt property_id, const property_infot &property_info); /// Write the property info into the given JSON stream object -void json(json_stream_objectt &, const irep_idt &, const property_infot &); +void json(json_stream_objectt &, irep_idt, const property_infot &); int result_to_exit_code(resultt result); diff --git a/src/goto-checker/report_util.cpp b/src/goto-checker/report_util.cpp index 1bf165f4ab8..4e37c2cacf3 100644 --- a/src/goto-checker/report_util.cpp +++ b/src/goto-checker/report_util.cpp @@ -142,7 +142,7 @@ void report_error(ui_message_handlert &ui_message_handler) } static void output_single_property_plain( - const irep_idt &property_id, + irep_idt property_id, const property_infot &property_info, messaget &log, irep_idt current_file = irep_idt()) @@ -206,7 +206,8 @@ is_property_less_than(const propertyt &property1, const propertyt &property2) std::stoul(id2string(p2.get_line())); const auto split_property_id = - [](const irep_idt &property_id) -> std::pair { + [](irep_idt property_id) -> std::pair + { const auto property_string = id2string(property_id); const auto last_dot = property_string.rfind('.'); std::string property_name; @@ -450,7 +451,7 @@ max_fault_localization_score(const fault_location_infot &fault_location) } static void output_fault_localization_plain( - const irep_idt &property_id, + irep_idt property_id, const fault_location_infot &fault_location, messaget &log) { @@ -481,7 +482,7 @@ static void output_fault_localization_plain( } static xmlt xml( - const irep_idt &property_id, + irep_idt property_id, const fault_location_infot &fault_location, messaget &log) { diff --git a/src/goto-checker/single_loop_incremental_symex_checker.cpp b/src/goto-checker/single_loop_incremental_symex_checker.cpp index f264a728f58..7d843119a38 100644 --- a/src/goto-checker/single_loop_incremental_symex_checker.cpp +++ b/src/goto-checker/single_loop_incremental_symex_checker.cpp @@ -124,9 +124,8 @@ operator()(propertiest &properties) } property_decider.add_constraint_from_goals( - [&properties](const irep_idt &property_id) { - return is_property_to_check(properties.at(property_id).status); - }); + [&properties](irep_idt property_id) + { return is_property_to_check(properties.at(property_id).status); }); log.status() << "Running " @@ -218,8 +217,8 @@ goto_tracet single_loop_incremental_symex_checkert::build_shortest_trace() const return goto_trace; } -goto_tracet single_loop_incremental_symex_checkert::build_trace( - const irep_idt &property_id) const +goto_tracet +single_loop_incremental_symex_checkert::build_trace(irep_idt property_id) const { goto_tracet goto_trace; build_goto_trace( diff --git a/src/goto-checker/single_loop_incremental_symex_checker.h b/src/goto-checker/single_loop_incremental_symex_checker.h index e5fd98bde13..6b7c8f36246 100644 --- a/src/goto-checker/single_loop_incremental_symex_checker.h +++ b/src/goto-checker/single_loop_incremental_symex_checker.h @@ -45,7 +45,7 @@ class single_loop_incremental_symex_checkert : public incremental_goto_checkert, resultt operator()(propertiest &) override; goto_tracet build_full_trace() const override; - goto_tracet build_trace(const irep_idt &) const override; + goto_tracet build_trace(irep_idt) const override; goto_tracet build_shortest_trace() const override; const namespacet &get_namespace() const override; diff --git a/src/goto-checker/single_path_symex_checker.cpp b/src/goto-checker/single_path_symex_checker.cpp index 0e616252879..ae0ffde4994 100644 --- a/src/goto-checker/single_path_symex_checker.cpp +++ b/src/goto-checker/single_path_symex_checker.cpp @@ -158,8 +158,7 @@ goto_tracet single_path_symex_checkert::build_shortest_trace() const return goto_trace; } -goto_tracet -single_path_symex_checkert::build_trace(const irep_idt &property_id) const +goto_tracet single_path_symex_checkert::build_trace(irep_idt property_id) const { goto_tracet goto_trace; build_goto_trace( diff --git a/src/goto-checker/single_path_symex_checker.h b/src/goto-checker/single_path_symex_checker.h index eca9ad0af80..b1048216346 100644 --- a/src/goto-checker/single_path_symex_checker.h +++ b/src/goto-checker/single_path_symex_checker.h @@ -33,7 +33,7 @@ class single_path_symex_checkert : public single_path_symex_only_checkert, goto_tracet build_full_trace() const override; goto_tracet build_shortest_trace() const override; - goto_tracet build_trace(const irep_idt &) const override; + goto_tracet build_trace(irep_idt) const override; const namespacet &get_namespace() const override; void output_error_witness(const goto_tracet &) override; diff --git a/src/goto-checker/symex_bmc.cpp b/src/goto-checker/symex_bmc.cpp index cd99776aea2..b068f470b2b 100644 --- a/src/goto-checker/symex_bmc.cpp +++ b/src/goto-checker/symex_bmc.cpp @@ -171,7 +171,7 @@ bool symex_bmct::should_stop_unwind( } bool symex_bmct::get_unwind_recursion( - const irep_idt &id, + irep_idt id, unsigned thread_nr, unsigned unwind) { diff --git a/src/goto-checker/symex_bmc.h b/src/goto-checker/symex_bmc.h index 81d15eed13f..840de213f7b 100644 --- a/src/goto-checker/symex_bmc.h +++ b/src/goto-checker/symex_bmc.h @@ -51,7 +51,7 @@ class symex_bmct : public goto_symext /// information for the user (e.g. "unwinding iteration N, max M"), /// and is not enforced. They return true to halt unwinding, false to /// authorise unwinding, or Unknown to indicate they have no opinion. - typedef std::function + typedef std::function recursion_unwind_handlert; /// Add a callback function that will be called to determine whether to unwind @@ -105,7 +105,7 @@ class symex_bmct : public goto_symext unsigned unwind) override; bool get_unwind_recursion( - const irep_idt &identifier, + irep_idt identifier, unsigned thread_nr, unsigned unwind) override; diff --git a/src/goto-checker/symex_bmc_incremental_one_loop.cpp b/src/goto-checker/symex_bmc_incremental_one_loop.cpp index 0492797d6a6..9bef57049e1 100644 --- a/src/goto-checker/symex_bmc_incremental_one_loop.cpp +++ b/src/goto-checker/symex_bmc_incremental_one_loop.cpp @@ -112,7 +112,7 @@ bool symex_bmc_incremental_one_loopt::should_stop_unwind( /// \return True if the back edge encountered during symbolic execution /// corresponds to the given loop (incr_loop_id) bool symex_bmc_incremental_one_loopt::check_break( - const irep_idt &loop_id, + irep_idt loop_id, unsigned unwind) { if(unwind < incr_min_unwind) diff --git a/src/goto-checker/symex_bmc_incremental_one_loop.h b/src/goto-checker/symex_bmc_incremental_one_loop.h index b5081081617..8b9cb4d8844 100644 --- a/src/goto-checker/symex_bmc_incremental_one_loop.h +++ b/src/goto-checker/symex_bmc_incremental_one_loop.h @@ -41,7 +41,7 @@ class symex_bmc_incremental_one_loopt : public symex_bmct std::unique_ptr state; // returns true if the symbolic execution is to be interrupted for checking - bool check_break(const irep_idt &loop_id, unsigned unwind) override; + bool check_break(irep_idt loop_id, unsigned unwind) override; bool should_stop_unwind( const symex_targett::sourcet &source, diff --git a/src/goto-checker/symex_coverage.cpp b/src/goto-checker/symex_coverage.cpp index 6e4edbe81d3..83f06b2e8ec 100644 --- a/src/goto-checker/symex_coverage.cpp +++ b/src/goto-checker/symex_coverage.cpp @@ -52,7 +52,7 @@ class goto_program_coverage_recordt : public coverage_recordt public: goto_program_coverage_recordt( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const symex_coveraget::coveraget &coverage); @@ -131,7 +131,7 @@ rate_detailed(std::size_t covered, std::size_t total, bool per_cent = false) goto_program_coverage_recordt::goto_program_coverage_recordt( const namespacet &ns, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const symex_coveraget::coveraget &coverage) : coverage_recordt("method") diff --git a/src/goto-diff/change_impact.cpp b/src/goto-diff/change_impact.cpp index 1a0d7c1ffb2..82aac6b572a 100644 --- a/src/goto-diff/change_impact.cpp +++ b/src/goto-diff/change_impact.cpp @@ -245,10 +245,10 @@ class change_impactt goto_functions_change_impactt old_change_impact, new_change_impact; - void change_impact(const irep_idt &function_id); + void change_impact(irep_idt function_id); void change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const unified_difft::goto_program_difft &diff, @@ -256,25 +256,25 @@ class change_impactt goto_program_change_impactt &new_impact); void propogate_dep_back( - const irep_idt &function_id, + irep_idt function_id, const dependence_grapht::nodet &d_node, const dependence_grapht &dep_graph, goto_functions_change_impactt &change_impact, bool del); void propogate_dep_forward( - const irep_idt &function_id, + irep_idt function_id, const dependence_grapht::nodet &d_node, const dependence_grapht &dep_graph, goto_functions_change_impactt &change_impact, bool del); void output_change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_program_change_impactt &c_i, const goto_functionst &goto_functions, const namespacet &ns) const; void output_change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_program_change_impactt &o_c_i, const goto_functionst &o_goto_functions, const namespacet &o_ns, @@ -316,7 +316,7 @@ change_impactt::change_impactt( new_dep_graph(new_goto_functions, ns_new); } -void change_impactt::change_impact(const irep_idt &function_id) +void change_impactt::change_impact(irep_idt function_id) { unified_difft::goto_program_difft diff = unified_diff.get_diff(function_id); @@ -349,7 +349,7 @@ void change_impactt::change_impact(const irep_idt &function_id) } void change_impactt::change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const unified_difft::goto_program_difft &diff, @@ -421,7 +421,7 @@ void change_impactt::change_impact( } void change_impactt::propogate_dep_forward( - const irep_idt &function_id, + irep_idt function_id, const dependence_grapht::nodet &d_node, const dependence_grapht &dep_graph, goto_functions_change_impactt &change_impact, @@ -454,7 +454,7 @@ void change_impactt::propogate_dep_forward( } void change_impactt::propogate_dep_back( - const irep_idt &function_id, + irep_idt function_id, const dependence_grapht::nodet &d_node, const dependence_grapht &dep_graph, goto_functions_change_impactt &change_impact, @@ -568,7 +568,7 @@ void change_impactt::operator()() } void change_impactt::output_change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_program_change_impactt &c_i, const goto_functionst &goto_functions, const namespacet &ns) const @@ -613,7 +613,7 @@ void change_impactt::output_change_impact( } void change_impactt::output_change_impact( - const irep_idt &function_id, + irep_idt function_id, const goto_program_change_impactt &o_c_i, const goto_functionst &o_goto_functions, const namespacet &o_ns, diff --git a/src/goto-diff/goto_diff.h b/src/goto-diff/goto_diff.h index cce63bce7b8..4187ff74028 100644 --- a/src/goto-diff/goto_diff.h +++ b/src/goto-diff/goto_diff.h @@ -57,9 +57,8 @@ class goto_difft const std::string &group_name, const std::set &function_group, const goto_modelt &goto_model) const; - void output_function( - const irep_idt &function_name, - const goto_modelt &goto_model) const; + void + output_function(irep_idt function_name, const goto_modelt &goto_model) const; void convert_function_group_json( json_arrayt &result, @@ -67,7 +66,7 @@ class goto_difft const goto_modelt &goto_model) const; void convert_function_json( json_objectt &result, - const irep_idt &function_name, + irep_idt function_name, const goto_modelt &goto_model) const; }; diff --git a/src/goto-diff/goto_diff_base.cpp b/src/goto-diff/goto_diff_base.cpp index 66872711d00..3d960e6e8b7 100644 --- a/src/goto-diff/goto_diff_base.cpp +++ b/src/goto-diff/goto_diff_base.cpp @@ -81,7 +81,7 @@ void goto_difft::output_function_group( /// \param function_name: the function id /// \param goto_model: the goto model void goto_difft::output_function( - const irep_idt &function_name, + irep_idt function_name, const goto_modelt &goto_model) const { messaget msg(message_handler); @@ -135,7 +135,7 @@ void goto_difft::convert_function_group_json( /// \param goto_model: the goto model void goto_difft::convert_function_json( json_objectt &result, - const irep_idt &function_name, + irep_idt function_name, const goto_modelt &goto_model) const { namespacet ns(goto_model.symbol_table); diff --git a/src/goto-diff/unified_diff.cpp b/src/goto-diff/unified_diff.cpp index da1001f6a32..11f27aafbca 100644 --- a/src/goto-diff/unified_diff.cpp +++ b/src/goto-diff/unified_diff.cpp @@ -28,7 +28,7 @@ unified_difft::unified_difft( } unified_difft::goto_program_difft -unified_difft::get_diff(const irep_idt &function) const +unified_difft::get_diff(irep_idt function) const { differences_mapt::const_iterator entry = differences_map_.find(function); if(entry == differences_map_.end()) @@ -101,7 +101,7 @@ unified_difft::goto_program_difft unified_difft::get_diff( } void unified_difft::output_diff( - const irep_idt &identifier, + irep_idt identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const differencest &differences, @@ -303,7 +303,7 @@ unified_difft::differencest unified_difft::lcss( } void unified_difft::unified_diff( - const irep_idt &identifier, + irep_idt identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program) { diff --git a/src/goto-diff/unified_diff.h b/src/goto-diff/unified_diff.h index 7c78ca91e1f..bb5007f2d56 100644 --- a/src/goto-diff/unified_diff.h +++ b/src/goto-diff/unified_diff.h @@ -45,7 +45,7 @@ class unified_difft typedef std::list> goto_program_difft; - goto_program_difft get_diff(const irep_idt &function) const; + goto_program_difft get_diff(irep_idt function) const; private: const goto_functionst &old_goto_functions; @@ -57,7 +57,7 @@ class unified_difft typedef std::map differences_mapt; void unified_diff( - const irep_idt &identifier, + irep_idt identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program); @@ -71,7 +71,7 @@ class unified_difft const differencest &differences); void output_diff( - const irep_idt &identifier, + irep_idt identifier, const goto_programt &old_goto_program, const goto_programt &new_goto_program, const differencest &differences, diff --git a/src/goto-harness/function_call_harness_generator.cpp b/src/goto-harness/function_call_harness_generator.cpp index 93810d52787..29bd2dcf2ca 100644 --- a/src/goto-harness/function_call_harness_generator.cpp +++ b/src/goto-harness/function_call_harness_generator.cpp @@ -61,7 +61,7 @@ struct function_call_harness_generatort::implt std::set global_pointers; /// \see goto_harness_generatort::generate - void generate(goto_modelt &goto_model, const irep_idt &harness_function_name); + void generate(goto_modelt &goto_model, irep_idt harness_function_name); /// Iterate over the symbol table and generate initialisation code for /// globals into the function body. void generate_nondet_globals(code_blockt &function_body); @@ -218,14 +218,14 @@ void function_call_harness_generatort::handle_option( void function_call_harness_generatort::generate( goto_modelt &goto_model, - const irep_idt &harness_function_name) + irep_idt harness_function_name) { p_impl->generate(goto_model, harness_function_name); } void function_call_harness_generatort::implt::generate( goto_modelt &goto_model, - const irep_idt &harness_function_name) + irep_idt harness_function_name) { symbol_table = &goto_model.symbol_table; goto_functions = &goto_model.goto_functions; diff --git a/src/goto-harness/function_call_harness_generator.h b/src/goto-harness/function_call_harness_generator.h index 5a3a3eef336..fab10e125f4 100644 --- a/src/goto-harness/function_call_harness_generator.h +++ b/src/goto-harness/function_call_harness_generator.h @@ -25,8 +25,8 @@ class function_call_harness_generatort : public goto_harness_generatort explicit function_call_harness_generatort( ui_message_handlert &message_handler); ~function_call_harness_generatort() override; - void generate(goto_modelt &goto_model, const irep_idt &harness_function_name) - override; + void + generate(goto_modelt &goto_model, irep_idt harness_function_name) override; protected: void handle_option( diff --git a/src/goto-harness/goto_harness_generator.h b/src/goto-harness/goto_harness_generator.h index 95bbfc2252e..fd76da0546c 100644 --- a/src/goto-harness/goto_harness_generator.h +++ b/src/goto-harness/goto_harness_generator.h @@ -43,7 +43,7 @@ class goto_harness_generatort public: /// Generate a harness according to the set options virtual void - generate(goto_modelt &goto_model, const irep_idt &harness_function_name) = 0; + generate(goto_modelt &goto_model, irep_idt harness_function_name) = 0; virtual ~goto_harness_generatort() = default; friend class goto_harness_generator_factoryt; diff --git a/src/goto-harness/memory_snapshot_harness_generator.cpp b/src/goto-harness/memory_snapshot_harness_generator.cpp index c91da54f11d..45d6b07a387 100644 --- a/src/goto-harness/memory_snapshot_harness_generator.cpp +++ b/src/goto-harness/memory_snapshot_harness_generator.cpp @@ -228,7 +228,7 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals( { collect_references( snapshot_pair.second.value, - [&reference_relation, &snapshot_pair](const irep_idt &id) { + [&reference_relation, &snapshot_pair](irep_idt id) { reference_relation.insert(std::make_pair(snapshot_pair.first, id)); }); selected_snapshot_symbols.push_back(snapshot_pair); @@ -368,7 +368,7 @@ void memory_snapshot_harness_generatort::get_memory_snapshot( void memory_snapshot_harness_generatort::generate( goto_modelt &goto_model, - const irep_idt &harness_function_name) + irep_idt harness_function_name) { symbol_tablet snapshot; get_memory_snapshot(memory_snapshot_file, snapshot); diff --git a/src/goto-harness/memory_snapshot_harness_generator.h b/src/goto-harness/memory_snapshot_harness_generator.h index 4e2f94e868b..17bebdf1982 100644 --- a/src/goto-harness/memory_snapshot_harness_generator.h +++ b/src/goto-harness/memory_snapshot_harness_generator.h @@ -44,8 +44,8 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort /// 6. Insert harness function into \p goto_model. /// \param goto_model: goto model to be modified /// \param harness_function_name: name of the resulting harness function - void generate(goto_modelt &goto_model, const irep_idt &harness_function_name) - override; + void + generate(goto_modelt &goto_model, irep_idt harness_function_name) override; protected: /// User provided goto location: function name and (maybe) location number; @@ -143,7 +143,7 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort void match_up( const size_t &candidate_distance, - const irep_idt &candidate_function_name, + irep_idt candidate_function_name, const goto_programt::const_targett &candidate_instruction) { if(match_found && distance <= candidate_distance) diff --git a/src/goto-harness/recursive_initialization.cpp b/src/goto-harness/recursive_initialization.cpp index a2f566db749..5b52a3c7b22 100644 --- a/src/goto-harness/recursive_initialization.cpp +++ b/src/goto-harness/recursive_initialization.cpp @@ -373,14 +373,14 @@ irep_idt recursive_initializationt::build_constructor(const exprt &expr) } bool recursive_initializationt::should_be_treated_as_array( - const irep_idt &array_name) const + irep_idt array_name) const { return initialization_config.pointers_to_treat_as_arrays.find(array_name) != initialization_config.pointers_to_treat_as_arrays.end(); } std::optional -recursive_initializationt::find_equal_cluster(const irep_idt &name) const +recursive_initializationt::find_equal_cluster(irep_idt name) const { for(equal_cluster_idt index = 0; index != initialization_config.pointers_to_treat_equal.size(); @@ -393,7 +393,7 @@ recursive_initializationt::find_equal_cluster(const irep_idt &name) const } bool recursive_initializationt::is_array_size_parameter( - const irep_idt &cmdline_arg) const + irep_idt cmdline_arg) const { return initialization_config.variables_that_hold_array_sizes.find( cmdline_arg) != @@ -401,7 +401,7 @@ bool recursive_initializationt::is_array_size_parameter( } std::optional recursive_initializationt::get_associated_size_variable( - const irep_idt &array_name) const + irep_idt array_name) const { return optional_lookup( initialization_config.array_name_to_associated_array_size_variable, @@ -409,7 +409,7 @@ std::optional recursive_initializationt::get_associated_size_variable( } bool recursive_initializationt::should_be_treated_as_cstring( - const irep_idt &pointer_name) const + irep_idt pointer_name) const { return initialization_config.pointers_to_treat_as_cstrings.count( pointer_name) != 0; @@ -578,7 +578,7 @@ symbolt &recursive_initializationt::get_fresh_param_symbol( } symbol_exprt -recursive_initializationt::get_symbol_expr(const irep_idt &symbol_name) const +recursive_initializationt::get_symbol_expr(irep_idt symbol_name) const { auto maybe_symbol = goto_model.symbol_table.lookup(symbol_name); CHECK_RETURN(maybe_symbol != nullptr); diff --git a/src/goto-harness/recursive_initialization.h b/src/goto-harness/recursive_initialization.h index 2b13ce9981b..bf2fed2ca3e 100644 --- a/src/goto-harness/recursive_initialization.h +++ b/src/goto-harness/recursive_initialization.h @@ -120,13 +120,12 @@ class recursive_initializationt type_constructor_namest type_constructor_names; std::vector> common_arguments_origins; - bool should_be_treated_as_array(const irep_idt &pointer_name) const; - std::optional - find_equal_cluster(const irep_idt &name) const; - bool is_array_size_parameter(const irep_idt &cmdline_arg) const; + bool should_be_treated_as_array(irep_idt pointer_name) const; + std::optional find_equal_cluster(irep_idt name) const; + bool is_array_size_parameter(irep_idt cmdline_arg) const; std::optional - get_associated_size_variable(const irep_idt &array_name) const; - bool should_be_treated_as_cstring(const irep_idt &pointer_name) const; + get_associated_size_variable(irep_idt array_name) const; + bool should_be_treated_as_cstring(irep_idt pointer_name) const; /// Construct a new global symbol of type `int` and set it's value to \p /// initial_value. @@ -174,7 +173,7 @@ class recursive_initializationt /// Recover the symbol expression from symbol table. /// \param symbol_name: the name of the symbol to get /// \return symbol expression of the symbol with given name - symbol_exprt get_symbol_expr(const irep_idt &symbol_name) const; + symbol_exprt get_symbol_expr(irep_idt symbol_name) const; /// Simple pretty-printer for \ref typet. Produces strings that can decorate /// variable names in C. diff --git a/src/goto-instrument/accelerate/scratch_program.cpp b/src/goto-instrument/accelerate/scratch_program.cpp index daae044e9cd..ffa36875c9e 100644 --- a/src/goto-instrument/accelerate/scratch_program.cpp +++ b/src/goto-instrument/accelerate/scratch_program.cpp @@ -36,9 +36,9 @@ bool scratch_programt::check_sat(bool do_slice, guard_managert &guard_manager) goto_functiont this_goto_function; this_goto_function.body.copy_from(*this); - auto get_goto_function = - [this, &this_goto_function]( - const irep_idt &key) -> const goto_functionst::goto_functiont & { + auto get_goto_function = [this, &this_goto_function](irep_idt key) + -> const goto_functionst::goto_functiont & + { if(key == goto_functionst::entry_point()) return this_goto_function; else diff --git a/src/goto-instrument/aggressive_slicer.cpp b/src/goto-instrument/aggressive_slicer.cpp index 46f092774b4..917c066f164 100644 --- a/src/goto-instrument/aggressive_slicer.cpp +++ b/src/goto-instrument/aggressive_slicer.cpp @@ -22,8 +22,7 @@ Author: Elizabeth Polgreen, elizabeth.polgreen@cs.ox.ac.uk #include "remove_function.h" -void aggressive_slicert::note_functions_to_keep( - const irep_idt &destination_function) +void aggressive_slicert::note_functions_to_keep(irep_idt destination_function) { if(preserve_all_direct_paths) { diff --git a/src/goto-instrument/aggressive_slicer.h b/src/goto-instrument/aggressive_slicer.h index b5ebf25217d..948a1a24d19 100644 --- a/src/goto-instrument/aggressive_slicer.h +++ b/src/goto-instrument/aggressive_slicer.h @@ -85,7 +85,7 @@ class aggressive_slicert /// slicer, i.e., shortest path between two functions, or all direct paths. /// Inserts functions to preserve into the functions_to_keep set /// \param destination_function: name of destination function for slice - void note_functions_to_keep(const irep_idt &destination_function); + void note_functions_to_keep(irep_idt destination_function); /// \brief Finds all functions that contain a property, /// and adds them to the list of functions to keep. This diff --git a/src/goto-instrument/branch.cpp b/src/goto-instrument/branch.cpp index 50198aa74c1..afe75963275 100644 --- a/src/goto-instrument/branch.cpp +++ b/src/goto-instrument/branch.cpp @@ -18,9 +18,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "function.h" -void branch( - goto_modelt &goto_model, - const irep_idt &id) +void branch(goto_modelt &goto_model, irep_idt id) { for(auto &gf_entry : goto_model.goto_functions.function_map) { diff --git a/src/goto-instrument/branch.h b/src/goto-instrument/branch.h index dd6f1d2d85d..2125631ab09 100644 --- a/src/goto-instrument/branch.h +++ b/src/goto-instrument/branch.h @@ -16,8 +16,6 @@ Author: Daniel Kroening, kroening@kroening.com class goto_modelt; -void branch( - goto_modelt &, - const irep_idt &id); +void branch(goto_modelt &, irep_idt id); #endif // CPROVER_GOTO_INSTRUMENT_BRANCH_H diff --git a/src/goto-instrument/call_sequences.cpp b/src/goto-instrument/call_sequences.cpp index 765ac523b5c..fada57fc686 100644 --- a/src/goto-instrument/call_sequences.cpp +++ b/src/goto-instrument/call_sequences.cpp @@ -24,9 +24,7 @@ Date: April 2013 #include -void show_call_sequences( - const irep_idt &caller, - const goto_programt &goto_program) +void show_call_sequences(irep_idt caller, const goto_programt &goto_program) { // show calls in blocks within caller body // dfs on code blocks using stack diff --git a/src/goto-instrument/contracts/cfg_info.h b/src/goto-instrument/contracts/cfg_info.h index 3fd7db72ca7..1e8d166224a 100644 --- a/src/goto-instrument/contracts/cfg_info.h +++ b/src/goto-instrument/contracts/cfg_info.h @@ -40,11 +40,11 @@ class cfg_infot { public: /// Returns true iff `ident` is locally declared. - virtual bool is_local(const irep_idt &ident) const = 0; + virtual bool is_local(irep_idt ident) const = 0; /// Returns true iff the given `ident` is either non-locally declared /// or is locally-declared but dirty. - virtual bool is_not_local_or_dirty_local(const irep_idt &ident) const = 0; + virtual bool is_not_local_or_dirty_local(irep_idt ident) const = 0; /// Returns true iff `expr` is an access to a locally declared symbol /// and does not contain `dereference` or `address_of` operations. @@ -119,7 +119,7 @@ class function_cfg_infot : public cfg_infot } /// Returns true iff `ident` is a local or parameter of the goto_function. - bool is_local(const irep_idt &ident) const override + bool is_local(irep_idt ident) const override { return locals.is_local(ident) || (parameters.find(ident) != parameters.end()); @@ -127,7 +127,7 @@ class function_cfg_infot : public cfg_infot /// Returns true iff the given `ident` is either not a goto_function local /// or is a local that is dirty. - bool is_not_local_or_dirty_local(const irep_idt &ident) const override + bool is_not_local_or_dirty_local(irep_idt ident) const override { return is_local(ident) ? is_dirty(ident) : true; } @@ -153,14 +153,14 @@ class loop_cfg_infot : public cfg_infot } /// Returns true iff `ident` is a loop local. - bool is_local(const irep_idt &ident) const override + bool is_local(irep_idt ident) const override { return locals.find(ident) != locals.end(); } /// Returns true iff the given `ident` is either not a loop local /// or is a loop local that is dirty. - bool is_not_local_or_dirty_local(const irep_idt &ident) const override + bool is_not_local_or_dirty_local(irep_idt ident) const override { if(is_local(ident)) return is_dirty(ident); @@ -176,9 +176,10 @@ class loop_cfg_infot : public cfg_infot const std::unordered_set symbols = find_symbol_identifiers(*it); if( - std::find_if(symbols.begin(), symbols.end(), [this](const irep_idt &s) { - return is_local(s); - }) != symbols.end()) + std::find_if( + symbols.begin(), + symbols.end(), + [this](irep_idt s) { return is_local(s); }) != symbols.end()) { it = exprs.erase(it); } @@ -214,14 +215,14 @@ class goto_program_cfg_infot : public cfg_infot } /// Returns true iff `ident` is a loop local. - bool is_local(const irep_idt &ident) const override + bool is_local(irep_idt ident) const override { return locals.find(ident) != locals.end(); } /// Returns true iff the given `ident` is either not a loop local /// or is a loop local that is dirty. - bool is_not_local_or_dirty_local(const irep_idt &ident) const override + bool is_not_local_or_dirty_local(irep_idt ident) const override { if(is_local(ident)) return dirty.find(ident) != dirty.end(); diff --git a/src/goto-instrument/contracts/contracts.cpp b/src/goto-instrument/contracts/contracts.cpp index 5d192c6cd78..3f126174e8f 100644 --- a/src/goto-instrument/contracts/contracts.cpp +++ b/src/goto-instrument/contracts/contracts.cpp @@ -38,7 +38,7 @@ Date: February 2016 #include void code_contractst::check_apply_loop_contracts( - const irep_idt &function_name, + irep_idt function_name, goto_functionst::goto_functiont &goto_function, const local_may_aliast &local_may_alias, goto_programt::targett loop_head, @@ -47,7 +47,7 @@ void code_contractst::check_apply_loop_contracts( exprt assigns_clause, exprt invariant, exprt decreases_clause, - const irep_idt &mode) + irep_idt mode) { const auto loop_head_location = loop_head->source_location(); const auto loop_number = loop_end->loop_number; @@ -553,7 +553,7 @@ static void generate_contract_constraints( symbol_tablet &symbol_table, goto_convertt &converter, exprt &instantiated_clause, - const irep_idt &mode, + irep_idt mode, const std::function &is_fresh_update, goto_programt &program, const source_locationt &location) @@ -577,7 +577,7 @@ static void generate_contract_constraints( } static const code_with_contract_typet & -get_contract(const irep_idt &function, const namespacet &ns) +get_contract(irep_idt function, const namespacet &ns) { const std::string &function_str = id2string(function); const auto &function_symbol = ns.lookup(function); @@ -598,7 +598,7 @@ get_contract(const irep_idt &function, const namespacet &ns) } void code_contractst::apply_function_contract( - const irep_idt &function, + irep_idt function, const source_locationt &location, goto_programt &function_body, goto_programt::targett &target) @@ -629,7 +629,7 @@ void code_contractst::apply_function_contract( } // Isolate each component of the contract. - const auto &type = get_contract(target_function, ns); + const auto type = get_contract(target_function, ns); // Prepare to instantiate expressions in the callee // with expressions from the call site (e.g. the return value). @@ -839,7 +839,7 @@ void code_contractst::apply_function_contract( } void code_contractst::apply_loop_contract( - const irep_idt &function_name, + irep_idt function_name, goto_functionst::goto_functiont &goto_function) { const bool may_have_loops = std::any_of( @@ -1121,7 +1121,7 @@ void code_contractst::apply_loop_contract( } } -void code_contractst::check_frame_conditions_function(const irep_idt &function) +void code_contractst::check_frame_conditions_function(irep_idt function) { // Get the function object before instrumentation. auto function_obj = goto_functions.function_map.find(function); @@ -1186,7 +1186,8 @@ void code_contractst::check_frame_conditions_function(const irep_idt &function) instantiation_values.push_back( ns.lookup(param.get_identifier()).symbol_expr()); } - for(auto &target : get_contract(function, ns).c_assigns()) + const auto contract_type = get_contract(function, ns); + for(auto &target : contract_type.c_assigns()) { goto_programt payload; instrument_spec_assigns.track_spec_target( @@ -1212,7 +1213,7 @@ void code_contractst::check_frame_conditions_function(const irep_idt &function) function_body, instruction_it, function_body.instructions.end()); } -void code_contractst::enforce_contract(const irep_idt &function) +void code_contractst::enforce_contract(irep_idt function) { // Add statements to the source function // to ensure assigns clause is respected. @@ -1269,8 +1270,8 @@ void code_contractst::enforce_contract(const irep_idt &function) } void code_contractst::add_contract_check( - const irep_idt &wrapper_function, - const irep_idt &mangled_function, + irep_idt wrapper_function, + irep_idt mangled_function, goto_programt &dest) { PRECONDITION(!dest.instructions.empty()); @@ -1283,7 +1284,7 @@ void code_contractst::add_contract_check( // ret=function(parameter1, ...) // assert(ensures) - const auto &code_type = get_contract(wrapper_function, ns); + const auto code_type = get_contract(wrapper_function, ns); goto_programt check; // prepare function call including all declarations diff --git a/src/goto-instrument/contracts/contracts.h b/src/goto-instrument/contracts/contracts.h index 20cf3f049c3..4930c8ec035 100644 --- a/src/goto-instrument/contracts/contracts.h +++ b/src/goto-instrument/contracts/contracts.h @@ -124,7 +124,7 @@ class code_contractst const std::set &to_exclude_from_nondet_init = {}); void check_apply_loop_contracts( - const irep_idt &function_name, + irep_idt function_name, goto_functionst::goto_functiont &goto_function, const local_may_aliast &local_may_alias, goto_programt::targett loop_head, @@ -133,7 +133,7 @@ class code_contractst exprt assigns_clause, exprt invariant, exprt decreases_clause, - const irep_idt &mode); + irep_idt mode); std::unordered_map get_original_loop_number_map() const @@ -177,22 +177,22 @@ class code_contractst public: /// \brief Enforce contract of a single function - void enforce_contract(const irep_idt &function); + void enforce_contract(irep_idt function); /// Instrument functions to check frame conditions. - void check_frame_conditions_function(const irep_idt &function); + void check_frame_conditions_function(irep_idt function); /// Apply loop contracts, whenever available, to all loops in `function`. /// Loop invariants, loop variants, and loop assigns clauses. void apply_loop_contract( - const irep_idt &function, + irep_idt function, goto_functionst::goto_functiont &goto_function); /// Replaces function calls with assertions based on requires clauses, /// non-deterministic assignments for the write set, and assumptions /// based on ensures clauses. void apply_function_contract( - const irep_idt &function, + irep_idt function, const source_locationt &location, goto_programt &function_body, goto_programt::targett &target); @@ -200,8 +200,8 @@ class code_contractst /// Instruments `wrapper_function` adding assumptions based on requires /// clauses and assertions based on ensures clauses. void add_contract_check( - const irep_idt &wrapper_function, - const irep_idt &mangled_function, + irep_idt wrapper_function, + irep_idt mangled_function, goto_programt &dest); }; diff --git a/src/goto-instrument/contracts/contracts_wrangler.cpp b/src/goto-instrument/contracts/contracts_wrangler.cpp index e66d6f52421..72612f242b3 100644 --- a/src/goto-instrument/contracts/contracts_wrangler.cpp +++ b/src/goto-instrument/contracts/contracts_wrangler.cpp @@ -99,7 +99,7 @@ void contracts_wranglert::add_builtin_pointer_function_symbol( void contracts_wranglert::mangle( const loop_contracts_clauset &loop_contracts, - const irep_idt &function_id) + irep_idt function_id) { messaget log(message_handler); // Loop contracts mangling consists of four steps. diff --git a/src/goto-instrument/contracts/contracts_wrangler.h b/src/goto-instrument/contracts/contracts_wrangler.h index 819754ea2e3..5ff6514466e 100644 --- a/src/goto-instrument/contracts/contracts_wrangler.h +++ b/src/goto-instrument/contracts/contracts_wrangler.h @@ -81,9 +81,8 @@ class contracts_wranglert /// @brief Mangle `loop_contracts` in the function with `function_id` /// @param loop_contracts The contracts mangled in the function. /// @param function_id The function containing the loop we mangle to. - void mangle( - const loop_contracts_clauset &loop_contracts, - const irep_idt &function_id); + void + mangle(const loop_contracts_clauset &loop_contracts, irep_idt function_id); /// @brief Add builtin function symbol with `function_name` into symbol table. /// @param function_name Name of the function to add. diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc.cpp index 1403b04f403..bdd6e11df38 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc.cpp @@ -51,7 +51,7 @@ std::string invalid_function_contract_pair_exceptiont::what() const } static std::pair -parse_function_contract_pair(const irep_idt &cli_flag) +parse_function_contract_pair(irep_idt cli_flag) { auto const correct_format_message = "the format for function and contract pairs is " @@ -93,7 +93,7 @@ parse_function_contract_pair(const irep_idt &cli_flag) void dfcc( const optionst &options, goto_modelt &goto_model, - const irep_idt &harness_id, + irep_idt harness_id, const std::optional &to_check, const bool allow_recursive_calls, const std::set &to_replace, @@ -121,7 +121,7 @@ void dfcc( dfcct::dfcct( const optionst &options, goto_modelt &goto_model, - const irep_idt &harness_id, + irep_idt harness_id, const std::optional> &to_check, const bool allow_recursive_calls, const std::map &to_replace, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc.h b/src/goto-instrument/contracts/dynamic-frames/dfcc.h index b385f9e0233..e83fb26ad1d 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc.h @@ -102,7 +102,7 @@ class invalid_function_contract_pair_exceptiont : public cprover_exception_baset void dfcc( const optionst &options, goto_modelt &goto_model, - const irep_idt &harness_id, + irep_idt harness_id, const std::optional &to_check, const bool allow_recursive_calls, const std::set &to_replace, @@ -129,7 +129,7 @@ class dfcct dfcct( const optionst &options, goto_modelt &goto_model, - const irep_idt &harness_id, + irep_idt harness_id, const std::optional> &to_check, const bool allow_recursive_calls, const std::map &to_replace, @@ -166,7 +166,7 @@ class dfcct protected: const optionst &options; goto_modelt &goto_model; - const irep_idt &harness_id; + irep_idt harness_id; const std::optional> &to_check; const bool allow_recursive_calls; const std::map &to_replace; diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.cpp index af61dac31ed..be1ef609d2b 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.cpp @@ -224,7 +224,7 @@ static void tag_loop_instructions( } } -static bool is_assigned(dirtyt &dirty, const irep_idt &ident, assignst assigns) +static bool is_assigned(dirtyt &dirty, irep_idt ident, assignst assigns) { PRECONDITION(!dirty(ident)); // For each assigns clause target @@ -307,7 +307,7 @@ struct contract_clausest static struct contract_clausest default_loop_contract_clauses( const dfcc_loop_nesting_grapht &loop_nesting_graph, const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, const assignst &inferred_assigns, const bool check_side_effect, message_handlert &message_handler, @@ -392,7 +392,7 @@ static struct contract_clausest default_loop_contract_clauses( static dfcc_loop_infot gen_dfcc_loop_info( const dfcc_loop_nesting_grapht &loop_nesting_graph, const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const std::map &loop_info_map, dirtyt &dirty, @@ -484,7 +484,7 @@ static dfcc_loop_infot gen_dfcc_loop_info( dfcc_cfg_infot::dfcc_cfg_infot( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const exprt &top_level_write_set, const loop_contract_configt &loop_contract_config, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.h index 59583869780..f4d0cbf133c 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_cfg_info.h @@ -244,7 +244,7 @@ class dfcc_cfg_infot public: dfcc_cfg_infot( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const exprt &top_level_write_set, const loop_contract_configt &loop_contract_config, @@ -315,7 +315,7 @@ class dfcc_cfg_infot } private: - const irep_idt &function_id; + irep_idt function_id; goto_functiont &goto_function; const exprt &top_level_write_set; const namespacet ns; diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.cpp index 6c1d6d23fd0..348abdb8118 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.cpp @@ -41,7 +41,7 @@ dfcc_contract_clauses_codegent::dfcc_contract_clauses_codegent( } void dfcc_contract_clauses_codegent::gen_spec_assigns_instructions( - const irep_idt &language_mode, + irep_idt language_mode, const exprt::operandst &assigns_clause, goto_programt &dest) { @@ -69,7 +69,7 @@ void dfcc_contract_clauses_codegent::gen_spec_assigns_instructions( } void dfcc_contract_clauses_codegent::gen_spec_frees_instructions( - const irep_idt &language_mode, + irep_idt language_mode, const exprt::operandst &frees_clause, goto_programt &dest) { @@ -96,7 +96,7 @@ void dfcc_contract_clauses_codegent::gen_spec_frees_instructions( } void dfcc_contract_clauses_codegent::encode_assignable_target_group( - const irep_idt &language_mode, + irep_idt language_mode, const conditional_target_group_exprt &group, goto_programt &dest) { @@ -123,7 +123,7 @@ void dfcc_contract_clauses_codegent::encode_assignable_target_group( } void dfcc_contract_clauses_codegent::encode_assignable_target( - const irep_idt &language_mode, + irep_idt language_mode, const exprt &target, goto_programt &dest) { @@ -185,7 +185,7 @@ void dfcc_contract_clauses_codegent::encode_assignable_target( } void dfcc_contract_clauses_codegent::encode_freeable_target_group( - const irep_idt &language_mode, + irep_idt language_mode, const conditional_target_group_exprt &group, goto_programt &dest) { @@ -212,7 +212,7 @@ void dfcc_contract_clauses_codegent::encode_freeable_target_group( } void dfcc_contract_clauses_codegent::encode_freeable_target( - const irep_idt &language_mode, + irep_idt language_mode, const exprt &target, goto_programt &dest) { diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.h index e3db30d054c..761a2bc4e11 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_clauses_codegen.h @@ -47,7 +47,7 @@ class dfcc_contract_clauses_codegent /// \param assigns_clause Sequence of targets to encode /// \param dest Destination program void gen_spec_assigns_instructions( - const irep_idt &language_mode, + irep_idt language_mode, const exprt::operandst &assigns_clause, goto_programt &dest); @@ -62,7 +62,7 @@ class dfcc_contract_clauses_codegent /// \param frees_clause Sequence of targets to encode /// \param dest Destination program void gen_spec_frees_instructions( - const irep_idt &language_mode, + irep_idt language_mode, const exprt::operandst &frees_clause, goto_programt &dest); @@ -76,28 +76,28 @@ class dfcc_contract_clauses_codegent /// Generates GOTO instructions to build the representation of the given /// conditional target group. void encode_assignable_target_group( - const irep_idt &language_mode, + irep_idt language_mode, const conditional_target_group_exprt &group, goto_programt &dest); /// Generates GOTO instructions to build the representation of the given /// assignable target. void encode_assignable_target( - const irep_idt &language_mode, + irep_idt language_mode, const exprt &target, goto_programt &dest); /// Generates GOTO instructions to build the representation of the given /// conditional target group. void encode_freeable_target_group( - const irep_idt &language_mode, + irep_idt language_mode, const conditional_target_group_exprt &group, goto_programt &dest); /// Generates GOTO instructions to build the representation of the given /// freeable target. void encode_freeable_target( - const irep_idt &language_mode, + irep_idt language_mode, const exprt &target, goto_programt &dest); diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.cpp index d57da7795a1..eb646bab56c 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.cpp @@ -65,7 +65,7 @@ dfcc_contract_functionst::dfcc_contract_functionst( void dfcc_contract_functionst:: instrument_without_loop_contracts_check_no_pointer_contracts( - const irep_idt &spec_function_id) + irep_idt spec_function_id) { std::set function_pointer_contracts; instrument.instrument_function( diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.h index f3702ddfc6d..0b01f688807 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_functions.h @@ -74,7 +74,7 @@ class dfcc_contract_functionst /// Instruments the given function without loop contracts and checks that no /// function pointer contracts were discovered. void instrument_without_loop_contracts_check_no_pointer_contracts( - const irep_idt &spec_function_id); + irep_idt spec_function_id); /// Returns the contract::c_assigns function symbol const symbolt &get_spec_assigns_function_symbol() const; @@ -107,7 +107,7 @@ class dfcc_contract_functionst const irep_idt spec_frees_function_id; /// Language mode of the contract symbol - const irep_idt &language_mode; + irep_idt language_mode; protected: goto_modelt &goto_model; diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.cpp index d01a927f8a3..c407bfd9851 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.cpp @@ -43,7 +43,7 @@ dfcc_contract_handlert::dfcc_contract_handlert( } const dfcc_contract_functionst & -dfcc_contract_handlert::get_contract_functions(const irep_idt &contract_id) +dfcc_contract_handlert::get_contract_functions(irep_idt contract_id) { auto iter = dfcc_contract_handlert::contract_cache.find(contract_id); @@ -67,16 +67,16 @@ dfcc_contract_handlert::get_contract_functions(const irep_idt &contract_id) } const std::size_t -dfcc_contract_handlert::get_assigns_clause_size(const irep_idt &contract_id) +dfcc_contract_handlert::get_assigns_clause_size(irep_idt contract_id) { return get_contract_functions(contract_id).get_nof_assigns_targets(); } void dfcc_contract_handlert::add_contract_instructions( const dfcc_contract_modet contract_mode, - const irep_idt &wrapper_id, - const irep_idt &wrapped_id, - const irep_idt &contract_id, + irep_idt wrapper_id, + irep_idt wrapped_id, + irep_idt contract_id, const symbolt &wrapper_write_set_symbol, goto_programt &dest, std::set &function_pointer_contracts) @@ -96,7 +96,7 @@ void dfcc_contract_handlert::add_contract_instructions( } const symbolt &dfcc_contract_handlert::get_pure_contract_symbol( - const irep_idt &contract_id, + irep_idt contract_id, const std::optional function_id_opt) { auto pure_contract_id = "contract::" + id2string(contract_id); @@ -106,7 +106,7 @@ const symbolt &dfcc_contract_handlert::get_pure_contract_symbol( if(function_id_opt.has_value()) { auto function_id = function_id_opt.value(); - const auto &function_symbol = + const symbolt function_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, function_id); check_signature_compat( function_id, @@ -141,9 +141,9 @@ const symbolt &dfcc_contract_handlert::get_pure_contract_symbol( } void dfcc_contract_handlert::check_signature_compat( - const irep_idt &contract_id, + irep_idt contract_id, const code_typet &contract_type, - const irep_idt &pure_contract_id, + irep_idt pure_contract_id, const code_typet &pure_contract_type) { // can we turn a call to `contract` into a call to `pure_contract` ? diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.h index 46b9e04b468..6b4d3d0662d 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_contract_handler.h @@ -84,15 +84,15 @@ class dfcc_contract_handlert /// be swapped_and_wrapped in replacement mode if they are not already. void add_contract_instructions( const dfcc_contract_modet contract_mode, - const irep_idt &wrapper_id, - const irep_idt &wrapped_id, - const irep_idt &contract_id, + irep_idt wrapper_id, + irep_idt wrapped_id, + irep_idt contract_id, const symbolt &wrapper_write_set_symbol, goto_programt &dest, std::set &function_pointer_contracts); /// Returns the size assigns clause of the given contract in number of targets - const std::size_t get_assigns_clause_size(const irep_idt &contract_id); + const std::size_t get_assigns_clause_size(irep_idt contract_id); /// Searches for a symbol named "contract::contract_id" in the symbol table. /// If the "contract::contract_id" is found and \p function_id_opt is present, @@ -104,7 +104,7 @@ class dfcc_contract_handlert /// If the symbol was not found and \p function_id_opt was not provided, a /// PRECONDITION is triggered. const symbolt &get_pure_contract_symbol( - const irep_idt &contract_id, + irep_idt contract_id, const std::optional function_id_opt = {}); protected: @@ -123,8 +123,7 @@ class dfcc_contract_handlert /// Returns the `dfcc_contract_functionst` object for the given contract /// from the cache, creates it if it does not exists. - const dfcc_contract_functionst & - get_contract_functions(const irep_idt &contract_id); + const dfcc_contract_functionst &get_contract_functions(irep_idt contract_id); /// \brief Throws an error if the type signatures are not compatible /// \param contract_id name of the function that carries the contract @@ -132,9 +131,9 @@ class dfcc_contract_handlert /// \param pure_contract_id name of the pure contract symbol for contract_id /// \param pure_contract_type code_type of pure_contract_id void check_signature_compat( - const irep_idt &contract_id, + irep_idt contract_id, const code_typet &contract_type, - const irep_idt &pure_contract_id, + irep_idt pure_contract_id, const code_typet &pure_contract_type); }; diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp index caf87eb62fa..d650e246d07 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp @@ -53,7 +53,7 @@ depends_on(const exprt &expr, std::unordered_set identifiers) /// 2. there is no write or read of it outside the loop. /// 3. it is not used in loop contracts. std::unordered_set gen_loop_locals_set( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const dfcc_loop_nesting_graph_nodet &loop_node, message_handlert &message_handler, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h index 955213b8ef2..3891686bff3 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.h @@ -20,7 +20,7 @@ struct dfcc_loop_nesting_graph_nodet; /// Collect identifiers that are local to `loop`. std::unordered_set gen_loop_locals_set( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const dfcc_loop_nesting_graph_nodet &loop, message_handlert &message_handler, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.cpp index 1979cdc8a88..d2d6faf4cad 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.cpp @@ -225,19 +225,19 @@ std::size_t dfcc_instrumentt::get_max_assigns_clause_size() const */ /// True iff the symbol must not be instrumented -bool dfcc_instrumentt::is_internal_symbol(const irep_idt &id) const +bool dfcc_instrumentt::is_internal_symbol(irep_idt id) const { return internal_symbols.find(id) != internal_symbols.end(); } -bool dfcc_instrumentt::do_not_instrument(const irep_idt &id) const +bool dfcc_instrumentt::do_not_instrument(irep_idt id) const { return !has_prefix(id2string(id), CPROVER_PREFIX "file_local") && (dfcc_is_cprover_function_symbol(id) || is_internal_symbol(id)); } void dfcc_instrumentt::instrument_harness_function( - const irep_idt &function_id, + irep_idt function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts) { @@ -255,7 +255,7 @@ void dfcc_instrumentt::instrument_harness_function( to_pointer_type(library.dfcc_type[dfcc_typet::WRITE_SET_PTR])); // create a local write set symbol - const auto &function_symbol = + const symbolt function_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, function_id); const auto write_set = dfcc_utilst::create_symbol( goto_model.symbol_table, @@ -296,8 +296,7 @@ void dfcc_instrumentt::instrument_harness_function( goto_model.goto_functions.update(); } -std::set -dfcc_instrumentt::get_local_statics(const irep_idt &function_id) +std::set dfcc_instrumentt::get_local_statics(irep_idt function_id) { std::set local_statics; for(const auto &sym_pair : goto_model.symbol_table) @@ -316,7 +315,7 @@ dfcc_instrumentt::get_local_statics(const irep_idt &function_id) } void dfcc_instrumentt::instrument_function( - const irep_idt &function_id, + irep_idt function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts) { @@ -351,8 +350,8 @@ void dfcc_instrumentt::instrument_function( } void dfcc_instrumentt::instrument_wrapped_function( - const irep_idt &wrapped_function_id, - const irep_idt &initial_function_id, + irep_idt wrapped_function_id, + irep_idt initial_function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts) { @@ -389,7 +388,7 @@ void dfcc_instrumentt::instrument_wrapped_function( } void dfcc_instrumentt::instrument_goto_program( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const exprt &write_set, std::set &function_pointer_contracts) @@ -427,7 +426,7 @@ void dfcc_instrumentt::instrument_goto_program( } void dfcc_instrumentt::instrument_goto_function( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const exprt &write_set, const std::set &local_statics, @@ -519,7 +518,7 @@ void dfcc_instrumentt::instrument_goto_function( } void dfcc_instrumentt::instrument_instructions( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett first_instruction, const goto_programt::targett &last_instruction, @@ -587,7 +586,7 @@ void dfcc_instrumentt::instrument_instructions( } void dfcc_instrumentt::insert_add_decl_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, const symbol_exprt &symbol_expr, goto_programt::targett &target, @@ -617,7 +616,7 @@ void dfcc_instrumentt::insert_add_decl_call( /// insert_add_decl_call(...); /// ``` void dfcc_instrumentt::instrument_decl( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info) @@ -634,7 +633,7 @@ void dfcc_instrumentt::instrument_decl( } void dfcc_instrumentt::insert_record_dead_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, const symbol_exprt &symbol_expr, goto_programt::targett &target, @@ -665,7 +664,7 @@ void dfcc_instrumentt::insert_record_dead_call( /// DEAD x; /// ``` void dfcc_instrumentt::instrument_dead( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info) @@ -680,7 +679,7 @@ void dfcc_instrumentt::instrument_dead( } void dfcc_instrumentt::instrument_lhs( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, const exprt &lhs, goto_programt &goto_program, @@ -742,7 +741,7 @@ void dfcc_instrumentt::instrument_lhs( } void dfcc_instrumentt::instrument_assign( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info) @@ -868,7 +867,7 @@ void dfcc_instrumentt::instrument_call_instruction( } void dfcc_instrumentt::instrument_deallocate_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, goto_programt::targett &target, goto_programt &goto_program) @@ -937,7 +936,7 @@ void dfcc_instrumentt::instrument_deallocate_call( } void dfcc_instrumentt::instrument_function_call( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info) @@ -971,7 +970,7 @@ void dfcc_instrumentt::instrument_function_call( } void dfcc_instrumentt::instrument_other( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info) @@ -1169,7 +1168,7 @@ void dfcc_instrumentt::instrument_other( } void dfcc_instrumentt::apply_loop_contracts( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, dfcc_cfg_infot &cfg_info, const loop_contract_configt &loop_contract_config, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.h index 809542d1919..a218876ae9f 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument.h @@ -51,11 +51,11 @@ class dfcc_instrumentt dfcc_contract_clauses_codegent &contract_clauses_codegen); /// True iff the symbol an internal symbol - bool is_internal_symbol(const irep_idt &id) const; + bool is_internal_symbol(irep_idt id) const; /// True iff the symbol must not be instrumented because it is an internal /// symbol or a CPROVER symbol - bool do_not_instrument(const irep_idt &id) const; + bool do_not_instrument(irep_idt id) const; /// Instruments a GOTO function used as a proof harness. Proof harnesses /// are closed functions without parameters, so we declare a local write set @@ -80,7 +80,7 @@ class dfcc_instrumentt /// \param function_pointer_contracts Contract names discovered in calls to /// the `obeys_contract` predicate are added to this set. void instrument_harness_function( - const irep_idt &function_id, + irep_idt function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts); @@ -101,7 +101,7 @@ class dfcc_instrumentt /// \param function_pointer_contracts Contracts discovered in calls to /// the obeys_contract predicate are added to this set. void instrument_function( - const irep_idt &function_id, + irep_idt function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts); @@ -126,8 +126,8 @@ class dfcc_instrumentt /// \param function_pointer_contracts contracts discovered in calls to /// the obeys_contract predicate are added to this set. void instrument_wrapped_function( - const irep_idt &wrapped_function_id, - const irep_idt &initial_function_id, + irep_idt wrapped_function_id, + irep_idt initial_function_id, const loop_contract_configt &loop_contract_config, std::set &function_pointer_contracts); @@ -149,7 +149,7 @@ class dfcc_instrumentt /// \param write_set Write set variable to use for instrumentation. /// \param function_pointer_contracts Discovered function pointer contracts void instrument_goto_program( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const exprt &write_set, std::set &function_pointer_contracts); @@ -185,7 +185,7 @@ class dfcc_instrumentt /// have the static flag set to true and have a source location where the /// function field is equal to the given \p function_id . /// \param[in] function_id Function name used to collect the statics. - std::set get_local_statics(const irep_idt &function_id); + std::set get_local_statics(irep_idt function_id); /// \brief Generates a guarded call to record a locally allocated symbol /// and inserts it in the goto_program at the target, and moves the target @@ -201,7 +201,7 @@ class dfcc_instrumentt /// \param target The instruction pointer to insert at /// \param goto_program the goto_program being instrumented void insert_add_decl_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, const symbol_exprt &symbol_expr, goto_programt::targett &target, @@ -221,7 +221,7 @@ class dfcc_instrumentt /// \param target The instruction pointer to insert at /// \param goto_program the goto_program being instrumented void insert_record_dead_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, const symbol_exprt &symbol_expr, goto_programt::targett &target, @@ -231,7 +231,7 @@ class dfcc_instrumentt /// Adds the given local statics to the write set in pre and removes them /// post. void instrument_goto_function( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, const exprt &write_set, const std::set &local_statics, @@ -251,7 +251,7 @@ class dfcc_instrumentt /// \param function_pointer_contracts Contracts discovered in calls to /// the obeys_contract predicate are added to this set. void instrument_instructions( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett first_instruction, const goto_programt::targett &last_instruction, // excluding the last @@ -261,7 +261,7 @@ class dfcc_instrumentt /// Instruments a `DECL x` instruction. /// \pre \p target points to a `DECL` instruction void instrument_decl( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info); @@ -269,7 +269,7 @@ class dfcc_instrumentt /// Instruments a `DEAD x` instruction. /// \pre \p target points to a `DEAD` instruction void instrument_dead( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info); @@ -277,7 +277,7 @@ class dfcc_instrumentt /// \brief Instruments the LHS of an assignment instruction instruction by /// adding an inclusion check of \p lhs in \p write_set. void instrument_lhs( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, const exprt &lhs, goto_programt &goto_program, @@ -289,7 +289,7 @@ class dfcc_instrumentt /// added to the \p write_set. /// \pre \p target points to an `ASSIGN` instruction. void instrument_assign( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info); @@ -319,7 +319,7 @@ class dfcc_instrumentt /// to the __CPROVER_deallocate function. /// \pre \p target points to a `CALL __CPROVER_deallocate` instruction. void instrument_deallocate_call( - const irep_idt &function_id, + irep_idt function_id, const exprt &write_set, goto_programt::targett &target, goto_programt &goto_program); @@ -329,7 +329,7 @@ class dfcc_instrumentt /// and passing `write_set` as an extra argument to the function call. /// \pre \p target points to a `CALL` instruction. void instrument_function_call( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info); @@ -339,7 +339,7 @@ class dfcc_instrumentt /// a havoc_object instruction. /// \pre \p target points to an `OTHER` instruction. void instrument_other( - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett &target, goto_programt &goto_program, dfcc_cfg_infot &cfg_info); @@ -350,7 +350,7 @@ class dfcc_instrumentt /// \pre Instructions of the function must already have been instrumented for /// DFCC using the same cfg_info. void apply_loop_contracts( - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, dfcc_cfg_infot &cfg_info, const loop_contract_configt &loop_contract_config, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.cpp index 314890a5ca0..9bf92ab760b 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.cpp @@ -43,7 +43,7 @@ dfcc_instrument_loopt::dfcc_instrument_loopt( void dfcc_instrument_loopt::operator()( const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, dfcc_cfg_infot &cfg_info, const std::set &local_statics, @@ -207,7 +207,7 @@ void dfcc_instrument_loopt::operator()( std::unordered_map dfcc_instrument_loopt::add_prehead_instructions( const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -220,7 +220,7 @@ dfcc_instrument_loopt::add_prehead_instructions( const symbol_exprt &entered_loop, const symbol_exprt &initial_invariant, const symbol_exprt &in_base_case, - const irep_idt &language_mode) + irep_idt language_mode) { auto loop_head_location(loop_head->source_location()); dfcc_remove_loop_tags(loop_head_location); @@ -324,7 +324,7 @@ goto_programt::instructiont::targett dfcc_instrument_loopt::add_step_instructions( const std::size_t loop_id, const std::size_t cbmc_loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -473,7 +473,7 @@ dfcc_instrument_loopt::add_step_instructions( void dfcc_instrument_loopt::add_body_instructions( const std::size_t loop_id, const std::size_t cbmc_loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -485,7 +485,7 @@ void dfcc_instrument_loopt::add_body_instructions( const std::vector &old_decreases_vars, const std::vector &new_decreases_vars, const goto_programt::instructiont::targett &step_case_target, - const irep_idt &language_mode) + irep_idt language_mode) { auto loop_head_location(loop_head->source_location()); dfcc_remove_loop_tags(loop_head_location); diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.h index 0db2bb5889c..750b4c68271 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_instrument_loop.h @@ -131,7 +131,7 @@ class dfcc_instrument_loopt /// void operator()( const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functiont &goto_function, dfcc_cfg_infot &cfg_info, const std::set &local_statics, @@ -196,7 +196,7 @@ class dfcc_instrument_loopt /// \return `history_var_map` that maps variables to loop_entry variables. std::unordered_map add_prehead_instructions( const std::size_t loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -209,7 +209,7 @@ class dfcc_instrument_loopt const symbol_exprt &entered_loop, const symbol_exprt &initial_invariant, const symbol_exprt &in_base_case, - const irep_idt &symbol_mode); + irep_idt symbol_mode); /// \brief Adds instructions of the step block, and returns the STEP /// jump target so that it can be used to jump back from the loop body block. @@ -246,7 +246,7 @@ class dfcc_instrument_loopt goto_programt::instructiont::targett add_step_instructions( const std::size_t loop_id, const std::size_t cbmc_loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -295,7 +295,7 @@ class dfcc_instrument_loopt void add_body_instructions( const std::size_t loop_id, const std::size_t cbmc_loop_id, - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &goto_function, symbol_table_baset &symbol_table, goto_programt::targett loop_head, @@ -307,7 +307,7 @@ class dfcc_instrument_loopt const std::vector &old_decreases_vars, const std::vector &new_decreases_vars, const goto_programt::instructiont::targett &step_case_target, - const irep_idt &symbol_mode); + irep_idt symbol_mode); /// \brief Adds instructions of the exit block. /// diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp index 321a6bdbadb..25320d89169 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.cpp @@ -138,7 +138,7 @@ static void init_static_symbols(std::unordered_set &static_symbols) } } -bool dfcc_is_cprover_function_symbol(const irep_idt &id) +bool dfcc_is_cprover_function_symbol(irep_idt id) { std::unordered_set function_symbols; init_function_symbols(function_symbols); @@ -148,7 +148,7 @@ bool dfcc_is_cprover_function_symbol(const irep_idt &id) has_prefix(str, "__VERIFIER") || has_prefix(str, "nondet"); } -bool dfcc_is_cprover_static_symbol(const irep_idt &id) +bool dfcc_is_cprover_static_symbol(irep_idt id) { std::unordered_set static_symbols; init_static_symbols(static_symbols); @@ -159,7 +159,7 @@ bool dfcc_is_cprover_static_symbol(const irep_idt &id) has_prefix(id2string(id), CPROVER_PREFIX "going_to"); } -bool dfcc_is_cprover_pointer_predicate(const irep_idt &id) +bool dfcc_is_cprover_pointer_predicate(irep_idt id) { return id == CPROVER_PREFIX "pointer_equals" || id == CPROVER_PREFIX "is_fresh" || diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.h index e6848cecf4a..17add9361f0 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_cprover_symbol.h @@ -17,14 +17,14 @@ Date: March 2023 /// Returns `true` iff id is one of the known CPROVER functions or starts with /// `__VERIFIER` or `nondet`. -bool dfcc_is_cprover_function_symbol(const irep_idt &id); +bool dfcc_is_cprover_function_symbol(irep_idt id); /// Returns `true` iff the symbol is one of the known CPROVER static /// instrumentation variables or ends with `$object` and represents an /// auto-generated object following a pointer dereference. -bool dfcc_is_cprover_static_symbol(const irep_idt &id); +bool dfcc_is_cprover_static_symbol(irep_idt id); /// Returns `true` iff the symbol is one of the CPROVER pointer predicates -bool dfcc_is_cprover_pointer_predicate(const irep_idt &id); +bool dfcc_is_cprover_pointer_predicate(irep_idt id); #endif diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_library.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_library.cpp index ed6389310a4..e7027b1cb1f 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_library.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_library.cpp @@ -195,13 +195,13 @@ dfcc_libraryt::dfcc_libraryt( } /// Returns the instrumentation function to use for a given front-end function -bool dfcc_libraryt::is_front_end_builtin(const irep_idt &function_id) const +bool dfcc_libraryt::is_front_end_builtin(irep_idt function_id) const { return dfcc_hook.find(function_id) != dfcc_hook.end(); } /// Returns the instrumentation function to use for a given front-end function -dfcc_funt dfcc_libraryt::get_hook(const irep_idt &function_id) const +dfcc_funt dfcc_libraryt::get_hook(irep_idt function_id) const { PRECONDITION(is_front_end_builtin(function_id)); return dfcc_hook.find(function_id)->second; @@ -209,7 +209,7 @@ dfcc_funt dfcc_libraryt::get_hook(const irep_idt &function_id) const // Returns the havoc function to use for a given front-end function std::optional -dfcc_libraryt::get_havoc_hook(const irep_idt &function_id) const +dfcc_libraryt::get_havoc_hook(irep_idt function_id) const { auto found = havoc_hook.find(function_id); if(found != havoc_hook.end()) @@ -368,7 +368,7 @@ void dfcc_libraryt::load(std::set &to_instrument) goto_model.goto_functions.function_map.at(it.second.name).make_hidden(); } -std::optional dfcc_libraryt::get_dfcc_fun(const irep_idt &id) const +std::optional dfcc_libraryt::get_dfcc_fun(irep_idt id) const { auto found = dfcc_name_to_fun.find(id); if(found != dfcc_name_to_fun.end()) @@ -377,7 +377,7 @@ std::optional dfcc_libraryt::get_dfcc_fun(const irep_idt &id) const return {}; } -bool dfcc_libraryt::is_dfcc_library_symbol(const irep_idt &id) const +bool dfcc_libraryt::is_dfcc_library_symbol(irep_idt id) const { return get_dfcc_fun(id).has_value(); } diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_library.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_library.h index a103da404a5..19e9ee65d26 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_library.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_library.h @@ -229,13 +229,13 @@ class dfcc_libraryt void load(std::set &to_instrument); /// Returns the dfcc_funt that corresponds to the given id if any. - std::optional get_dfcc_fun(const irep_idt &id) const; + std::optional get_dfcc_fun(irep_idt id) const; /// Returns the name of the given dfcc_funt. const irep_idt &get_dfcc_fun_name(dfcc_funt fun) const; /// True iff the given id is one of the library symbols. - bool is_dfcc_library_symbol(const irep_idt &id) const; + bool is_dfcc_library_symbol(irep_idt id) const; /// Specializes the library by unwinding loops in library functions /// to the given assigns clause size. @@ -260,17 +260,17 @@ class dfcc_libraryt /// Returns true iff the given function_id is one of `__CPROVER_assignable`, /// `__CPROVER_object_whole`, `__CPROVER_object_from`, /// `__CPROVER_object_upto`, `__CPROVER_freeable` - bool is_front_end_builtin(const irep_idt &function_id) const; + bool is_front_end_builtin(irep_idt function_id) const; /// Returns the library instrumentation hook for the given front-end function. /// \pre \p function_id is a front end built-in as defined by /// \ref is_front_end_builtin. - dfcc_funt get_hook(const irep_idt &function_id) const; + dfcc_funt get_hook(irep_idt function_id) const; /// Returns the library instrumentation hook for the given built-in. /// function_id must be one of `__CPROVER_assignable`, /// `__CPROVER_object_whole`, `__CPROVER_object_from`, `__CPROVER_object_upto` - std::optional get_havoc_hook(const irep_idt &function_id) const; + std::optional get_havoc_hook(irep_idt function_id) const; /// \brief Returns the "__dfcc_instrumented_functions" symbol or creates it if /// it does not exist already. diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.cpp index 3e4dab5c637..d40f5951de9 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.cpp @@ -39,14 +39,13 @@ dfcc_lift_memory_predicatest::dfcc_lift_memory_predicatest( } /// True if a function had at least one of its parameters lifted -bool dfcc_lift_memory_predicatest::is_lifted_function( - const irep_idt &function_id) +bool dfcc_lift_memory_predicatest::is_lifted_function(irep_idt function_id) { return lifted_parameters.find(function_id) != lifted_parameters.end(); } /// True iff function_id is a core memory predicate -static bool is_core_memory_predicate(const irep_idt &function_id) +static bool is_core_memory_predicate(irep_idt function_id) { return (function_id == CPROVER_PREFIX "pointer_equals") || (function_id == CPROVER_PREFIX "is_fresh") || @@ -125,9 +124,8 @@ std::set dfcc_lift_memory_predicatest::lift_predicates( // some predicates were found, build dependency graph struct dep_graph_nodet : public graph_nodet { - const irep_idt &function_id; - explicit dep_graph_nodet(const irep_idt &function_id) - : function_id(function_id) + irep_idt function_id; + explicit dep_graph_nodet(irep_idt function_id) : function_id(function_id) { } }; @@ -215,9 +213,9 @@ static std::optional is_param_expr( } void dfcc_lift_memory_predicatest::collect_parameters_to_lift( - const irep_idt &function_id) + irep_idt function_id) { - const symbolt &function_symbol = + const symbolt function_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, function_id); // map of parameter name to its rank in the signature std::map parameter_rank; @@ -287,7 +285,7 @@ void dfcc_lift_memory_predicatest::collect_parameters_to_lift( } void dfcc_lift_memory_predicatest::add_pointer_type( - const irep_idt &function_id, + irep_idt function_id, const std::size_t parameter_rank, replace_symbolt &replace_lifted_param) { @@ -328,7 +326,7 @@ void dfcc_lift_memory_predicatest::add_pointer_type( } void dfcc_lift_memory_predicatest::lift_parameters_and_update_body( - const irep_idt &function_id, + irep_idt function_id, std::set &discovered_function_pointer_contracts) { replace_symbolt replace_lifted_params; @@ -373,7 +371,7 @@ void dfcc_lift_memory_predicatest::lift_parameters_and_update_body( } void dfcc_lift_memory_predicatest::lift_predicate( - const irep_idt &function_id, + irep_idt function_id, std::set &discovered_function_pointer_contracts) { // when this function_id gets processed, any memory predicate it calls has diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.h index 848d5aaf600..120678bfb97 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_lift_memory_predicates.h @@ -79,11 +79,11 @@ class dfcc_lift_memory_predicatest const std::set &predicates); void lift_predicate( - const irep_idt &function_id, + irep_idt function_id, std::set &discovered_function_pointer_contracts); void lift_parameters_and_update_body( - const irep_idt &function_id, + irep_idt function_id, std::set &discovered_function_pointer_contracts); /// \brief adds a pointer_type to the parameter of a function @@ -93,16 +93,16 @@ class dfcc_lift_memory_predicatest /// The parameter symbol gets updated in the symbol table and the function /// signature gets updated with the new type. void add_pointer_type( - const irep_idt &function_id, + irep_idt function_id, const std::size_t parameter_rank, replace_symbolt &replace_lifted_param); /// \brief Computes the subset of function parameters of function_id /// that are passed directly to core predicates and must be lifted. - void collect_parameters_to_lift(const irep_idt &function_id); + void collect_parameters_to_lift(irep_idt function_id); /// \brief True if a function at least had one of its parameters lifted - bool is_lifted_function(const irep_idt &function_id); + bool is_lifted_function(irep_idt function_id); }; #endif diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_loop_tags.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_loop_tags.cpp index 6f1be29ad7d..32fd2571655 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_loop_tags.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_loop_tags.cpp @@ -40,16 +40,15 @@ bool dfcc_has_loop_id( return loop_id_opt.has_value() && loop_id_opt.value() == loop_id; } -static void dfcc_set_loop_tag( - goto_programt::instructiont::targett &target, - const irep_idt &tag) +static void +dfcc_set_loop_tag(goto_programt::instructiont::targett &target, irep_idt tag) { target->source_location_nonconst().set(tag, true); } static bool has_loop_tag( const goto_programt::instructiont::const_targett &target, - const irep_idt &tag) + irep_idt tag) { return target->source_location().get_bool(tag); } diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.cpp index 48a55bbc323..08bd175cdc1 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.cpp @@ -42,8 +42,8 @@ const typet &dfcc_spec_functionst::get_target_type(const exprt &expr) } void dfcc_spec_functionst::generate_havoc_function( - const irep_idt &function_id, - const irep_idt &havoc_function_id, + irep_idt function_id, + irep_idt havoc_function_id, std::size_t &nof_targets) { INVARIANT( @@ -51,7 +51,7 @@ void dfcc_spec_functionst::generate_havoc_function( "DFCC: havoc function id '" + id2string(havoc_function_id) + "' already exists"); - const auto &function_symbol = + const symbolt function_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, function_id); // create the code type that goes on the function symbol @@ -143,7 +143,7 @@ void dfcc_spec_functionst::generate_havoc_function( } void dfcc_spec_functionst::generate_havoc_instructions( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &original_program, const exprt &write_set_to_havoc, dfcc_ptr_havoc_modet ptr_havoc_mode, @@ -277,7 +277,7 @@ void dfcc_spec_functionst::generate_havoc_instructions( } void dfcc_spec_functionst::to_spec_assigns_function( - const irep_idt &function_id, + irep_idt function_id, std::size_t &nof_targets) { auto &goto_function = goto_model.goto_functions.function_map.at(function_id); @@ -304,7 +304,7 @@ void dfcc_spec_functionst::to_spec_assigns_function( void dfcc_spec_functionst::to_spec_assigns_instructions( const exprt &write_set_to_fill, - const irep_idt &language_mode, + irep_idt language_mode, goto_programt &program, std::size_t &nof_targets) { @@ -360,7 +360,7 @@ void dfcc_spec_functionst::to_spec_assigns_instructions( } void dfcc_spec_functionst::to_spec_frees_function( - const irep_idt &function_id, + irep_idt function_id, std::size_t &nof_targets) { auto &goto_function = goto_model.goto_functions.function_map.at(function_id); @@ -387,7 +387,7 @@ void dfcc_spec_functionst::to_spec_frees_function( void dfcc_spec_functionst::to_spec_frees_instructions( const exprt &write_set_to_fill, - const irep_idt &language_mode, + irep_idt language_mode, goto_programt &program, std::size_t &nof_targets) { diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.h index 2f64f551275..c37a1bfd202 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_spec_functions.h @@ -74,8 +74,8 @@ class dfcc_spec_functionst /// \param[in] havoc_function_id write set variable to havoc /// \param[out] nof_targets maximum number of targets to havoc void generate_havoc_function( - const irep_idt &function_id, - const irep_idt &havoc_function_id, + irep_idt function_id, + irep_idt havoc_function_id, std::size_t &nof_targets); /// Translates \p original_program that specifies assignable targets @@ -100,7 +100,7 @@ class dfcc_spec_functionst /// \param[out] havoc_program destination program for havoc instructions /// \param[out] nof_targets max number of havoc targets discovered void generate_havoc_instructions( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &original_program, const exprt &write_set_to_havoc, dfcc_ptr_havoc_modet ptr_havoc_mode, @@ -128,9 +128,7 @@ class dfcc_spec_functionst /// \param function_id function to transform in place /// \param nof_targets receives the estimated size of the write set /// - void to_spec_assigns_function( - const irep_idt &function_id, - std::size_t &nof_targets); + void to_spec_assigns_function(irep_idt function_id, std::size_t &nof_targets); /// Rewrites in place \p program expressed in terms of built-ins specifying /// assignable targets declaratively using `__CPROVER_assignable`, @@ -153,7 +151,7 @@ class dfcc_spec_functionst /// void to_spec_assigns_instructions( const exprt &write_set_to_fill, - const irep_idt &language_mode, + irep_idt language_mode, goto_programt &program, std::size_t &nof_targets); @@ -180,8 +178,7 @@ class dfcc_spec_functionst /// \param function_id function to transform in place /// \param nof_targets receives the estimated size of the write set /// - void - to_spec_frees_function(const irep_idt &function_id, std::size_t &nof_targets); + void to_spec_frees_function(irep_idt function_id, std::size_t &nof_targets); /// Rewrites in place \p program expressed in terms of built-ins specifying /// freeable targets declaratively using `__CPROVER_freeable` into a program @@ -202,7 +199,7 @@ class dfcc_spec_functionst /// void to_spec_frees_instructions( const exprt &write_set_to_fill, - const irep_idt &language_mode, + irep_idt language_mode, goto_programt &program, std::size_t &nof_targets); diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.cpp index 2f57751f7dd..7ab2bc7d952 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.cpp @@ -42,8 +42,8 @@ std::map< void dfcc_swap_and_wrapt::swap_and_wrap( const dfcc_contract_modet contract_mode, const loop_contract_configt &loop_contract_config, - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts, bool allow_recursive_calls) { @@ -133,8 +133,8 @@ void dfcc_swap_and_wrapt::get_swapped_functions(std::set &dest) const /// ``` void dfcc_swap_and_wrapt::check_contract( const loop_contract_configt &loop_contract_config, - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts, bool allow_recursive_calls) { @@ -147,7 +147,7 @@ void dfcc_swap_and_wrapt::check_contract( // wrapper body goto_programt body; - const auto &wrapper_symbol = + const symbolt wrapper_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, wrapper_id); auto check_started = dfcc_utilst::create_static_symbol( @@ -264,8 +264,8 @@ void dfcc_swap_and_wrapt::check_contract( } void dfcc_swap_and_wrapt::replace_with_contract( - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts) { const irep_idt &wrapper_id = function_id; diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.h index 73c2e909ae3..545dbcc69e5 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_swap_and_wrap.h @@ -49,8 +49,8 @@ class dfcc_swap_and_wrapt void swap_and_wrap_check( const loop_contract_configt &loop_contract_config, - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts, bool allow_recursive_calls) { @@ -64,8 +64,8 @@ class dfcc_swap_and_wrapt } void swap_and_wrap_replace( - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts) { swap_and_wrap( @@ -99,8 +99,8 @@ class dfcc_swap_and_wrapt void swap_and_wrap( const dfcc_contract_modet contract_mode, const loop_contract_configt &loop_contract_config, - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts, bool allow_recursive_calls); @@ -108,16 +108,16 @@ class dfcc_swap_and_wrapt /// checks the given `contract_id`. void check_contract( const loop_contract_configt &loop_contract_config, - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts, bool allow_recursive_calls); /// Swaps-and-wraps the given `function_id` in a wrapper function that /// models the abstract behaviour of contract `contract_id`. void replace_with_contract( - const irep_idt &function_id, - const irep_idt &contract_id, + irep_idt function_id, + irep_idt contract_id, std::set &function_pointer_contracts); }; #endif diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.cpp index bd501d020a1..508f592dcce 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.cpp @@ -32,7 +32,7 @@ Date: August 2022 /// Returns true iff the given symbol exists and satisfies requirements. static bool symbol_exists( const goto_modelt &goto_model, - const irep_idt &name, + irep_idt name, const bool require_has_code_type, const bool require_body_available) { @@ -57,21 +57,21 @@ static bool symbol_exists( bool dfcc_utilst::function_symbol_exists( const goto_modelt &goto_model, - const irep_idt &function_id) + irep_idt function_id) { return symbol_exists(goto_model, function_id, true, false); } bool dfcc_utilst::function_symbol_with_body_exists( const goto_modelt &goto_model, - const irep_idt &function_id) + irep_idt function_id) { return symbol_exists(goto_model, function_id, true, true); } symbolt &dfcc_utilst::get_function_symbol( symbol_table_baset &symbol_table, - const irep_idt &function_id) + irep_idt function_id) { symbolt &function_symbol = symbol_table.get_writeable_ref(function_id); CHECK_RETURN(function_symbol.type.id() == ID_code); @@ -81,11 +81,11 @@ symbolt &dfcc_utilst::get_function_symbol( symbol_exprt dfcc_utilst::create_symbol( symbol_table_baset &symbol_table, const typet &type, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const source_locationt &source_location) { - const symbolt &function_symbol = + const symbolt function_symbol = get_function_symbol(symbol_table, function_id); symbolt &symbol = get_fresh_aux_symbol( @@ -106,8 +106,8 @@ const symbolt &dfcc_utilst::create_static_symbol( const std::string &prefix, const std::string &base_name, const source_locationt &source_location, - const irep_idt &mode, - const irep_idt &module, + irep_idt mode, + irep_idt module, const exprt &initial_value, const bool no_nondet_initialization) { @@ -123,11 +123,11 @@ const symbolt &dfcc_utilst::create_static_symbol( const symbolt &dfcc_utilst::create_new_parameter_symbol( symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const typet &type) { - const symbolt &function_symbol = + const symbolt function_symbol = get_function_symbol(symbol_table, function_id); symbolt &symbol = get_fresh_aux_symbol( @@ -156,7 +156,7 @@ static void add_parameter(const symbolt &symbol, code_typet &code_type) void dfcc_utilst::add_parameter( goto_modelt &goto_model, const symbolt &symbol, - const irep_idt &function_id) + irep_idt function_id) { auto &function_symbol = get_function_symbol(goto_model.symbol_table, function_id); @@ -169,7 +169,7 @@ void dfcc_utilst::add_parameter( const symbolt &dfcc_utilst::add_parameter( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const typet &type) { @@ -184,11 +184,11 @@ const symbolt &dfcc_utilst::add_parameter( static void clone_parameters( symbol_table_baset &symbol_table, const code_typet::parameterst &old_params, - const irep_idt &mode, - const irep_idt &module, + irep_idt mode, + irep_idt module, const source_locationt &location, - std::function &trans_param, - const irep_idt &new_function_id, + std::function &trans_param, + irep_idt new_function_id, code_typet::parameterst &new_params) { // rename function parameters in the wrapper function's code_type @@ -248,13 +248,13 @@ static void clone_parameters( /// \return the new function symbol static const symbolt &clone_and_rename_function( goto_modelt &goto_model, - const irep_idt &function_id, - std::function &trans_fun, - std::function &trans_param, + irep_idt function_id, + std::function &trans_fun, + std::function &trans_param, std::function &trans_ret_type, std::function &trans_loc) { - const symbolt &old_function_symbol = + const symbolt old_function_symbol = dfcc_utilst::get_function_symbol(goto_model.symbol_table, function_id); code_typet old_code_type = to_code_type(old_function_symbol.type); @@ -299,15 +299,15 @@ static const symbolt &clone_and_rename_function( const symbolt &dfcc_utilst::clone_and_rename_function( goto_modelt &goto_model, - const irep_idt &function_id, - const irep_idt &new_function_id, + irep_idt function_id, + irep_idt new_function_id, std::optional new_return_type = {}) { - std::function trans_fun = - [&](const irep_idt &old_name) { return new_function_id; }; + std::function trans_fun = [&](irep_idt old_name) + { return new_function_id; }; - std::function trans_param = - [&](const irep_idt &old_name) { return old_name; }; + std::function trans_param = [&](irep_idt old_name) + { return old_name; }; std::function trans_ret_type = [&](const typet &old_type) { @@ -323,8 +323,8 @@ const symbolt &dfcc_utilst::clone_and_rename_function( void dfcc_utilst::wrap_function( goto_modelt &goto_model, - const irep_idt &function_id, - const irep_idt &wrapped_function_id) + irep_idt function_id, + irep_idt wrapped_function_id) { auto &goto_functions = goto_model.goto_functions; auto &symbol_table = goto_model.symbol_table; @@ -360,10 +360,8 @@ void dfcc_utilst::wrap_function( // Re-insert a symbol for `function_id` which is now the wrapper function symbolt wrapper_sym = *old_sym; - std::function trans_param = - [&](const irep_idt &old_param) { - return id2string(old_param) + "_wrapper"; - }; + std::function trans_param = [&](irep_idt old_param) + { return id2string(old_param) + "_wrapper"; }; // create new code_type with renamed parameters for the wrapper const auto &old_code_type = to_code_type(old_sym->type); @@ -423,7 +421,7 @@ exprt dfcc_utilst::make_sizeof_expr(const exprt &expr, const namespacet &ns) static inlining_decoratort inline_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, message_handlert &message_handler) { auto &goto_function = goto_model.goto_functions.function_map.at(function_id); @@ -442,7 +440,7 @@ static inlining_decoratort inline_function( void dfcc_utilst::inline_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, message_handlert &message_handler) { inlining_decoratort decorated = @@ -459,7 +457,7 @@ void dfcc_utilst::inline_function( void dfcc_utilst::inline_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, std::set &no_body, std::set &recursive_call, std::set &missing_function, diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.h b/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.h index 341371cddef..11cb82a3f59 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.h +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_utils.h @@ -26,15 +26,13 @@ class symbolt; struct dfcc_utilst { /// Returns true iff the given symbol exists and satisfies requirements. + static bool function_symbol_exists(const goto_modelt &, irep_idt function_id); static bool - function_symbol_exists(const goto_modelt &, const irep_idt &function_id); - static bool function_symbol_with_body_exists( - const goto_modelt &, - const irep_idt &function_id); + function_symbol_with_body_exists(const goto_modelt &, irep_idt function_id); /// Returns the `symbolt` for `function_id`. static symbolt & - get_function_symbol(symbol_table_baset &, const irep_idt &function_id); + get_function_symbol(symbol_table_baset &, irep_idt function_id); /// Adds a new symbol named `function_id::base_name` of type `type` /// with given attributes in the symbol table, and returns a symbol expression @@ -44,7 +42,7 @@ struct dfcc_utilst static symbol_exprt create_symbol( symbol_table_baset &, const typet &type, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const source_locationt &source_location); @@ -65,8 +63,8 @@ struct dfcc_utilst const std::string &prefix, const std::string &base_name, const source_locationt &source_location, - const irep_idt &mode, - const irep_idt &module, + irep_idt mode, + irep_idt module, const exprt &initial_value, const bool no_nondet_initialization = true); @@ -77,23 +75,21 @@ struct dfcc_utilst static const symbolt & create_new_parameter_symbol( symbol_table_baset &, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const typet &type); /// \brief Adds the given symbol as parameter to the function symbol's /// code_type. Also adds the corresponding parameter to its goto_function if /// it exists in the function map of the goto model. - static void add_parameter( - goto_modelt &, - const symbolt &symbol, - const irep_idt &function_id); + static void + add_parameter(goto_modelt &, const symbolt &symbol, irep_idt function_id); /// \brief Adds a parameter with given `base_name` and `type` to the given /// `function_id`. Both the symbol and the goto_function are updated. static const symbolt &add_parameter( goto_modelt &, - const irep_idt &function_id, + irep_idt function_id, const std::string &base_name, const typet &type); @@ -109,8 +105,8 @@ struct dfcc_utilst static const symbolt & clone_and_rename_function( goto_modelt &goto_model, - const irep_idt &function_id, - const irep_idt &new_function_id, + irep_idt function_id, + irep_idt new_function_id, std::optional new_return_type); /// Given a function to wrap `foo` and a new name `wrapped_foo` @@ -143,8 +139,8 @@ struct dfcc_utilst /// checking logic, contract replacement logic, etc. static void wrap_function( goto_modelt &goto_model, - const irep_idt &function_id, - const irep_idt &wrapped_function_id); + irep_idt function_id, + irep_idt wrapped_function_id); /// \brief Returns the expression `expr == NULL`. static const exprt make_null_check_expr(const exprt &ptr); @@ -156,14 +152,14 @@ struct dfcc_utilst /// inlining. static void inline_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, message_handlert &message_handler); /// \brief Inlines the given function, and returns function symbols that /// caused warnings. static void inline_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, std::set &no_body, std::set &recursive_call, std::set &missing_function, diff --git a/src/goto-instrument/contracts/havoc_assigns_clause_targets.h b/src/goto-instrument/contracts/havoc_assigns_clause_targets.h index dc25bfecda8..4f3fee252ca 100644 --- a/src/goto-instrument/contracts/havoc_assigns_clause_targets.h +++ b/src/goto-instrument/contracts/havoc_assigns_clause_targets.h @@ -52,7 +52,7 @@ class havoc_assigns_clause_targetst : public instrument_spec_assignst /// \param _message_handler handler used to log translation warnings/errors /// havoc_assigns_clause_targetst( - const irep_idt &_function_id, + irep_idt _function_id, const std::vector &_targets, const goto_functionst &_functions, cfg_infot &_cfg_info, diff --git a/src/goto-instrument/contracts/instrument_spec_assigns.cpp b/src/goto-instrument/contracts/instrument_spec_assigns.cpp index b346f64007c..14add356292 100644 --- a/src/goto-instrument/contracts/instrument_spec_assigns.cpp +++ b/src/goto-instrument/contracts/instrument_spec_assigns.cpp @@ -460,7 +460,7 @@ static symbol_exprt create_fresh_symbol( const std::string &suffix, const typet &type, const source_locationt &location, - const irep_idt &mode, + irep_idt mode, symbol_table_baset &symbol_table) { return get_fresh_aux_symbol( @@ -992,8 +992,7 @@ bool instrument_spec_assignst::must_check_assign( } /// Track the symbol is not a local or is a dirty local. -bool instrument_spec_assignst::must_track_decl_or_dead( - const irep_idt &ident) const +bool instrument_spec_assignst::must_track_decl_or_dead(irep_idt ident) const { return cfg_info.is_not_local_or_dirty_local(ident); } diff --git a/src/goto-instrument/contracts/instrument_spec_assigns.h b/src/goto-instrument/contracts/instrument_spec_assigns.h index 2534f61427d..07c24f0f46e 100644 --- a/src/goto-instrument/contracts/instrument_spec_assigns.h +++ b/src/goto-instrument/contracts/instrument_spec_assigns.h @@ -194,7 +194,7 @@ class instrument_spec_assignst /// \param _st symbol table of the goto_model /// \param _message_handler used to output warning/error messages instrument_spec_assignst( - const irep_idt &_function_id, + irep_idt _function_id, const goto_functionst &_functions, cfg_infot &_cfg_info, symbol_table_baset &_st, @@ -471,7 +471,7 @@ class instrument_spec_assignst protected: /// Name of the instrumented function - const irep_idt &function_id; + irep_idt function_id; /// Other functions of the model const goto_functionst &functions; @@ -489,7 +489,7 @@ class instrument_spec_assignst messaget log; /// Language mode - const irep_idt &mode; + irep_idt mode; /// Track and generate snaphsot instructions and target validity /// checking assertions for a conditional target group from an assigns clause @@ -575,7 +575,7 @@ class instrument_spec_assignst /// passed C compiler checks, non-dirty locals can only be assigned to /// directly by name, cannot escape their lexical scope, and are always safe /// to assign. Hence, we only track dirty locals in the write set. - bool must_track_decl_or_dead(const irep_idt &ident) const; + bool must_track_decl_or_dead(irep_idt ident) const; /// Returns true iff an `ASSIGN lhs := rhs` instruction must be instrumented. bool must_check_assign(const goto_programt::const_targett &target); diff --git a/src/goto-instrument/contracts/memory_predicates.cpp b/src/goto-instrument/contracts/memory_predicates.cpp index c78eb140966..906e99f4c2f 100644 --- a/src/goto-instrument/contracts/memory_predicates.cpp +++ b/src/goto-instrument/contracts/memory_predicates.cpp @@ -242,7 +242,7 @@ void is_fresh_baset::update_fn_call( is_fresh_enforcet::is_fresh_enforcet( goto_modelt &goto_model, message_handlert &message_handler, - const irep_idt &_fun_id) + irep_idt _fun_id) : is_fresh_baset(goto_model, message_handler, _fun_id) { std::stringstream ssreq, ssensure, ssmemmap; @@ -321,7 +321,7 @@ void is_fresh_enforcet::create_ensures_fn_call(goto_programt::targett &ins) is_fresh_replacet::is_fresh_replacet( goto_modelt &goto_model, message_handlert &message_handler, - const irep_idt &_fun_id) + irep_idt _fun_id) : is_fresh_baset(goto_model, message_handler, _fun_id) { std::stringstream ssreq, ssensure, ssmemmap; diff --git a/src/goto-instrument/contracts/memory_predicates.h b/src/goto-instrument/contracts/memory_predicates.h index 543ef9c7386..3ef4c7953db 100644 --- a/src/goto-instrument/contracts/memory_predicates.h +++ b/src/goto-instrument/contracts/memory_predicates.h @@ -28,7 +28,7 @@ class is_fresh_baset is_fresh_baset( goto_modelt &goto_model, message_handlert &message_handler, - const irep_idt &_fun_id) + irep_idt _fun_id) : goto_model(goto_model), message_handler(message_handler), fun_id(_fun_id) { } @@ -53,7 +53,7 @@ class is_fresh_baset goto_modelt &goto_model; message_handlert &message_handler; - const irep_idt &fun_id; + irep_idt fun_id; // written by the child classes. std::string memmap_name; @@ -70,7 +70,7 @@ class is_fresh_enforcet : public is_fresh_baset is_fresh_enforcet( goto_modelt &goto_model, message_handlert &message_handler, - const irep_idt &_fun_id); + irep_idt _fun_id); virtual void create_declarations(); @@ -85,7 +85,7 @@ class is_fresh_replacet : public is_fresh_baset is_fresh_replacet( goto_modelt &goto_model, message_handlert &message_handler, - const irep_idt &_fun_id); + irep_idt _fun_id); virtual void create_declarations(); diff --git a/src/goto-instrument/contracts/utils.cpp b/src/goto-instrument/contracts/utils.cpp index f01bd73f97e..cb481844315 100644 --- a/src/goto-instrument/contracts/utils.cpp +++ b/src/goto-instrument/contracts/utils.cpp @@ -328,14 +328,14 @@ static const char ASSIGNS_CLAUSE_REPLACEMENT_TRACKING[] = irep_idt make_assigns_clause_replacement_tracking_comment( const exprt &target, - const irep_idt &function_id, + irep_idt function_id, const namespacet &ns) { return from_expr(ns, target.id(), target) + ASSIGNS_CLAUSE_REPLACEMENT_TRACKING + id2string(function_id) + ")"; } -bool is_assigns_clause_replacement_tracking_comment(const irep_idt &comment) +bool is_assigns_clause_replacement_tracking_comment(irep_idt comment) { return id2string(comment).find(ASSIGNS_CLAUSE_REPLACEMENT_TRACKING) != std::string::npos; @@ -388,9 +388,9 @@ static void replace_history_parameter_rec( exprt &expr, std::unordered_map ¶meter2history, const source_locationt &location, - const irep_idt &mode, + irep_idt mode, goto_programt &history, - const irep_idt &history_id) + irep_idt history_id) { for(auto &op : expr.operands()) { @@ -401,7 +401,7 @@ static void replace_history_parameter_rec( if(expr.id() != ID_old && expr.id() != ID_loop_entry) return; - const auto ¶meter = to_history_expr(expr, history_id).expression(); + const auto parameter = to_history_expr(expr, history_id).expression(); const auto &id = parameter.id(); DATA_INVARIANT_WITH_DIAGNOSTICS( id == ID_dereference || id == ID_member || id == ID_symbol || @@ -457,7 +457,7 @@ replace_history_parametert replace_history_old( symbol_table_baset &symbol_table, const exprt &expr, const source_locationt &location, - const irep_idt &mode) + irep_idt mode) { replace_history_parametert result; result.expression_after_replacement = expr; @@ -476,7 +476,7 @@ replace_history_parametert replace_history_loop_entry( symbol_table_baset &symbol_table, const exprt &expr, const source_locationt &location, - const irep_idt &mode) + irep_idt mode) { replace_history_parametert result; result.expression_after_replacement = expr; @@ -494,7 +494,7 @@ replace_history_parametert replace_history_loop_entry( void generate_history_variables_initialization( symbol_table_baset &symbol_table, exprt &clause, - const irep_idt &mode, + irep_idt mode, goto_programt &program) { // Find and replace "old" expression in the "expression" variable diff --git a/src/goto-instrument/contracts/utils.h b/src/goto-instrument/contracts/utils.h index 2b81b81c27c..40ea8d8cc1c 100644 --- a/src/goto-instrument/contracts/utils.h +++ b/src/goto-instrument/contracts/utils.h @@ -42,7 +42,7 @@ class cleanert : public goto_convertt } [[nodiscard]] std::list - clean(exprt &guard, goto_programt &dest, const irep_idt &mode) + clean(exprt &guard, goto_programt &dest, irep_idt mode) { auto clean_result = goto_convertt::clean_expr(guard, mode, true); dest.destructive_append(clean_result.side_effects); @@ -53,7 +53,7 @@ class cleanert : public goto_convertt const symbol_exprt &function, const exprt::operandst &arguments, goto_programt &dest, - const irep_idt &mode) + irep_idt mode) { goto_convertt::do_havoc_slice(nil_exprt{}, function, arguments, dest, mode); } @@ -93,7 +93,7 @@ class havoc_assigns_targetst : public havoc_if_validt const assignst &mod, symbol_tablet &st, message_handlert &message_handler, - const irep_idt &mode) + irep_idt mode) : havoc_if_validt(mod, ns), ns(st), cleaner(st, message_handler), @@ -121,7 +121,7 @@ class havoc_assigns_targetst : public havoc_if_validt namespacet ns; cleanert cleaner; messaget log; - const irep_idt &mode; + irep_idt mode; }; /// \brief Generate a validity check over all dereferences in an expression @@ -210,12 +210,12 @@ bool is_loop_free( /// `target` was assigned by the contract of `function_id`. irep_idt make_assigns_clause_replacement_tracking_comment( const exprt &target, - const irep_idt &function_id, + irep_idt function_id, const namespacet &ns); /// Returns true if the given comment matches the type of comments created by /// \ref make_assigns_clause_replacement_tracking_comment. -bool is_assigns_clause_replacement_tracking_comment(const irep_idt &comment); +bool is_assigns_clause_replacement_tracking_comment(irep_idt comment); /// Infer loop assigns using alias analysis result `local_may_alias`. void infer_loop_assigns( @@ -243,7 +243,7 @@ replace_history_parametert replace_history_old( symbol_table_baset &symbol_table, const exprt &expr, const source_locationt &location, - const irep_idt &mode); + irep_idt mode); /// This function recursively identifies the "loop_entry" expressions within /// \p expr and replaces them with corresponding history variables. @@ -251,14 +251,14 @@ replace_history_parametert replace_history_loop_entry( symbol_table_baset &symbol_table, const exprt &expr, const source_locationt &location, - const irep_idt &mode); + irep_idt mode); /// This function generates all the instructions required to initialize /// history variables. void generate_history_variables_initialization( symbol_table_baset &symbol_table, exprt &clause, - const irep_idt &mode, + irep_idt mode, goto_programt &program); /// Return true if `target` is the head of some transformed loop. diff --git a/src/goto-instrument/cover.cpp b/src/goto-instrument/cover.cpp index 96fb6020e22..22eab7cbde0 100644 --- a/src/goto-instrument/cover.cpp +++ b/src/goto-instrument/cover.cpp @@ -34,10 +34,10 @@ Date: May 2016 /// asserted is expected to include the expression passed in, but may include /// other additional conditions. static void instrument_cover_goals( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const cover_instrumenterst &instrumenters, - const irep_idt &mode, + irep_idt mode, message_handlert &message_handler, const cover_instrumenter_baset::assertion_factoryt &make_assertion) { @@ -246,7 +246,7 @@ cover_configt get_cover_config( /// \return a cover_configt on success, or null otherwise. cover_configt get_cover_config( const optionst &options, - const irep_idt &main_function_id, + irep_idt main_function_id, const symbol_tablet &symbol_table, message_handlert &message_handler) { diff --git a/src/goto-instrument/cover.h b/src/goto-instrument/cover.h index 548ded5eb6b..184c7cc79b2 100644 --- a/src/goto-instrument/cover.h +++ b/src/goto-instrument/cover.h @@ -88,7 +88,7 @@ get_cover_config(const optionst &, const symbol_tablet &, message_handlert &); cover_configt get_cover_config( const optionst &, - const irep_idt &main_function_id, + irep_idt main_function_id, const symbol_tablet &, message_handlert &); diff --git a/src/goto-instrument/cover_basic_blocks.cpp b/src/goto-instrument/cover_basic_blocks.cpp index 23df805b4dc..aa9c4208944 100644 --- a/src/goto-instrument/cover_basic_blocks.cpp +++ b/src/goto-instrument/cover_basic_blocks.cpp @@ -123,7 +123,7 @@ cover_basic_blockst::source_lines_of(const std::size_t block_nr) const } void cover_basic_blockst::report_block_anomalies( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, message_handlert &message_handler) { diff --git a/src/goto-instrument/cover_basic_blocks.h b/src/goto-instrument/cover_basic_blocks.h index 8c9bd2c2a89..1a7056409c5 100644 --- a/src/goto-instrument/cover_basic_blocks.h +++ b/src/goto-instrument/cover_basic_blocks.h @@ -51,7 +51,7 @@ class cover_blocks_baset /// \param goto_program: The goto program /// \param message_handler: The message handler virtual void report_block_anomalies( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, message_handlert &message_handler) { @@ -93,7 +93,7 @@ class cover_basic_blockst final : public cover_blocks_baset /// \param goto_program: The goto program /// \param message_handler: The message handler void report_block_anomalies( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, message_handlert &message_handler) override; diff --git a/src/goto-instrument/cover_filter.h b/src/goto-instrument/cover_filter.h index c1a479f258e..28e1d1aeb09 100644 --- a/src/goto-instrument/cover_filter.h +++ b/src/goto-instrument/cover_filter.h @@ -142,7 +142,7 @@ class internal_functions_filtert : public function_filter_baset class file_filtert : public function_filter_baset { public: - explicit file_filtert(const irep_idt &file_id) : file_id(file_id) + explicit file_filtert(irep_idt file_id) : file_id(file_id) { } @@ -157,7 +157,7 @@ class file_filtert : public function_filter_baset class single_function_filtert : public function_filter_baset { public: - explicit single_function_filtert(const irep_idt &function_id) + explicit single_function_filtert(irep_idt function_id) : function_id(function_id) { } diff --git a/src/goto-instrument/cover_instrument.h b/src/goto-instrument/cover_instrument.h index a535987fd91..c5b82384e4d 100644 --- a/src/goto-instrument/cover_instrument.h +++ b/src/goto-instrument/cover_instrument.h @@ -30,7 +30,7 @@ class cover_instrumenter_baset cover_instrumenter_baset( const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters, - const irep_idt &_coverage_criterion) + irep_idt _coverage_criterion) : coverage_criterion(_coverage_criterion), ns(_symbol_table), goal_filters(_goal_filters) @@ -54,7 +54,7 @@ class cover_instrumenter_baset /// \param make_assertion: A function which makes goto program assertions. /// This parameter may be used to customise the expressions asserted. void operator()( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const cover_blocks_baset &basic_blocks, const assertion_factoryt &make_assertion) const @@ -74,7 +74,7 @@ class cover_instrumenter_baset /// Override this method to implement an instrumenter virtual void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -83,7 +83,7 @@ class cover_instrumenter_baset void initialize_source_location( source_locationt &source_location, const std::string &comment, - const irep_idt &function_id) const + irep_idt function_id) const { source_location.set_comment(comment); source_location.set(ID_coverage_criterion, coverage_criterion); @@ -114,7 +114,7 @@ class cover_instrumenterst /// \param make_assertion: A function which makes goto program assertions. /// This parameter may be used to customise the expressions asserted. void operator()( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const cover_blocks_baset &basic_blocks, const cover_instrumenter_baset::assertion_factoryt &make_assertion) const @@ -140,7 +140,7 @@ class cover_location_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -160,7 +160,7 @@ class cover_branch_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -180,7 +180,7 @@ class cover_condition_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -200,7 +200,7 @@ class cover_decision_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -220,7 +220,7 @@ class cover_mcdc_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -240,7 +240,7 @@ class cover_path_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -260,7 +260,7 @@ class cover_assertion_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -280,7 +280,7 @@ class cover_cover_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, @@ -288,7 +288,7 @@ class cover_cover_instrumentert : public cover_instrumenter_baset }; void cover_instrument_end_of_function( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const cover_instrumenter_baset::assertion_factoryt &); @@ -305,7 +305,7 @@ class cover_assume_instrumentert : public cover_instrumenter_baset protected: void instrument( - const irep_idt &, + irep_idt, goto_programt &, goto_programt::targett &, const cover_blocks_baset &, diff --git a/src/goto-instrument/cover_instrument_assume.cpp b/src/goto-instrument/cover_instrument_assume.cpp index 0b0591ec4d6..4ed73537eb8 100644 --- a/src/goto-instrument/cover_instrument_assume.cpp +++ b/src/goto-instrument/cover_instrument_assume.cpp @@ -14,7 +14,7 @@ /// \param i_it The current instruction (instruction under instrumentation). /// \param make_assertion The assertion generator function. void cover_assume_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &, diff --git a/src/goto-instrument/cover_instrument_branch.cpp b/src/goto-instrument/cover_instrument_branch.cpp index 803b4f4b78c..e038e418759 100644 --- a/src/goto-instrument/cover_instrument_branch.cpp +++ b/src/goto-instrument/cover_instrument_branch.cpp @@ -14,7 +14,7 @@ Author: Daniel Kroening #include "cover_instrument.h" void cover_branch_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &basic_blocks, diff --git a/src/goto-instrument/cover_instrument_condition.cpp b/src/goto-instrument/cover_instrument_condition.cpp index 9e5c319db8f..8bd925fd219 100644 --- a/src/goto-instrument/cover_instrument_condition.cpp +++ b/src/goto-instrument/cover_instrument_condition.cpp @@ -16,7 +16,7 @@ Author: Daniel Kroening #include "cover_util.h" void cover_condition_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &, diff --git a/src/goto-instrument/cover_instrument_decision.cpp b/src/goto-instrument/cover_instrument_decision.cpp index adefbd528da..3cfc386fa9c 100644 --- a/src/goto-instrument/cover_instrument_decision.cpp +++ b/src/goto-instrument/cover_instrument_decision.cpp @@ -16,7 +16,7 @@ Author: Daniel Kroening #include "cover_util.h" void cover_decision_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &, diff --git a/src/goto-instrument/cover_instrument_location.cpp b/src/goto-instrument/cover_instrument_location.cpp index 64b93dc1936..200fa78d6c2 100644 --- a/src/goto-instrument/cover_instrument_location.cpp +++ b/src/goto-instrument/cover_instrument_location.cpp @@ -15,7 +15,7 @@ Author: Daniel Kroening #include "cover_filter.h" void cover_location_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &basic_blocks, diff --git a/src/goto-instrument/cover_instrument_mcdc.cpp b/src/goto-instrument/cover_instrument_mcdc.cpp index 08db0b0092b..25a9314de3d 100644 --- a/src/goto-instrument/cover_instrument_mcdc.cpp +++ b/src/goto-instrument/cover_instrument_mcdc.cpp @@ -621,7 +621,7 @@ void minimize_mcdc_controlling( } void cover_mcdc_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &i_it, const cover_blocks_baset &, diff --git a/src/goto-instrument/cover_instrument_other.cpp b/src/goto-instrument/cover_instrument_other.cpp index 5ab081c9490..00c50796b16 100644 --- a/src/goto-instrument/cover_instrument_other.cpp +++ b/src/goto-instrument/cover_instrument_other.cpp @@ -18,7 +18,7 @@ Author: Daniel Kroening #include void cover_path_instrumentert::instrument( - const irep_idt &, + irep_idt, goto_programt &, goto_programt::targett &i_it, const cover_blocks_baset &, @@ -31,7 +31,7 @@ void cover_path_instrumentert::instrument( } void cover_assertion_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &i_it, const cover_blocks_baset &, @@ -49,7 +49,7 @@ void cover_assertion_instrumentert::instrument( } void cover_cover_instrumentert::instrument( - const irep_idt &function_id, + irep_idt function_id, goto_programt &, goto_programt::targett &i_it, const cover_blocks_baset &, @@ -76,7 +76,7 @@ void cover_cover_instrumentert::instrument( } void cover_instrument_end_of_function( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const cover_instrumenter_baset::assertion_factoryt &make_assertion) { diff --git a/src/goto-instrument/dot.cpp b/src/goto-instrument/dot.cpp index 45da7c038cb..42668c4fc53 100644 --- a/src/goto-instrument/dot.cpp +++ b/src/goto-instrument/dot.cpp @@ -44,8 +44,7 @@ class dott std::list> function_calls; std::list clusters; - void - write_dot_subgraph(std::ostream &, const irep_idt &, const goto_programt &); + void write_dot_subgraph(std::ostream &, irep_idt, const goto_programt &); void do_dot_function_calls(std::ostream &); @@ -70,7 +69,7 @@ class dott /// \param goto_program: goto program the dot graph of which is written void dott::write_dot_subgraph( std::ostream &out, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) { clusters.push_back(exprt("cluster")); diff --git a/src/goto-instrument/dump_c.cpp b/src/goto-instrument/dump_c.cpp index 89e785ca3f3..6ad89df5638 100644 --- a/src/goto-instrument/dump_c.cpp +++ b/src/goto-instrument/dump_c.cpp @@ -32,7 +32,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "goto_program2code.h" -static std::string clean_identifier(const irep_idt &id) +static std::string clean_identifier(irep_idt id) { std::string result; result.reserve(id2string(id).size()); @@ -1194,9 +1194,9 @@ void dump_ct::convert_function_declaration( } static bool find_block_position_rec( - const irep_idt &identifier, + irep_idt identifier, codet &root, - code_blockt* &dest, + code_blockt *&dest, exprt::operandst::iterator &before) { if(!root.has_operands()) diff --git a/src/goto-instrument/dump_c_class.h b/src/goto-instrument/dump_c_class.h index 0fb1e2b3a06..6713b204ff9 100644 --- a/src/goto-instrument/dump_c_class.h +++ b/src/goto-instrument/dump_c_class.h @@ -117,7 +117,7 @@ class dump_ct const bool use_all_headers, const bool include_harness, const namespacet &_ns, - const irep_idt &mode, + irep_idt mode, const dump_c_configurationt config) : goto_functions(_goto_functions), copied_symbol_table(_ns.get_symbol_table()), @@ -136,7 +136,7 @@ class dump_ct const bool use_all_headers, const bool include_harness, const namespacet &_ns, - const irep_idt &mode) + irep_idt mode) : dump_ct( _goto_functions, use_system_headers, @@ -177,9 +177,7 @@ class dump_ct bool early; std::unordered_set dependencies; - explicit typedef_infot(const irep_idt &name): - typedef_name(name), - early(false) + explicit typedef_infot(irep_idt name) : typedef_name(name), early(false) { } }; @@ -196,9 +194,7 @@ class dump_ct return std::string(2*n, ' '); } - std::string make_decl( - const irep_idt &identifier, - const typet &type) + std::string make_decl(irep_idt identifier, const typet &type) { symbol_exprt sym(identifier, type); code_frontend_declt d(sym); diff --git a/src/goto-instrument/full_slicer.h b/src/goto-instrument/full_slicer.h index e18f37f1103..ab5cf56f637 100644 --- a/src/goto-instrument/full_slicer.h +++ b/src/goto-instrument/full_slicer.h @@ -37,9 +37,8 @@ class slicing_criteriont { public: virtual ~slicing_criteriont(); - virtual bool operator()( - const irep_idt &function_id, - goto_programt::const_targett) const = 0; + virtual bool + operator()(irep_idt function_id, goto_programt::const_targett) const = 0; }; void full_slicer( diff --git a/src/goto-instrument/full_slicer_class.h b/src/goto-instrument/full_slicer_class.h index 4ad06772ce6..342e83d40d6 100644 --- a/src/goto-instrument/full_slicer_class.h +++ b/src/goto-instrument/full_slicer_class.h @@ -111,8 +111,7 @@ class full_slicert class assert_criteriont:public slicing_criteriont { public: - virtual bool - operator()(const irep_idt &, goto_programt::const_targett target) const + virtual bool operator()(irep_idt, goto_programt::const_targett target) const { return target->is_assert(); } @@ -127,7 +126,7 @@ class in_function_criteriont : public slicing_criteriont } virtual bool - operator()(const irep_idt &function_id, goto_programt::const_targett) const + operator()(irep_idt function_id, goto_programt::const_targett) const { return function_id == target_function; } @@ -145,8 +144,7 @@ class properties_criteriont:public slicing_criteriont { } - virtual bool - operator()(const irep_idt &, goto_programt::const_targett target) const + virtual bool operator()(irep_idt, goto_programt::const_targett target) const { if(!target->is_assert()) return false; diff --git a/src/goto-instrument/function.cpp b/src/goto-instrument/function.cpp index 246c0ddec81..02e13f21d0b 100644 --- a/src/goto-instrument/function.cpp +++ b/src/goto-instrument/function.cpp @@ -21,8 +21,8 @@ Author: Daniel Kroening, kroening@kroening.com code_function_callt function_to_call( symbol_table_baset &symbol_table, - const irep_idt &id, - const irep_idt &argument) + irep_idt id, + irep_idt argument) { // already there? @@ -74,9 +74,7 @@ code_function_callt function_to_call( return call; } -void function_enter( - goto_modelt &goto_model, - const irep_idt &id) +void function_enter(goto_modelt &goto_model, irep_idt id) { for(auto &gf_entry : goto_model.goto_functions.function_map) { @@ -99,9 +97,7 @@ void function_enter( } } -void function_exit( - goto_modelt &goto_model, - const irep_idt &id) +void function_exit(goto_modelt &goto_model, irep_idt id) { for(auto &gf_entry : goto_model.goto_functions.function_map) { diff --git a/src/goto-instrument/function.h b/src/goto-instrument/function.h index 98652f00641..6cae85ddb15 100644 --- a/src/goto-instrument/function.h +++ b/src/goto-instrument/function.h @@ -17,17 +17,11 @@ Author: Daniel Kroening, kroening@kroening.com class goto_modelt; class symbol_table_baset; -class code_function_callt function_to_call( - symbol_table_baset &, - const irep_idt &id, - const irep_idt &argument); - -void function_enter( - goto_modelt &, - const irep_idt &id); - -void function_exit( - goto_modelt &, - const irep_idt &id); +class code_function_callt +function_to_call(symbol_table_baset &, irep_idt id, irep_idt argument); + +void function_enter(goto_modelt &, irep_idt id); + +void function_exit(goto_modelt &, irep_idt id); #endif // CPROVER_GOTO_INSTRUMENT_FUNCTION_H diff --git a/src/goto-instrument/generate_function_bodies.cpp b/src/goto-instrument/generate_function_bodies.cpp index dc4c27de008..e3d289adb69 100644 --- a/src/goto-instrument/generate_function_bodies.cpp +++ b/src/goto-instrument/generate_function_bodies.cpp @@ -24,7 +24,7 @@ Author: Diffblue Ltd. void generate_function_bodiest::generate_function_body( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const + irep_idt function_name) const { PRECONDITION(!function.body_available()); generate_parameter_names(function, symbol_table, function_name); @@ -34,7 +34,7 @@ void generate_function_bodiest::generate_function_body( void generate_function_bodiest::generate_parameter_names( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const + irep_idt function_name) const { auto &function_symbol = symbol_table.get_writeable_ref(function_name); auto ¶meters = to_code_type(function_symbol.type).parameters(); @@ -71,7 +71,7 @@ class assume_false_generate_function_bodiest : public generate_function_bodiest void generate_function_body_impl( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const override + irep_idt function_name) const override { auto const &function_symbol = symbol_table.lookup_ref(function_name); source_locationt location = function_symbol.location; @@ -88,7 +88,7 @@ class assert_false_generate_function_bodiest : public generate_function_bodiest void generate_function_body_impl( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const override + irep_idt function_name) const override { auto const &function_symbol = symbol_table.lookup_ref(function_name); @@ -112,7 +112,7 @@ class assert_false_then_assume_false_generate_function_bodiest void generate_function_body_impl( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const override + irep_idt function_name) const override { auto const &function_symbol = symbol_table.lookup_ref(function_name); @@ -164,7 +164,7 @@ class havoc_generate_function_bodiest : public generate_function_bodiest const exprt &lhs, const std::size_t initial_depth, const source_locationt &source_location, - const irep_idt &function_id, + irep_idt function_id, symbol_tablet &symbol_table, goto_programt &dest) const { @@ -218,7 +218,7 @@ class havoc_generate_function_bodiest : public generate_function_bodiest void generate_function_body_impl( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const override + irep_idt function_name) const override { const namespacet ns(symbol_table); // some user input checking diff --git a/src/goto-instrument/generate_function_bodies.h b/src/goto-instrument/generate_function_bodies.h index 11014c7d06f..68f04ccf4f6 100644 --- a/src/goto-instrument/generate_function_bodies.h +++ b/src/goto-instrument/generate_function_bodies.h @@ -33,7 +33,7 @@ class generate_function_bodiest virtual void generate_function_body_impl( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const = 0; + irep_idt function_name) const = 0; public: virtual ~generate_function_bodiest() = default; @@ -46,7 +46,7 @@ class generate_function_bodiest void generate_function_body( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const; + irep_idt function_name) const; private: /// Generate parameter names for unnamed parameters. @@ -55,7 +55,7 @@ class generate_function_bodiest void generate_parameter_names( goto_functiont &function, symbol_tablet &symbol_table, - const irep_idt &function_name) const; + irep_idt function_name) const; }; std::unique_ptr generate_function_bodies_factory( diff --git a/src/goto-instrument/goto_program2code.h b/src/goto-instrument/goto_program2code.h index 8bb837cb48a..f81473f97a3 100644 --- a/src/goto-instrument/goto_program2code.h +++ b/src/goto-instrument/goto_program2code.h @@ -51,7 +51,7 @@ class goto_program2codet public: goto_program2codet( - const irep_idt &identifier, + irep_idt identifier, const goto_programt &_goto_program, symbol_tablet &_symbol_table, code_blockt &_dest, @@ -81,7 +81,7 @@ class goto_program2codet void operator()(); protected: - const irep_idt &func_name; + irep_idt func_name; const goto_programt &goto_program; symbol_tablet &symbol_table; const namespacet ns; diff --git a/src/goto-instrument/interrupt.cpp b/src/goto-instrument/interrupt.cpp index cfc83340aec..4f54ee9c699 100644 --- a/src/goto-instrument/interrupt.cpp +++ b/src/goto-instrument/interrupt.cpp @@ -58,7 +58,7 @@ static bool potential_race_on_write( static void interrupt( value_setst &value_sets, const symbol_tablet &symbol_table, - const irep_idt &function_id, + irep_idt function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, #endif @@ -151,7 +151,7 @@ static void interrupt( } static symbol_exprt -get_isr(const symbol_tablet &symbol_table, const irep_idt &interrupt_handler) +get_isr(const symbol_tablet &symbol_table, irep_idt interrupt_handler) { std::list matches; @@ -188,7 +188,7 @@ get_isr(const symbol_tablet &symbol_table, const irep_idt &interrupt_handler) void interrupt( value_setst &value_sets, goto_modelt &goto_model, - const irep_idt &interrupt_handler, + irep_idt interrupt_handler, message_handlert &message_handler) { // look up the ISR diff --git a/src/goto-instrument/interrupt.h b/src/goto-instrument/interrupt.h index 9d2446a60b0..c50f79e8d06 100644 --- a/src/goto-instrument/interrupt.h +++ b/src/goto-instrument/interrupt.h @@ -23,7 +23,7 @@ class value_setst; void interrupt( value_setst &, goto_modelt &, - const irep_idt &interrupt_handler, + irep_idt interrupt_handler, message_handlert &); #endif // CPROVER_GOTO_INSTRUMENT_INTERRUPT_H diff --git a/src/goto-instrument/k_induction.cpp b/src/goto-instrument/k_induction.cpp index 05fcc37a6f1..826278c3e7d 100644 --- a/src/goto-instrument/k_induction.cpp +++ b/src/goto-instrument/k_induction.cpp @@ -24,7 +24,7 @@ class k_inductiont { public: k_inductiont( - const irep_idt &_function_id, + irep_idt _function_id, goto_functiont &_goto_function, bool _base_case, bool _step_case, @@ -43,7 +43,7 @@ class k_inductiont } protected: - const irep_idt &function_id; + irep_idt function_id; goto_functiont &goto_function; local_may_aliast local_may_alias; natural_loops_mutablet natural_loops; diff --git a/src/goto-instrument/mmio.cpp b/src/goto-instrument/mmio.cpp index 65ecad0c63b..158eb754d41 100644 --- a/src/goto-instrument/mmio.cpp +++ b/src/goto-instrument/mmio.cpp @@ -24,7 +24,7 @@ Date: September 2011 static void mmio( value_setst &value_sets, const symbol_tablet &symbol_table, - const irep_idt &function_id, + irep_idt function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, #endif diff --git a/src/goto-instrument/nondet_static.cpp b/src/goto-instrument/nondet_static.cpp index 56266f83372..cf52230bd44 100644 --- a/src/goto-instrument/nondet_static.cpp +++ b/src/goto-instrument/nondet_static.cpp @@ -80,10 +80,8 @@ bool is_nondet_initializable_static( /// \param [inout] goto_model: Existing goto-functions and symbol table to /// be updated. /// \param fct_name: Name of the goto-function to be updated. -static void nondet_static( - const namespacet &ns, - goto_modelt &goto_model, - const irep_idt &fct_name) +static void +nondet_static(const namespacet &ns, goto_modelt &goto_model, irep_idt fct_name) { goto_functionst::function_mapt::iterator fct_entry = goto_model.goto_functions.function_map.find(fct_name); diff --git a/src/goto-instrument/nondet_volatile.cpp b/src/goto-instrument/nondet_volatile.cpp index a8146df8806..f3cf83f73fd 100644 --- a/src/goto-instrument/nondet_volatile.cpp +++ b/src/goto-instrument/nondet_volatile.cpp @@ -73,12 +73,10 @@ class nondet_volatilet symbol_table_baset &symbol_table, goto_programt &goto_program); - const symbolt &typecheck_variable(const irep_idt &id, const namespacet &ns); + const symbolt &typecheck_variable(irep_idt id, const namespacet &ns); - void typecheck_model( - const irep_idt &id, - const symbolt &variable, - const namespacet &ns); + void + typecheck_model(irep_idt id, const symbolt &variable, const namespacet &ns); void typecheck_options(const optionst &options); @@ -269,7 +267,7 @@ void nondet_volatilet::nondet_volatile( } const symbolt & -nondet_volatilet::typecheck_variable(const irep_idt &id, const namespacet &ns) +nondet_volatilet::typecheck_variable(irep_idt id, const namespacet &ns) { const symbolt *symbol; @@ -297,7 +295,7 @@ nondet_volatilet::typecheck_variable(const irep_idt &id, const namespacet &ns) } void nondet_volatilet::typecheck_model( - const irep_idt &id, + irep_idt id, const symbolt &variable, const namespacet &ns) { diff --git a/src/goto-instrument/object_id.h b/src/goto-instrument/object_id.h index c6fee15c37f..4ce7a3fe6ac 100644 --- a/src/goto-instrument/object_id.h +++ b/src/goto-instrument/object_id.h @@ -29,7 +29,7 @@ class object_idt id = symbol_expr.identifier(); } - explicit object_idt(const irep_idt &identifier) + explicit object_idt(irep_idt identifier) { id=identifier; } diff --git a/src/goto-instrument/race_check.cpp b/src/goto-instrument/race_check.cpp index 6a4c48e493f..55d4a81fd02 100644 --- a/src/goto-instrument/race_check.cpp +++ b/src/goto-instrument/race_check.cpp @@ -40,9 +40,9 @@ class w_guardst std::list w_guards; - const symbolt &get_guard_symbol(const irep_idt &object); + const symbolt &get_guard_symbol(irep_idt object); - const exprt get_guard_symbol_expr(const irep_idt &object) + const exprt get_guard_symbol_expr(irep_idt object) { return get_guard_symbol(object).symbol_expr(); } @@ -63,7 +63,7 @@ class w_guardst symbol_table_baset &symbol_table; }; -const symbolt &w_guardst::get_guard_symbol(const irep_idt &object) +const symbolt &w_guardst::get_guard_symbol(irep_idt object) { const irep_idt identifier=id2string(object)+"$w_guard"; @@ -160,7 +160,7 @@ static bool has_shared_entries(const namespacet &ns, const rw_set_baset &rw_set) static void race_check( value_setst &value_sets, symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, L_M_ARG(const goto_functionst::goto_functiont &goto_function) goto_programt &goto_program, w_guardst &w_guards, @@ -269,7 +269,7 @@ static void race_check( void race_check( value_setst &value_sets, symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, #endif diff --git a/src/goto-instrument/race_check.h b/src/goto-instrument/race_check.h index e4d6daa3443..23946919e27 100644 --- a/src/goto-instrument/race_check.h +++ b/src/goto-instrument/race_check.h @@ -28,7 +28,7 @@ class value_setst; void race_check( value_setst &, class symbol_table_baset &, - const irep_idt &function_id, + irep_idt function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, #endif diff --git a/src/goto-instrument/remove_function.cpp b/src/goto-instrument/remove_function.cpp index 2b7ab9119b8..be79df7756f 100644 --- a/src/goto-instrument/remove_function.cpp +++ b/src/goto-instrument/remove_function.cpp @@ -27,7 +27,7 @@ Date: April 2017 /// message_handler Error/status output void remove_function( goto_modelt &goto_model, - const irep_idt &identifier, + irep_idt identifier, message_handlert &message_handler) { messaget message(message_handler); diff --git a/src/goto-instrument/remove_function.h b/src/goto-instrument/remove_function.h index 9130908af17..27fa7bcfb85 100644 --- a/src/goto-instrument/remove_function.h +++ b/src/goto-instrument/remove_function.h @@ -22,10 +22,7 @@ Date: April 2017 class goto_modelt; class message_handlert; -void remove_function( - goto_modelt &, - const irep_idt &identifier, - message_handlert &); +void remove_function(goto_modelt &, irep_idt identifier, message_handlert &); void remove_functions( goto_modelt &, diff --git a/src/goto-instrument/rw_set.h b/src/goto-instrument/rw_set.h index 3eefa66b554..275dafdddd5 100644 --- a/src/goto-instrument/rw_set.h +++ b/src/goto-instrument/rw_set.h @@ -49,7 +49,7 @@ class rw_set_baset entryt( const symbol_exprt &_symbol_expr, - const irep_idt &_object, + irep_idt _object, const exprt &_guard) : symbol_expr(_symbol_expr), object(_object), guard(_guard) { @@ -130,7 +130,7 @@ class _rw_set_loct:public rw_set_baset _rw_set_loct( const namespacet &_ns, value_setst &_value_sets, - const irep_idt &_function_id, + irep_idt _function_id, goto_programt::const_targett _target, message_handlert &message_handler) : rw_set_baset(_ns, message_handler), @@ -199,7 +199,7 @@ class rw_set_loct:public _rw_set_loct rw_set_loct( const namespacet &_ns, value_setst &_value_sets, - const irep_idt &_function_id, + irep_idt _function_id, goto_programt::const_targett _target, message_handlert &message_handler) : _rw_set_loct(_ns, _value_sets, _function_id, _target, message_handler) @@ -270,7 +270,7 @@ class rw_set_with_trackt:public _rw_set_loct rw_set_with_trackt( const namespacet &_ns, value_setst &_value_sets, - const irep_idt &_function_id, + irep_idt _function_id, goto_programt::const_targett _target, message_handlert &message_handler) : _rw_set_loct(_ns, _value_sets, _function_id, _target, message_handler), diff --git a/src/goto-instrument/uninitialized.cpp b/src/goto-instrument/uninitialized.cpp index 93c1e13d879..4bc5126d1a0 100644 --- a/src/goto-instrument/uninitialized.cpp +++ b/src/goto-instrument/uninitialized.cpp @@ -23,9 +23,7 @@ class uninitializedt { } - void add_assertions( - const irep_idt &function_identifer, - goto_programt &goto_program); + void add_assertions(irep_idt function_identifer, goto_programt &goto_program); protected: symbol_table_baset &symbol_table; @@ -61,7 +59,7 @@ void uninitializedt::get_tracking(goto_programt::const_targett i_it) } void uninitializedt::add_assertions( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_programt &goto_program) { uninitialized_analysis(function_identifier, goto_program, ns); diff --git a/src/goto-instrument/unwind.cpp b/src/goto-instrument/unwind.cpp index 88936c78983..f5b93cde684 100644 --- a/src/goto-instrument/unwind.cpp +++ b/src/goto-instrument/unwind.cpp @@ -81,7 +81,7 @@ void goto_unwindt::copy_segment( } void goto_unwindt::unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const goto_programt::const_targett loop_head, const goto_programt::const_targett loop_exit, @@ -100,7 +100,7 @@ void goto_unwindt::unwind( } void goto_unwindt::unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const goto_programt::const_targett loop_head, const goto_programt::const_targett loop_exit, @@ -279,7 +279,7 @@ void goto_unwindt::unwind( } void goto_unwindt::unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const unwindsett &unwindset, const unwind_strategyt unwind_strategy) diff --git a/src/goto-instrument/unwind.h b/src/goto-instrument/unwind.h index 71736d80310..4b83448699f 100644 --- a/src/goto-instrument/unwind.h +++ b/src/goto-instrument/unwind.h @@ -33,7 +33,7 @@ class goto_unwindt // unwind loop void unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const goto_programt::const_targett loop_head, const goto_programt::const_targett loop_exit, @@ -41,7 +41,7 @@ class goto_unwindt const unwind_strategyt unwind_strategy); void unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const goto_programt::const_targett loop_head, const goto_programt::const_targett loop_exit, @@ -52,7 +52,7 @@ class goto_unwindt // unwind function void unwind( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, const unwindsett &unwindset, const unwind_strategyt unwind_strategy = unwind_strategyt::PARTIAL); diff --git a/src/goto-instrument/wmm/goto2graph.cpp b/src/goto-instrument/wmm/goto2graph.cpp index 94955668ee0..12878bfdb53 100644 --- a/src/goto-instrument/wmm/goto2graph.cpp +++ b/src/goto-instrument/wmm/goto2graph.cpp @@ -30,7 +30,7 @@ Date: 2012 /// is local variable? -bool inline instrumentert::local(const irep_idt &id) +bool inline instrumentert::local(irep_idt id) { std::string identifier=id2string(id); @@ -78,7 +78,7 @@ bool inline instrumentert::local(const irep_idt &id) } } -bool inline instrumentert::cfg_visitort::local(const irep_idt &i) +bool inline instrumentert::cfg_visitort::local(irep_idt i) { return instrumenter.local(i); } @@ -150,7 +150,7 @@ void instrumentert::cfg_visitort::visit_cfg_function( memory_modelt model, bool no_dependencies, loop_strategyt replicate_body, - const irep_idt &function_id, + irep_idt function_id, std::set &ending_vertex) { /* flow: egraph */ @@ -406,7 +406,7 @@ event_idt alt_copy_segment(wmm_grapht &alt_egraph, } bool instrumentert::cfg_visitort::contains_shared_array( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett targ, goto_programt::const_targett i_it, value_setst &value_sets @@ -414,7 +414,7 @@ bool instrumentert::cfg_visitort::contains_shared_array( , local_may_aliast local_may #endif - ) const // NOLINT(whitespace/parens) +) const // NOLINT(whitespace/parens) { instrumenter.message.debug() << "contains_shared_array called for " << targ->source_location().get_line() @@ -462,7 +462,7 @@ bool instrumentert::cfg_visitort::contains_shared_array( /// strategy: fwd/bwd alternation void inline instrumentert::cfg_visitort::visit_cfg_body( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, goto_programt::const_targett i_it, loop_strategyt replicate_body, @@ -647,7 +647,7 @@ void inline instrumentert::cfg_visitort::visit_cfg_backedge( } void instrumentert::cfg_visitort::visit_cfg_goto( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, goto_programt::instructionst::iterator i_it, loop_strategyt replicate_body, @@ -748,7 +748,7 @@ void instrumentert::cfg_visitort::visit_cfg_function_call( void instrumentert::cfg_visitort::visit_cfg_lwfence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id) + irep_idt function_id) { const goto_programt::instructiont &instruction=*i_it; const abstract_eventt new_fence_event( @@ -787,7 +787,7 @@ void instrumentert::cfg_visitort::visit_cfg_lwfence( void instrumentert::cfg_visitort::visit_cfg_asm_fence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id) + irep_idt function_id) { const goto_programt::instructiont &instruction=*i_it; bool WRfence = instruction.code().get_bool(ID_WRfence); @@ -840,7 +840,7 @@ void instrumentert::cfg_visitort::visit_cfg_asm_fence( void instrumentert::cfg_visitort::visit_cfg_assign( value_setst &value_sets, - const irep_idt &function_id, + irep_idt function_id, goto_programt::instructionst::iterator &i_it, bool no_dependencies #ifdef LOCAL_MAY @@ -1177,7 +1177,7 @@ void instrumentert::cfg_visitort::visit_cfg_assign( void instrumentert::cfg_visitort::visit_cfg_fence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id) + irep_idt function_id) { const goto_programt::instructiont &instruction=*i_it; const abstract_eventt new_fence_event( diff --git a/src/goto-instrument/wmm/goto2graph.h b/src/goto-instrument/wmm/goto2graph.h index d864ac99461..6e8b26e8126 100644 --- a/src/goto-instrument/wmm/goto2graph.h +++ b/src/goto-instrument/wmm/goto2graph.h @@ -46,7 +46,7 @@ class instrumentert bool render_by_file; bool render_by_function; - bool inline local(const irep_idt &id); + bool inline local(irep_idt id); void inline add_instr_to_interleaving( goto_programt::instructionst::iterator it, @@ -99,7 +99,7 @@ class instrumentert unsigned coming_from; bool contains_shared_array( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett targ, goto_programt::const_targett i_it, value_setst &value_sets @@ -107,13 +107,13 @@ class instrumentert , local_may_aliast local_may #endif - ) const; // NOLINT(whitespace/parens) + ) const; // NOLINT(whitespace/parens) /* transformers */ void visit_cfg_thread() const; void visit_cfg_propagate(goto_programt::instructionst::iterator i_it); void visit_cfg_body( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, goto_programt::const_targett i_it, loop_strategyt replicate_body, @@ -131,7 +131,7 @@ class instrumentert goto_programt::const_targett i_it); void visit_cfg_assign( value_setst &value_sets, - const irep_idt &function_id, + irep_idt function_id, goto_programt::instructionst::iterator &i_it, bool no_dependencies #ifdef LOCAL_MAY @@ -141,21 +141,21 @@ class instrumentert ); // NOLINT(whitespace/parens) void visit_cfg_fence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id); + irep_idt function_id); void visit_cfg_skip(goto_programt::instructionst::iterator i_it); void visit_cfg_lwfence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id); + irep_idt function_id); void visit_cfg_asm_fence( goto_programt::instructionst::iterator i_it, - const irep_idt &function_id); + irep_idt function_id); void visit_cfg_function_call(value_setst &value_sets, goto_programt::instructionst::iterator i_it, memory_modelt model, bool no_dependenciess, loop_strategyt duplicate_body); void visit_cfg_goto( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, goto_programt::instructionst::iterator i_it, /* forces the duplication of all the loops, with array or not @@ -244,14 +244,14 @@ class instrumentert coming_from = 0; } - void inline enter_function(const irep_idt &function_id) + void inline enter_function(irep_idt function_id) { if(functions_met.find(function_id) != functions_met.end()) throw "sorry, doesn't handle recursive function for the moment"; functions_met.insert(function_id); } - void inline leave_function(const irep_idt &function_id) + void inline leave_function(irep_idt function_id) { functions_met.erase(function_id); } @@ -261,7 +261,7 @@ class instrumentert memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, - const irep_idt &function_id) + irep_idt function_id) { /* ignore recursive calls -- underapproximation */ try @@ -297,10 +297,10 @@ class instrumentert memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, - const irep_idt &function_id, + irep_idt function_id, std::set &ending_vertex); - bool inline local(const irep_idt &i); + bool inline local(irep_idt i); }; public: diff --git a/src/goto-instrument/wmm/shared_buffers.cpp b/src/goto-instrument/wmm/shared_buffers.cpp index 55adf6f536c..9e5639cef5c 100644 --- a/src/goto-instrument/wmm/shared_buffers.cpp +++ b/src/goto-instrument/wmm/shared_buffers.cpp @@ -28,8 +28,7 @@ std::string shared_bufferst::unique(void) } /// instruments the variable -const shared_bufferst::varst &shared_bufferst::operator()( - const irep_idt &object) +const shared_bufferst::varst &shared_bufferst::operator()(irep_idt object) { var_mapt::const_iterator it=var_map.find(object); if(it!=var_map.end()) @@ -141,7 +140,7 @@ void shared_bufferst::assignment( goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &id_lhs, + irep_idt id_lhs, const exprt &value) { const namespacet ns(symbol_table); @@ -177,8 +176,8 @@ void shared_bufferst::delay_read( goto_programt &goto_program, goto_programt::targett &target, const source_locationt &source_location, - const irep_idt &read_object, - const irep_idt &write_object) + irep_idt read_object, + irep_idt write_object) { /* option 1: */ /* trick using an additional variable whose value is to be defined later */ @@ -226,7 +225,7 @@ void shared_bufferst::flush_read( goto_programt &goto_program, goto_programt::targett &target, const source_locationt &source_location, - const irep_idt &write_object) + irep_idt write_object) { #if 0 // option 1 @@ -266,7 +265,7 @@ void shared_bufferst::write( goto_programt &goto_program, goto_programt::targett &target, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, goto_programt::instructiont &original_instruction, const unsigned current_thread) { @@ -328,7 +327,7 @@ void shared_bufferst::det_flush( goto_programt &goto_program, goto_programt::targett &target, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, const unsigned current_thread) { const std::string identifier=id2string(object); @@ -431,11 +430,11 @@ void shared_bufferst::det_flush( /// instruments read void shared_bufferst::nondet_flush( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &target, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, const unsigned current_thread, const bool tso_pso_rmo) // true: tso/pso/rmo; false: power { @@ -1047,7 +1046,7 @@ void shared_bufferst::affected_by_delay( /// instruments the program for the pairs detected through the CFG void shared_bufferst::cfg_visitort::weak_memory( value_setst &value_sets, - const irep_idt &function_id, + irep_idt function_id, memory_modelt model) { shared_buffers.message.debug() diff --git a/src/goto-instrument/wmm/shared_buffers.h b/src/goto-instrument/wmm/shared_buffers.h index 729892b7700..f13a29d7f62 100644 --- a/src/goto-instrument/wmm/shared_buffers.h +++ b/src/goto-instrument/wmm/shared_buffers.h @@ -86,7 +86,7 @@ class shared_bufferst // events in cycles: var->locations (for read instrumentations) std::multimap cycles_r_loc; - const varst &operator()(const irep_idt &object); + const varst &operator()(irep_idt object); void add_initialization_code(goto_functionst &goto_functions); @@ -94,20 +94,20 @@ class shared_bufferst goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &read_object, - const irep_idt &write_object); + irep_idt read_object, + irep_idt write_object); void flush_read( goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &write_object); + irep_idt write_object); void write( goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, goto_programt::instructiont &original_instruction, const unsigned current_thread); @@ -115,15 +115,15 @@ class shared_bufferst goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, const unsigned current_thread); void nondet_flush( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &object, + irep_idt object, const unsigned current_thread, const bool tso_pso_rmo); @@ -131,22 +131,22 @@ class shared_bufferst goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &id_lhs, + irep_idt id_lhs, const exprt &rhs); void assignment( goto_programt &goto_program, goto_programt::targett &t, const source_locationt &source_location, - const irep_idt &id_lhs, - const irep_idt &id_rhs) + irep_idt id_lhs, + irep_idt id_rhs) { namespacet ns(symbol_table); assignment(goto_program, t, source_location, id_lhs, ns.lookup(id_rhs).symbol_expr()); } - bool track(const irep_idt &id) const + bool track(irep_idt id) const { namespacet ns(symbol_table); @@ -159,7 +159,7 @@ class shared_bufferst return true; } - irep_idt choice(const irep_idt &function_id, const std::string &suffix) + irep_idt choice(irep_idt function_id, const std::string &suffix) { const auto maybe_symbol = symbol_table.lookup(function_id); CHECK_RETURN(maybe_symbol); @@ -217,7 +217,7 @@ class shared_bufferst void weak_memory( value_setst &value_sets, - const irep_idt &function_id, + irep_idt function_id, memory_modelt model); }; diff --git a/src/goto-instrument/wmm/weak_memory.cpp b/src/goto-instrument/wmm/weak_memory.cpp index bf4b85c69fe..d82aaccde8a 100644 --- a/src/goto-instrument/wmm/weak_memory.cpp +++ b/src/goto-instrument/wmm/weak_memory.cpp @@ -38,7 +38,7 @@ Date: September 2011 void introduce_temporaries( value_setst &value_sets, symbol_tablet &symbol_table, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, diff --git a/src/goto-instrument/wmm/weak_memory.h b/src/goto-instrument/wmm/weak_memory.h index 9908a2a42de..477d25d5ea5 100644 --- a/src/goto-instrument/wmm/weak_memory.h +++ b/src/goto-instrument/wmm/weak_memory.h @@ -47,7 +47,7 @@ void weak_memory( void introduce_temporaries( value_setst &, symbol_tablet &, - const irep_idt &function, + irep_idt function, goto_programt &, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, diff --git a/src/goto-programs/abstract_goto_model.h b/src/goto-programs/abstract_goto_model.h index 150fe02a43f..68e7b5986d3 100644 --- a/src/goto-programs/abstract_goto_model.h +++ b/src/goto-programs/abstract_goto_model.h @@ -29,7 +29,7 @@ class abstract_goto_modelt /// \param id: function ID to query /// \return true if we can produce a function body, or false if we would leave /// it a bodyless stub. - virtual bool can_produce_function(const irep_idt &id) const = 0; + virtual bool can_produce_function(irep_idt id) const = 0; /// Get a GOTO function by name, or throw if no such function exists. /// May have side-effects on the GOTO function map provided by @@ -37,8 +37,8 @@ class abstract_goto_modelt /// so iterators pointing into either may be invalidated. /// \param id: function to get /// \return goto function - virtual const goto_functionst::goto_functiont &get_goto_function( - const irep_idt &id) = 0; + virtual const goto_functionst::goto_functiont & + get_goto_function(irep_idt id) = 0; /// Accessor to get a raw goto_functionst. Concurrent use of get_goto_function /// may invalidate iterators or otherwise surprise users by modifying the map diff --git a/src/goto-programs/class_hierarchy.cpp b/src/goto-programs/class_hierarchy.cpp index a58c2e3baf7..6fb64b0bbb9 100644 --- a/src/goto-programs/class_hierarchy.cpp +++ b/src/goto-programs/class_hierarchy.cpp @@ -82,7 +82,7 @@ class_hierarchy_grapht::idst class_hierarchy_grapht::ids_from_indices( /// \param c: The class to consider /// \return A list containing ids of all direct children of c. class_hierarchy_grapht::idst -class_hierarchy_grapht::get_direct_children(const irep_idt &c) const +class_hierarchy_grapht::get_direct_children(irep_idt c) const { const node_indext &node_index = nodes_by_name.at(c); const auto &child_indices = get_successors(node_index); @@ -90,9 +90,8 @@ class_hierarchy_grapht::get_direct_children(const irep_idt &c) const } /// Helper function for `get_children_trans` and `get_parents_trans` -class_hierarchy_grapht::idst class_hierarchy_grapht::get_other_reachable_ids( - const irep_idt &c, - bool forwards) const +class_hierarchy_grapht::idst +class_hierarchy_grapht::get_other_reachable_ids(irep_idt c, bool forwards) const { idst direct_child_ids; const node_indext &node_index = nodes_by_name.at(c); @@ -112,7 +111,7 @@ class_hierarchy_grapht::idst class_hierarchy_grapht::get_other_reachable_ids( /// \param c: The class to consider /// \return A list containing ids of all classes that eventually inherit from c. class_hierarchy_grapht::idst -class_hierarchy_grapht::get_children_trans(const irep_idt &c) const +class_hierarchy_grapht::get_children_trans(irep_idt c) const { return get_other_reachable_ids(c, true); } @@ -121,14 +120,12 @@ class_hierarchy_grapht::get_children_trans(const irep_idt &c) const /// \param c: The class to consider /// \return A list of class ids that c eventually inherits from. class_hierarchy_grapht::idst -class_hierarchy_grapht::get_parents_trans(const irep_idt &c) const +class_hierarchy_grapht::get_parents_trans(irep_idt c) const { return get_other_reachable_ids(c, false); } -void class_hierarchyt::get_children_trans_rec( - const irep_idt &c, - idst &dest) const +void class_hierarchyt::get_children_trans_rec(irep_idt c, idst &dest) const { class_mapt::const_iterator it=class_map.find(c); if(it==class_map.end()) @@ -176,9 +173,7 @@ void class_hierarchyt::operator()(const symbol_table_baset &symbol_table) /// the order is all the parents of the first immediate parent /// \param c: The class to consider /// \param [out] dest: A list of class ids that c eventually inherits from. -void class_hierarchyt::get_parents_trans_rec( - const irep_idt &c, - idst &dest) const +void class_hierarchyt::get_parents_trans_rec(irep_idt c, idst &dest) const { class_mapt::const_iterator it=class_map.find(c); if(it==class_map.end()) diff --git a/src/goto-programs/class_hierarchy.h b/src/goto-programs/class_hierarchy.h index 7041f8c2571..6bc1cbce34d 100644 --- a/src/goto-programs/class_hierarchy.h +++ b/src/goto-programs/class_hierarchy.h @@ -63,7 +63,7 @@ class class_hierarchyt class_hierarchyt &operator=(const class_hierarchyt &) = delete; // transitively gets all children - idst get_children_trans(const irep_idt &id) const + idst get_children_trans(irep_idt id) const { idst result; get_children_trans_rec(id, result); @@ -71,7 +71,7 @@ class class_hierarchyt } // transitively gets all parents - idst get_parents_trans(const irep_idt &id) const + idst get_parents_trans(irep_idt id) const { idst result; get_parents_trans_rec(id, result); @@ -83,8 +83,8 @@ class class_hierarchyt void output(json_stream_arrayt &, bool children_only) const; protected: - void get_children_trans_rec(const irep_idt &, idst &) const; - void get_parents_trans_rec(const irep_idt &, idst &) const; + void get_children_trans_rec(irep_idt, idst &) const; + void get_parents_trans_rec(irep_idt, idst &) const; }; /// Class hierarchy graph node: simply contains a class identifier. @@ -114,11 +114,11 @@ class class_hierarchy_grapht : public grapht return nodes_by_name; } - idst get_direct_children(const irep_idt &c) const; + idst get_direct_children(irep_idt c) const; - idst get_children_trans(const irep_idt &c) const; + idst get_children_trans(irep_idt c) const; - idst get_parents_trans(const irep_idt &c) const; + idst get_parents_trans(irep_idt c) const; private: /// Maps class identifiers onto node indices @@ -126,7 +126,7 @@ class class_hierarchy_grapht : public grapht idst ids_from_indices(const std::vector &nodes) const; - idst get_other_reachable_ids(const irep_idt &c, bool forwards) const; + idst get_other_reachable_ids(irep_idt c, bool forwards) const; }; /// Output the class hierarchy diff --git a/src/goto-programs/goto_functions.h b/src/goto-programs/goto_functions.h index 73f8d06ba1d..b4843df9dc7 100644 --- a/src/goto-programs/goto_functions.h +++ b/src/goto-programs/goto_functions.h @@ -69,7 +69,7 @@ class goto_functionst /// Remove the function named \p name from the function map, if it exists. /// \return Returns 0 when \p name was not present, and 1 when \p name was /// removed. - std::size_t unload(const irep_idt &name) + std::size_t unload(irep_idt name) { return function_map.erase(name); } diff --git a/src/goto-programs/goto_inline_class.cpp b/src/goto-programs/goto_inline_class.cpp index c604403bb8d..72413ea39f0 100644 --- a/src/goto-programs/goto_inline_class.cpp +++ b/src/goto-programs/goto_inline_class.cpp @@ -23,7 +23,7 @@ Author: Daniel Kroening, kroening@kroening.com void goto_inlinet::parameter_assignments( const goto_programt::targett target, - const irep_idt &function_name, // name of called function + irep_idt function_name, // name of called function const goto_functiont::parameter_identifierst ¶meter_identifiers, const exprt::operandst &arguments, // arguments of call goto_programt &dest) diff --git a/src/goto-programs/goto_inline_class.h b/src/goto-programs/goto_inline_class.h index bb4b2e81f54..a881abae4cc 100644 --- a/src/goto-programs/goto_inline_class.h +++ b/src/goto-programs/goto_inline_class.h @@ -202,7 +202,7 @@ class goto_inlinet void parameter_assignments( const goto_programt::targett target, - const irep_idt &function_name, + irep_idt function_name, const goto_functiont::parameter_identifierst ¶meter_identifiers, const exprt::operandst &arguments, goto_programt &dest); diff --git a/src/goto-programs/goto_instruction_code.cpp b/src/goto-programs/goto_instruction_code.cpp index 65826ee8b7e..253c9912daa 100644 --- a/src/goto-programs/goto_instruction_code.cpp +++ b/src/goto-programs/goto_instruction_code.cpp @@ -30,7 +30,7 @@ code_inputt::code_inputt( } code_inputt::code_inputt( - const irep_idt &description, + irep_idt description, exprt expression, std::optional location) : code_inputt{ @@ -59,7 +59,7 @@ code_outputt::code_outputt( } code_outputt::code_outputt( - const irep_idt &description, + irep_idt description, exprt expression, std::optional location) : code_outputt{ diff --git a/src/goto-programs/goto_instruction_code.h b/src/goto-programs/goto_instruction_code.h index 298893c01eb..acd091d5873 100644 --- a/src/goto-programs/goto_instruction_code.h +++ b/src/goto-programs/goto_instruction_code.h @@ -422,7 +422,7 @@ class code_inputt : public goto_instruction_codet /// recorded as an input. /// \param location: A location to associate with this instruction. code_inputt( - const irep_idt &description, + irep_idt description, exprt expression, std::optional location = {}); @@ -468,7 +468,7 @@ class code_outputt : public goto_instruction_codet /// recorded as an output. /// \param location: A location to associate with this instruction. code_outputt( - const irep_idt &description, + irep_idt description, exprt expression, std::optional location = {}); diff --git a/src/goto-programs/goto_model.h b/src/goto-programs/goto_model.h index 7debed5795c..0044af5cf84 100644 --- a/src/goto-programs/goto_model.h +++ b/src/goto-programs/goto_model.h @@ -69,7 +69,7 @@ class goto_modelt : public abstract_goto_modelt /// Remove the function named \p name from the function map, if it exists. /// \return Returns 0 when \p name was not present, and 1 when \p name was /// removed. - std::size_t unload(const irep_idt &name) + std::size_t unload(irep_idt name) { return goto_functions.unload(name); } @@ -86,13 +86,12 @@ class goto_modelt : public abstract_goto_modelt return symbol_table; } - const goto_functionst::goto_functiont &get_goto_function( - const irep_idt &id) override + const goto_functionst::goto_functiont &get_goto_function(irep_idt id) override { return goto_functions.function_map.at(id); } - bool can_produce_function(const irep_idt &id) const override + bool can_produce_function(irep_idt id) const override { return goto_functions.function_map.find(id) != goto_functions.function_map.end(); @@ -142,13 +141,12 @@ class wrapper_goto_modelt : public abstract_goto_modelt return symbol_table; } - const goto_functionst::goto_functiont &get_goto_function( - const irep_idt &id) override + const goto_functionst::goto_functiont &get_goto_function(irep_idt id) override { return goto_functions.function_map.at(id); } - bool can_produce_function(const irep_idt &id) const override + bool can_produce_function(irep_idt id) const override { return goto_functions.function_map.find(id) != goto_functions.function_map.end(); @@ -201,12 +199,12 @@ class goto_model_functiont goto_model_functiont( journalling_symbol_tablet &symbol_table, goto_functionst &goto_functions, - const irep_idt &function_id, - goto_functionst::goto_functiont &goto_function): - symbol_table(symbol_table), - goto_functions(goto_functions), - function_id(function_id), - goto_function(goto_function) + irep_idt function_id, + goto_functionst::goto_functiont &goto_function) + : symbol_table(symbol_table), + goto_functions(goto_functions), + function_id(function_id), + goto_function(goto_function) { } diff --git a/src/goto-programs/goto_program.cpp b/src/goto-programs/goto_program.cpp index 360759e4a1e..ec351f9bfb5 100644 --- a/src/goto-programs/goto_program.cpp +++ b/src/goto-programs/goto_program.cpp @@ -514,7 +514,7 @@ std::list objects_written( std::string as_string( const class namespacet &ns, - const irep_idt &function, + irep_idt function, const goto_programt::instructiont &i) { std::string result; diff --git a/src/goto-programs/goto_program.h b/src/goto-programs/goto_program.h index 234d759f6c9..6057d24d3f1 100644 --- a/src/goto-programs/goto_program.h +++ b/src/goto-programs/goto_program.h @@ -787,8 +787,7 @@ class goto_programt void update(); /// Human-readable loop name - static irep_idt - loop_id(const irep_idt &function_id, const instructiont &instruction) + static irep_idt loop_id(irep_idt function_id, const instructiont &instruction) { return id2string(function_id) + "." + std::to_string(instruction.loop_number); @@ -1243,7 +1242,7 @@ std::list expressions_written(const goto_programt::instructiont &); std::string as_string( const namespacet &ns, - const irep_idt &function, + irep_idt function, const goto_programt::instructiont &); #endif // CPROVER_GOTO_PROGRAMS_GOTO_PROGRAM_H diff --git a/src/goto-programs/graphml_witness.cpp b/src/goto-programs/graphml_witness.cpp index e48b7aa6484..ba71fe7c229 100644 --- a/src/goto-programs/graphml_witness.cpp +++ b/src/goto-programs/graphml_witness.cpp @@ -32,7 +32,7 @@ Author: Daniel Kroening #include "goto_trace.h" static std::string -expr_to_string(const namespacet &ns, const irep_idt &id, const exprt &expr) +expr_to_string(const namespacet &ns, irep_idt id, const exprt &expr) { if(get_mode_from_identifier(ns, id) == ID_C) return expr2c(expr, ns, expr2c_configurationt::clean_configuration); @@ -72,7 +72,7 @@ void graphml_witnesst::remove_l0_l1(exprt &expr) } std::string graphml_witnesst::convert_assign_rec( - const irep_idt &identifier, + irep_idt identifier, const code_assignt &assign) { const auto cit = cache.find({identifier.get_no(), &assign.read()}); @@ -276,9 +276,8 @@ static bool contains_symbol_prefix(const exprt &expr, const std::string &prefix) /// Check if a function is built-in (CPROVER library), has no body, /// or does not exist in the symbol table -static bool is_function_built_in_or_extern( - const namespacet &ns, - const irep_idt &function_id) +static bool +is_function_built_in_or_extern(const namespacet &ns, irep_idt function_id) { const symbolt *symbol_ptr = nullptr; if(ns.lookup(function_id, symbol_ptr)) @@ -300,7 +299,7 @@ static bool is_function_built_in_or_extern( /// Note: scope is determined by the prefix before the first "::". This is /// correct for CBMC's C front-end where locals are named "function::N::var" /// and function_id is "function". JBMC does not use graphml witnesses. -static bool all_symbols_in_scope(const exprt &expr, const irep_idt &function_id) +static bool all_symbols_in_scope(const exprt &expr, irep_idt function_id) { find_symbols_sett symbols; find_symbols(expr, symbols); diff --git a/src/goto-programs/graphml_witness.h b/src/goto-programs/graphml_witness.h index 3192f00a73f..4434b662222 100644 --- a/src/goto-programs/graphml_witness.h +++ b/src/goto-programs/graphml_witness.h @@ -41,9 +41,8 @@ class graphml_witnesst graphmlt graphml; void remove_l0_l1(exprt &expr); - std::string convert_assign_rec( - const irep_idt &identifier, - const code_assignt &assign); + std::string + convert_assign_rec(irep_idt identifier, const code_assignt &assign); template static void hash_combine(std::size_t &seed, const T &v) diff --git a/src/goto-programs/initialize_goto_model.cpp b/src/goto-programs/initialize_goto_model.cpp index b7aada2c44f..86215af2545 100644 --- a/src/goto-programs/initialize_goto_model.cpp +++ b/src/goto-programs/initialize_goto_model.cpp @@ -114,7 +114,7 @@ void initialize_from_source_files( void set_up_custom_entry_point( language_filest &language_files, symbol_tablet &symbol_table, - const std::function &unload, + const std::function &unload, const optionst &options, bool try_mode_lookup, message_handlert &message_handler) @@ -207,7 +207,7 @@ goto_modelt initialize_goto_model( set_up_custom_entry_point( language_files, goto_model.symbol_table, - [&goto_model](const irep_idt &id) { return goto_model.unload(id); }, + [&goto_model](irep_idt id) { return goto_model.unload(id); }, options, true, message_handler); diff --git a/src/goto-programs/initialize_goto_model.h b/src/goto-programs/initialize_goto_model.h index 88849fe71ea..95ccffa9aa1 100644 --- a/src/goto-programs/initialize_goto_model.h +++ b/src/goto-programs/initialize_goto_model.h @@ -51,7 +51,7 @@ void initialize_from_source_files( void set_up_custom_entry_point( language_filest &language_files, symbol_tablet &symbol_table, - const std::function &unload, + const std::function &unload, const optionst &options, bool try_mode_lookup, message_handlert &message_handler); diff --git a/src/goto-programs/interpreter.cpp b/src/goto-programs/interpreter.cpp index 83ad4802f6c..7291b2ae253 100644 --- a/src/goto-programs/interpreter.cpp +++ b/src/goto-programs/interpreter.cpp @@ -445,7 +445,7 @@ interpretert::get_component(const typet &object_type, const mp_integer &offset) } /// returns the type object corresponding to id -typet interpretert::get_type(const irep_idt &id) const +typet interpretert::get_type(irep_idt id) const { dynamic_typest::const_iterator it=dynamic_types.find(id); if(it==dynamic_types.end()) @@ -1022,7 +1022,7 @@ mp_integer interpretert::get_size(const typet &type) return 1; } -exprt interpretert::get_value(const irep_idt &id) +exprt interpretert::get_value(irep_idt id) { // The dynamic type and the static symbol type may differ for VLAs, // where the symbol carries a size expression and the dynamic type diff --git a/src/goto-programs/interpreter_class.h b/src/goto-programs/interpreter_class.h index e873546db7a..1077dc837ab 100644 --- a/src/goto-programs/interpreter_class.h +++ b/src/goto-programs/interpreter_class.h @@ -201,7 +201,7 @@ class interpretert struct_typet::componentt get_component(const typet &object_type, const mp_integer &offset); - typet get_type(const irep_idt &id) const; + typet get_type(irep_idt id) const; exprt get_value( const typet &type, @@ -213,7 +213,7 @@ class interpretert mp_vectort &rhs, const mp_integer &offset=0); - exprt get_value(const irep_idt &id); + exprt get_value(irep_idt id); void step(); diff --git a/src/goto-programs/json_expr.cpp b/src/goto-programs/json_expr.cpp index 3af77d5e51a..53ed5bb193e 100644 --- a/src/goto-programs/json_expr.cpp +++ b/src/goto-programs/json_expr.cpp @@ -75,7 +75,7 @@ static exprt simplify_json_expr(const exprt &src) /// \param ns: a namespace /// \param mode: language in which the code was written /// \return a json object -json_objectt json(const typet &type, const namespacet &ns, const irep_idt &mode) +json_objectt json(const typet &type, const namespacet &ns, irep_idt mode) { json_objectt result; @@ -200,7 +200,7 @@ static std::string binary(const constant_exprt &src) /// \param ns: a namespace /// \param mode: language in which the code was written /// \return a json object -json_objectt json(const exprt &expr, const namespacet &ns, const irep_idt &mode) +json_objectt json(const exprt &expr, const namespacet &ns, irep_idt mode) { json_objectt result; diff --git a/src/goto-programs/json_expr.h b/src/goto-programs/json_expr.h index 3298003db23..763ee670f4c 100644 --- a/src/goto-programs/json_expr.h +++ b/src/goto-programs/json_expr.h @@ -19,8 +19,8 @@ class typet; class exprt; class namespacet; -json_objectt json(const exprt &, const namespacet &, const irep_idt &mode); +json_objectt json(const exprt &, const namespacet &, irep_idt mode); -json_objectt json(const typet &, const namespacet &, const irep_idt &mode); +json_objectt json(const typet &, const namespacet &, irep_idt mode); #endif // CPROVER_GOTO_PROGRAMS_JSON_EXPR_H diff --git a/src/goto-programs/loop_ids.cpp b/src/goto-programs/loop_ids.cpp index e3658577b91..465badc1439 100644 --- a/src/goto-programs/loop_ids.cpp +++ b/src/goto-programs/loop_ids.cpp @@ -27,7 +27,7 @@ void show_loop_ids( void show_loop_ids( ui_message_handlert::uit ui, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program) { switch(ui) @@ -72,7 +72,7 @@ void show_loop_ids( void show_loop_ids_json( ui_message_handlert::uit ui, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, json_arrayt &loops) { diff --git a/src/goto-programs/loop_ids.h b/src/goto-programs/loop_ids.h index dc8860fabb5..eee4c3644e2 100644 --- a/src/goto-programs/loop_ids.h +++ b/src/goto-programs/loop_ids.h @@ -26,7 +26,7 @@ class goto_programt; /// goto instruction. struct loop_idt { - loop_idt(const irep_idt &function_id, const unsigned int loop_number) + loop_idt(irep_idt function_id, const unsigned int loop_number) : function_id(function_id), loop_number(loop_number) { } @@ -63,7 +63,7 @@ void show_loop_ids( void show_loop_ids( ui_message_handlert::uit, - const irep_idt &function_id, + irep_idt function_id, const goto_programt &); #endif // CPROVER_GOTO_PROGRAMS_LOOP_IDS_H diff --git a/src/goto-programs/remove_function_pointers.cpp b/src/goto-programs/remove_function_pointers.cpp index 9e99580336f..6fb1f43c0ae 100644 --- a/src/goto-programs/remove_function_pointers.cpp +++ b/src/goto-programs/remove_function_pointers.cpp @@ -42,9 +42,8 @@ class remove_function_pointerst void operator()(goto_functionst &goto_functions); - bool remove_function_pointers( - goto_programt &goto_program, - const irep_idt &function_id); + bool + remove_function_pointers(goto_programt &goto_program, irep_idt function_id); protected: message_handlert &message_handler; @@ -67,7 +66,7 @@ class remove_function_pointerst /// \param target: location with function call with function pointer void remove_function_pointer( goto_programt &goto_program, - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett target); std::unordered_set address_taken; @@ -203,7 +202,7 @@ static void fix_argument_types(code_function_callt &function_call) } static void fix_return_type( - const irep_idt &in_function_id, + irep_idt in_function_id, code_function_callt &function_call, const source_locationt &source_location, symbol_tablet &symbol_table, @@ -245,7 +244,7 @@ static void fix_return_type( void remove_function_pointerst::remove_function_pointer( goto_programt &goto_program, - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett target) { const auto &function = to_dereference_expr(as_const(*target).call_function()); @@ -380,7 +379,7 @@ void remove_function_pointer( message_handlert &message_handler, symbol_tablet &symbol_table, goto_programt &goto_program, - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett target, const std::unordered_set &functions_set) { @@ -493,7 +492,7 @@ void remove_function_pointer( bool remove_function_pointerst::remove_function_pointers( goto_programt &goto_program, - const irep_idt &function_id) + irep_idt function_id) { bool did_something=false; diff --git a/src/goto-programs/remove_function_pointers.h b/src/goto-programs/remove_function_pointers.h index 2bcb72ba612..53230728f18 100644 --- a/src/goto-programs/remove_function_pointers.h +++ b/src/goto-programs/remove_function_pointers.h @@ -43,7 +43,7 @@ void remove_function_pointer( message_handlert &message_handler, symbol_tablet &symbol_table, goto_programt &goto_program, - const irep_idt &function_id, + irep_idt function_id, goto_programt::targett target, const std::unordered_set &functions); diff --git a/src/goto-programs/remove_returns.cpp b/src/goto-programs/remove_returns.cpp index 4c80d68167d..b5370d20316 100644 --- a/src/goto-programs/remove_returns.cpp +++ b/src/goto-programs/remove_returns.cpp @@ -46,25 +46,24 @@ class remove_returnst symbol_table_baset &symbol_table; void replace_returns( - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &function); bool do_function_calls( function_is_stubt function_is_stub, goto_programt &goto_program); - bool - restore_returns(const irep_idt &function_id, goto_programt &goto_program); + bool restore_returns(irep_idt function_id, goto_programt &goto_program); void undo_function_calls( goto_programt &goto_program); std::optional - get_or_create_return_value_symbol(const irep_idt &function_id); + get_or_create_return_value_symbol(irep_idt function_id); }; std::optional -remove_returnst::get_or_create_return_value_symbol(const irep_idt &function_id) +remove_returnst::get_or_create_return_value_symbol(irep_idt function_id) { const namespacet ns(symbol_table); const auto symbol_expr = return_value_symbol(function_id, ns); @@ -100,7 +99,7 @@ remove_returnst::get_or_create_return_value_symbol(const irep_idt &function_id) /// \param function_id: name of the function to transform /// \param function: function to transform void remove_returnst::replace_returns( - const irep_idt &function_id, + irep_idt function_id, goto_functionst::goto_functiont &function) { // look up the function symbol @@ -220,7 +219,8 @@ void remove_returnst::operator()(goto_functionst &goto_functions) for(auto &gf_entry : goto_functions.function_map) { // NOLINTNEXTLINE - auto function_is_stub = [&goto_functions](const irep_idt &function_id) { + auto function_is_stub = [&goto_functions](irep_idt function_id) + { auto findit = goto_functions.function_map.find(function_id); INVARIANT( findit != goto_functions.function_map.end(), @@ -292,7 +292,7 @@ void remove_returns(goto_modelt &goto_model) /// turns an assignment to fkt#return_value back into 'return x' bool remove_returnst::restore_returns( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program) { // do we have X#return_value? @@ -404,20 +404,19 @@ void restore_returns(goto_modelt &goto_model) rr.restore(goto_model.goto_functions); } -irep_idt return_value_identifier(const irep_idt &identifier) +irep_idt return_value_identifier(irep_idt identifier) { return id2string(identifier) + RETURN_VALUE_SUFFIX; } -symbol_exprt -return_value_symbol(const irep_idt &identifier, const namespacet &ns) +symbol_exprt return_value_symbol(irep_idt identifier, const namespacet &ns) { const symbolt &function_symbol = ns.lookup(identifier); const typet &return_type = to_code_type(function_symbol.type).return_type(); return symbol_exprt(return_value_identifier(identifier), return_type); } -bool is_return_value_identifier(const irep_idt &id) +bool is_return_value_identifier(irep_idt id) { return has_suffix(id2string(id), RETURN_VALUE_SUFFIX); } diff --git a/src/goto-programs/remove_returns.h b/src/goto-programs/remove_returns.h index 5474e7cc519..8a56e5b1561 100644 --- a/src/goto-programs/remove_returns.h +++ b/src/goto-programs/remove_returns.h @@ -85,7 +85,7 @@ class symbol_exprt; void remove_returns(symbol_table_baset &, goto_functionst &); -typedef std::function function_is_stubt; +typedef std::function function_is_stubt; void remove_returns(goto_model_functiont &, function_is_stubt); @@ -98,15 +98,15 @@ void restore_returns(goto_modelt &); /// produces the identifier that is used to store the return /// value of the function with the given identifier -irep_idt return_value_identifier(const irep_idt &); +irep_idt return_value_identifier(irep_idt); /// produces the symbol that is used to store the return /// value of the function with the given identifier -symbol_exprt return_value_symbol(const irep_idt &, const namespacet &); +symbol_exprt return_value_symbol(irep_idt, const namespacet &); /// Returns true if \p id is a special return-value symbol produced by /// \ref return_value_identifier -bool is_return_value_identifier(const irep_idt &id); +bool is_return_value_identifier(irep_idt id); /// Returns true if \p symbol_expr is a special return-value symbol produced by /// \ref return_value_symbol diff --git a/src/goto-programs/remove_unused_functions.cpp b/src/goto-programs/remove_unused_functions.cpp index d4f0fbdada3..6a41e6ab658 100644 --- a/src/goto-programs/remove_unused_functions.cpp +++ b/src/goto-programs/remove_unused_functions.cpp @@ -55,7 +55,7 @@ void remove_unused_functions( } void find_used_functions( - const irep_idt &start, + irep_idt start, goto_functionst &functions, std::set &seen) { diff --git a/src/goto-programs/remove_unused_functions.h b/src/goto-programs/remove_unused_functions.h index 56ac797c399..061ee2cdc70 100644 --- a/src/goto-programs/remove_unused_functions.h +++ b/src/goto-programs/remove_unused_functions.h @@ -29,7 +29,7 @@ void remove_unused_functions( message_handlert &); void find_used_functions( - const irep_idt ¤t, + irep_idt current, goto_functionst &functions, std::set &seen); diff --git a/src/goto-programs/remove_virtual_functions.cpp b/src/goto-programs/remove_virtual_functions.cpp index e3d9822813c..cceba821609 100644 --- a/src/goto-programs/remove_virtual_functions.cpp +++ b/src/goto-programs/remove_virtual_functions.cpp @@ -43,19 +43,16 @@ class get_virtual_calleest const class_hierarchyt &class_hierarchy; - typedef std::function< - std::optional( - const irep_idt &, - const irep_idt &)> + typedef std::function(irep_idt, irep_idt)> function_call_resolvert; void get_child_functions_rec( - const irep_idt &, + irep_idt, const std::optional &, - const irep_idt &, + irep_idt, dispatch_table_entriest &, dispatch_table_entries_mapt &) const; - exprt - get_method(const irep_idt &class_id, const irep_idt &component_name) const; + exprt get_method(irep_idt class_id, irep_idt component_name) const; }; class remove_virtual_functionst @@ -72,9 +69,8 @@ class remove_virtual_functionst void operator()(goto_functionst &functions); - bool remove_virtual_functions( - const irep_idt &function_id, - goto_programt &goto_program); + bool + remove_virtual_functions(irep_idt function_id, goto_programt &goto_program); private: const class_hierarchyt &class_hierarchy; @@ -82,7 +78,7 @@ class remove_virtual_functionst namespacet ns; goto_programt::targett remove_virtual_function( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett target); }; @@ -201,7 +197,7 @@ static goto_programt analyse_checks_directly_preceding_function_call( /// used for new instructions that are added /// \param [out] new_code_for_this_argument: New instructions are added here static void process_this_argument( - const irep_idt &function_id, + irep_idt function_id, const goto_programt &goto_program, const goto_programt::targett target, exprt &argument_for_this, @@ -264,7 +260,7 @@ static void process_this_argument( /// program after replaced function call static goto_programt::targett replace_virtual_function_with_dispatch_table( symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett target, const dispatch_table_entriest &functions, @@ -464,7 +460,7 @@ static goto_programt::targett replace_virtual_function_with_dispatch_table( /// \return Returns a pointer to the statement in the supplied GOTO /// program after replaced function call goto_programt::targett remove_virtual_functionst::remove_virtual_function( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett target) { @@ -504,9 +500,9 @@ goto_programt::targett remove_virtual_functionst::remove_virtual_function( /// -> [{"C", C.f}, {"B", C.f}, {"A", A.f}] /// \param entry_map: map of class identifiers to dispatch table entries void get_virtual_calleest::get_child_functions_rec( - const irep_idt &this_id, + irep_idt this_id, const std::optional &last_method_defn, - const irep_idt &component_name, + irep_idt component_name, dispatch_table_entriest &functions, dispatch_table_entries_mapt &entry_map) const { @@ -637,8 +633,8 @@ void get_virtual_calleest::get_functions( /// \return nil_exprt instance on error and a symbol_exprt pointing to /// the method on success exprt get_virtual_calleest::get_method( - const irep_idt &class_id, - const irep_idt &component_name) const + irep_idt class_id, + irep_idt component_name) const { const irep_idt &id= resolve_inherited_componentt::build_full_component_identifier( @@ -655,7 +651,7 @@ exprt get_virtual_calleest::get_method( /// them with calls to their most derived implementations. Returns /// true if at least one function has been replaced. bool remove_virtual_functionst::remove_virtual_functions( - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program) { bool did_something=false; @@ -807,7 +803,7 @@ void remove_virtual_functions( /// program after replaced function call goto_programt::targett remove_virtual_function( symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett instruction, const dispatch_table_entriest &dispatch_table, @@ -828,7 +824,7 @@ goto_programt::targett remove_virtual_function( goto_programt::targett remove_virtual_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett instruction, const dispatch_table_entriest &dispatch_table, diff --git a/src/goto-programs/remove_virtual_functions.h b/src/goto-programs/remove_virtual_functions.h index 5dd9d7d1e51..f0579b9f74d 100644 --- a/src/goto-programs/remove_virtual_functions.h +++ b/src/goto-programs/remove_virtual_functions.h @@ -68,7 +68,7 @@ enum class virtual_dispatch_fallback_actiont class dispatch_table_entryt { public: - explicit dispatch_table_entryt(const irep_idt &_class_id) + explicit dispatch_table_entryt(irep_idt _class_id) : symbol_expr(), class_id(_class_id) { } @@ -104,7 +104,7 @@ typedef std::map dispatch_table_entries_mapt; goto_programt::targett remove_virtual_function( goto_modelt &goto_model, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett instruction, const dispatch_table_entriest &dispatch_table, @@ -112,7 +112,7 @@ goto_programt::targett remove_virtual_function( goto_programt::targett remove_virtual_function( symbol_table_baset &symbol_table, - const irep_idt &function_id, + irep_idt function_id, goto_programt &goto_program, goto_programt::targett instruction, const dispatch_table_entriest &dispatch_table, diff --git a/src/goto-programs/resolve_inherited_component.cpp b/src/goto-programs/resolve_inherited_component.cpp index d3d855bbeff..9573291f9dc 100644 --- a/src/goto-programs/resolve_inherited_component.cpp +++ b/src/goto-programs/resolve_inherited_component.cpp @@ -34,8 +34,8 @@ resolve_inherited_componentt::resolve_inherited_componentt( /// \return The concrete component that has been resolved std::optional resolve_inherited_componentt::operator()( - const irep_idt &class_id, - const irep_idt &component_name, + irep_idt class_id, + irep_idt component_name, bool include_interfaces, const std::function user_filter) { @@ -92,7 +92,8 @@ resolve_inherited_componentt::operator()( /// \return A name for looking up in the symbol table for classes `class_name`'s /// component `component_name` irep_idt resolve_inherited_componentt::build_full_component_identifier( - const irep_idt &class_name, const irep_idt &component_name) + irep_idt class_name, + irep_idt component_name) { // Verify the parameters are called in the correct order. PRECONDITION(id2string(class_name).find("::")!=std::string::npos); @@ -124,8 +125,8 @@ irep_idt resolve_inherited_componentt::inherited_componentt:: /// \return The concrete component that has been resolved std::optional get_inherited_method_implementation( - const irep_idt &call_basename, - const irep_idt &classname, + irep_idt call_basename, + irep_idt classname, const symbol_table_baset &symbol_table) { resolve_inherited_componentt call_resolver{symbol_table}; diff --git a/src/goto-programs/resolve_inherited_component.h b/src/goto-programs/resolve_inherited_component.h index a15d61c68e5..d9f3ed2d32d 100644 --- a/src/goto-programs/resolve_inherited_component.h +++ b/src/goto-programs/resolve_inherited_component.h @@ -29,10 +29,8 @@ class resolve_inherited_componentt class inherited_componentt { public: - inherited_componentt( - const irep_idt &class_id, const irep_idt &component_id): - class_identifier(class_id), - component_identifier(component_id) + inherited_componentt(irep_idt class_id, irep_idt component_id) + : class_identifier(class_id), component_identifier(component_id) {} irep_idt get_full_component_identifier() const; @@ -48,15 +46,14 @@ class resolve_inherited_componentt }; std::optional operator()( - const irep_idt &class_id, - const irep_idt &component_name, + irep_idt class_id, + irep_idt component_name, bool include_interfaces, - std::function user_filter = [](const symbolt &) { - return true; - }); + std::function user_filter = [](const symbolt &) + { return true; }); - static irep_idt build_full_component_identifier( - const irep_idt &class_name, const irep_idt &component_name); + static irep_idt + build_full_component_identifier(irep_idt class_name, irep_idt component_name); private: const symbol_table_baset &symbol_table; @@ -64,8 +61,8 @@ class resolve_inherited_componentt std::optional get_inherited_method_implementation( - const irep_idt &call_basename, - const irep_idt &classname, + irep_idt call_basename, + irep_idt classname, const symbol_table_baset &symbol_table); #endif // CPROVER_GOTO_PROGRAMS_RESOLVE_INHERITED_COMPONENT_H diff --git a/src/goto-programs/restrict_function_pointers.cpp b/src/goto-programs/restrict_function_pointers.cpp index ec7a01fa037..fddb6bfe5fe 100644 --- a/src/goto-programs/restrict_function_pointers.cpp +++ b/src/goto-programs/restrict_function_pointers.cpp @@ -39,7 +39,7 @@ void for_each_function_call(GotoFunctionT &&goto_function, Handler handler) message_handlert &message_handler, symbol_tablet &symbol_table, goto_programt &goto_program, - const irep_idt &function_id, + irep_idt function_id, const function_pointer_restrictionst &restrictions, const goto_programt::targett &location) { diff --git a/src/goto-programs/show_goto_functions_json.cpp b/src/goto-programs/show_goto_functions_json.cpp index 2d0e26d5eda..8d41826b53f 100644 --- a/src/goto-programs/show_goto_functions_json.cpp +++ b/src/goto-programs/show_goto_functions_json.cpp @@ -53,7 +53,7 @@ json_objectt show_goto_functions_jsont::convert( make_range( function.parameter_identifiers.begin(), function.parameter_identifiers.end()) - .map([](const irep_idt &id) { return json_stringt{id}; }); + .map([](irep_idt id) { return json_stringt{id}; }); json_function["parameterIdentifiers"] = json_arrayt{ json_parameter_id_range.begin(), json_parameter_id_range.end()}; @@ -117,7 +117,7 @@ json_objectt show_goto_functions_jsont::convert( { auto json_label_range = make_range(instruction.labels.begin(), instruction.labels.end()) - .map([](const irep_idt &id) { return json_stringt{id}; }); + .map([](irep_idt id) { return json_stringt{id}; }); instruction_entry["labels"] = json_arrayt{json_label_range.begin(), json_label_range.end()}; } diff --git a/src/goto-programs/show_properties.cpp b/src/goto-programs/show_properties.cpp index 38e46131f50..b25447c0ba5 100644 --- a/src/goto-programs/show_properties.cpp +++ b/src/goto-programs/show_properties.cpp @@ -20,7 +20,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "goto_model.h" std::optional -find_property(const irep_idt &property, const goto_functionst &goto_functions) +find_property(irep_idt property, const goto_functionst &goto_functions) { for(const auto &fct : goto_functions.function_map) { @@ -42,7 +42,7 @@ find_property(const irep_idt &property, const goto_functionst &goto_functions) void show_properties( const namespacet &ns, - const irep_idt &identifier, + irep_idt identifier, message_handlert &message_handler, ui_message_handlert::uit ui, const goto_programt &goto_program) @@ -126,7 +126,7 @@ void show_properties( void convert_properties_json( json_arrayt &json_properties, const namespacet &ns, - const irep_idt &identifier, + irep_idt identifier, const goto_programt &goto_program) { for(const auto &ins : goto_program.instructions) diff --git a/src/goto-programs/show_properties.h b/src/goto-programs/show_properties.h index 1a7cfa494ca..e9098bf1808 100644 --- a/src/goto-programs/show_properties.h +++ b/src/goto-programs/show_properties.h @@ -47,7 +47,7 @@ void show_properties( /// \return optional the location of the /// property, if found. std::optional -find_property(const irep_idt &property, const goto_functionst &goto_functions); +find_property(irep_idt property, const goto_functionst &goto_functions); /// \brief Collects the properties in the goto program into a `json_arrayt` /// \param json_properties: JSON array to hold the properties @@ -57,7 +57,7 @@ find_property(const irep_idt &property, const goto_functionst &goto_functions); void convert_properties_json( json_arrayt &json_properties, const namespacet &ns, - const irep_idt &identifier, + irep_idt identifier, const goto_programt &goto_program); #endif // CPROVER_GOTO_PROGRAMS_SHOW_PROPERTIES_H diff --git a/src/goto-programs/string_abstraction.cpp b/src/goto-programs/string_abstraction.cpp index 6de670c1794..52666a0f8ef 100644 --- a/src/goto-programs/string_abstraction.cpp +++ b/src/goto-programs/string_abstraction.cpp @@ -219,7 +219,7 @@ void string_abstractiont::add_str_parameters( code_typet::parametert string_abstractiont::add_parameter( const symbolt &fct_symbol, const typet &type, - const irep_idt &identifier) + irep_idt identifier) { typet final_type=is_ptr_argument(type)? type:pointer_type(type); @@ -298,10 +298,11 @@ void string_abstractiont::declare_define_locals(goto_programt &dest) } } -void string_abstractiont::make_decl_and_def(goto_programt &dest, - goto_programt::targett ref_instr, - const irep_idt &identifier, - const irep_idt &source_sym) +void string_abstractiont::make_decl_and_def( + goto_programt &dest, + goto_programt::targett ref_instr, + irep_idt identifier, + irep_idt source_sym) { const symbolt &symbol=ns.lookup(identifier); symbol_exprt sym_expr=symbol.symbol_expr(); @@ -395,12 +396,12 @@ exprt string_abstractiont::make_val_or_dummy_rec(goto_programt &dest, } symbol_exprt string_abstractiont::add_dummy_symbol_and_value( - goto_programt &dest, - goto_programt::targett ref_instr, - const symbolt &symbol, - const irep_idt &component_name, - const typet &type, - const typet &source_type) + goto_programt &dest, + goto_programt::targett ref_instr, + const symbolt &symbol, + irep_idt component_name, + const typet &type, + const typet &source_type) { std::string suffix="$strdummy"; if(!component_name.empty()) @@ -1040,8 +1041,10 @@ bool string_abstractiont::build_symbol(const symbol_exprt &sym, exprt &dest) return false; } -void string_abstractiont::build_new_symbol(const symbolt &symbol, - const irep_idt &identifier, const typet &type) +void string_abstractiont::build_new_symbol( + const symbolt &symbol, + irep_idt identifier, + const typet &type) { if(!symbol.is_static_lifetime) locals[symbol.name]=identifier; diff --git a/src/goto-programs/string_abstraction.h b/src/goto-programs/string_abstraction.h index 596f3d5a038..a8a99a1c9b0 100644 --- a/src/goto-programs/string_abstraction.h +++ b/src/goto-programs/string_abstraction.h @@ -128,8 +128,10 @@ class string_abstractiont const typet &build_abstraction_type_rec(const typet &type, const abstraction_types_mapt &known); bool build_pointer(const exprt &object, exprt &dest, bool write); - void build_new_symbol(const symbolt &symbol, - const irep_idt &identifier, const typet &type); + void build_new_symbol( + const symbolt &symbol, + irep_idt identifier, + const typet &type); exprt member(const exprt &a, whatt what); @@ -149,10 +151,13 @@ class string_abstractiont code_typet::parametert add_parameter( const symbolt &fct_symbol, const typet &type, - const irep_idt &identifier); + irep_idt identifier); - void make_decl_and_def(goto_programt &dest, goto_programt::targett ref_instr, - const irep_idt &identifier, const irep_idt &source_sym); + void make_decl_and_def( + goto_programt &dest, + goto_programt::targett ref_instr, + irep_idt identifier, + irep_idt source_sym); exprt make_val_or_dummy_rec(goto_programt &dest, goto_programt::targett ref_instr, @@ -162,7 +167,7 @@ class string_abstractiont goto_programt &dest, goto_programt::targett ref_instr, const symbolt &symbol, - const irep_idt &component_name, + irep_idt component_name, const typet &type, const typet &source_type); diff --git a/src/goto-programs/unwindset.cpp b/src/goto-programs/unwindset.cpp index e214c21d27c..2b8bb2efed6 100644 --- a/src/goto-programs/unwindset.cpp +++ b/src/goto-programs/unwindset.cpp @@ -190,7 +190,7 @@ void unwindsett::parse_unwindset( } std::optional -unwindsett::get_limit(const irep_idt &loop_id, unsigned thread_nr) const +unwindsett::get_limit(irep_idt loop_id, unsigned thread_nr) const { // We use the most specific limit we have diff --git a/src/goto-programs/unwindset.h b/src/goto-programs/unwindset.h index a4af6e161ec..4126f8265c3 100644 --- a/src/goto-programs/unwindset.h +++ b/src/goto-programs/unwindset.h @@ -42,8 +42,7 @@ class unwindsett message_handlert &message_handler); // queries - std::optional - get_limit(const irep_idt &loop, unsigned thread_id) const; + std::optional get_limit(irep_idt loop, unsigned thread_id) const; // read unwindset directives from a file void parse_unwindset_file( diff --git a/src/goto-programs/xml_goto_trace.cpp b/src/goto-programs/xml_goto_trace.cpp index aac13610ced..b51f9159853 100644 --- a/src/goto-programs/xml_goto_trace.cpp +++ b/src/goto-programs/xml_goto_trace.cpp @@ -41,7 +41,7 @@ static void replace_string_constants_rec(exprt &expr) /// printable in XML 1.0. Produces an empty string if no valid XML 1.0 string /// representing \p expr can be generated. static std::string -get_printable_xml(const namespacet &ns, const irep_idt &id, const exprt &expr) +get_printable_xml(const namespacet &ns, irep_idt id, const exprt &expr) { std::string result = from_expr(ns, id, expr); diff --git a/src/goto-symex/field_sensitivity.h b/src/goto-symex/field_sensitivity.h index 12606321ce0..23e2461dd2b 100644 --- a/src/goto-symex/field_sensitivity.h +++ b/src/goto-symex/field_sensitivity.h @@ -125,7 +125,7 @@ class field_sensitivityt field_sensitivityt( std::size_t max_array_size, bool should_simplify, - const irep_idt &language_mode) + irep_idt language_mode) : max_field_sensitivity_array_size(max_array_size), should_simplify(should_simplify), language_mode(language_mode) @@ -208,7 +208,7 @@ class field_sensitivityt const std::size_t max_field_sensitivity_array_size; const bool should_simplify; - const irep_idt &language_mode; + irep_idt language_mode; void field_assignments_rec( const namespacet &ns, diff --git a/src/goto-symex/goto_symex.h b/src/goto-symex/goto_symex.h index 5980573f0cd..a4fd1aeddec 100644 --- a/src/goto-symex/goto_symex.h +++ b/src/goto-symex/goto_symex.h @@ -89,8 +89,7 @@ class goto_symext /// \remarks /// This allows goto_symext to be divorced from the particular type of /// goto_modelt that provides the function bodies - typedef - std::function + typedef std::function get_goto_functiont; /// Return a function to get/load a goto function from the given goto model @@ -179,7 +178,7 @@ class goto_symext /// \param loop_id: the loop identifier /// \param unwind: current unwinding counter /// \return true if the symbolic execution is to be interrupted for checking - virtual bool check_break(const irep_idt &loop_id, unsigned unwind); + virtual bool check_break(irep_idt loop_id, unsigned unwind); protected: /// The configuration to use for this symbolic execution @@ -397,7 +396,7 @@ class goto_symext /// \param state: Symbolic execution state for current instruction virtual void vcc( const exprt &cond, - const irep_idt &property_id, + irep_idt property_id, const std::string &msg, statet &state); @@ -460,7 +459,7 @@ class goto_symext /// \param state The current state /// \param goto_function The goto function virtual void locality( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_symext::statet &state, const goto_functionst::goto_functiont &goto_function); @@ -502,7 +501,7 @@ class goto_symext const exprt::operandst &cleaned_arguments); virtual bool get_unwind_recursion( - const irep_idt &identifier, + irep_idt identifier, unsigned thread_nr, unsigned unwind); @@ -513,7 +512,7 @@ class goto_symext /// \param [out] state: state of the goto program /// \param arguments: arguments that are passed to the function void parameter_assignments( - const irep_idt &function_identifier, + irep_idt function_identifier, const goto_functionst::goto_functiont &goto_function, statet &state, const exprt::operandst &arguments); diff --git a/src/goto-symex/goto_symex_state.cpp b/src/goto-symex/goto_symex_state.cpp index d5e597a0925..0ec7804a952 100644 --- a/src/goto-symex/goto_symex_state.cpp +++ b/src/goto-symex/goto_symex_state.cpp @@ -34,7 +34,7 @@ goto_symex_statet::goto_symex_statet( bool should_simplify, const irep_idt language_mode, guard_managert &manager, - std::function fresh_l2_name_provider) + std::function fresh_l2_name_provider) : goto_statet(manager), source(_source), guard_manager(manager), @@ -699,7 +699,7 @@ static bool requires_renaming(const typet &type, const namespacet &ns) template void goto_symex_statet::rename( typet &type, - const irep_idt &l1_identifier, + irep_idt l1_identifier, const namespacet &ns) { // check whether there are symbol expressions in the type; if not, there @@ -803,7 +803,7 @@ void goto_symex_statet::print_backtrace(std::ostream &out) const ssa_exprt goto_symex_statet::add_object( const symbol_exprt &expr, - std::function index_generator, + std::function index_generator, const namespacet &ns) { framet &frame = call_stack().top(); diff --git a/src/goto-symex/goto_symex_state.h b/src/goto-symex/goto_symex_state.h index 143d12ea485..f51df4ec8ce 100644 --- a/src/goto-symex/goto_symex_state.h +++ b/src/goto-symex/goto_symex_state.h @@ -47,7 +47,7 @@ class goto_symex_statet final : public goto_statet bool should_simplify, const irep_idt language_mode, guard_managert &manager, - std::function fresh_l2_name_provider); + std::function fresh_l2_name_provider); ~goto_symex_statet(); /// \brief Fake "copy constructor" that initializes the `symex_target` member @@ -106,7 +106,7 @@ class goto_symex_statet final : public goto_statet rename_ssa(ssa_exprt ssa, const namespacet &ns); template - void rename(typet &type, const irep_idt &l1_identifier, const namespacet &ns); + void rename(typet &type, irep_idt l1_identifier, const namespacet &ns); [[nodiscard]] exprt l2_rename_rvalues(exprt lvalue, const namespacet &ns); @@ -164,7 +164,7 @@ class goto_symex_statet final : public goto_statet /// \return L1-renamed SSA expression ssa_exprt add_object( const symbol_exprt &expr, - std::function index_generator, + std::function index_generator, const namespacet &ns); /// Add `invalid` (or a failed symbol) to the value_set if ssa is a pointer, @@ -230,18 +230,18 @@ class goto_symex_statet final : public goto_statet unsigned remaining_vccs = 0; /// Drops an L1 name from the local L2 map - void drop_existing_l1_name(const irep_idt &l1_identifier) + void drop_existing_l1_name(irep_idt l1_identifier) { level2.current_names.erase(l1_identifier); } /// Drops an L1 name from the local L2 map - void drop_l1_name(const irep_idt &l1_identifier) + void drop_l1_name(irep_idt l1_identifier) { level2.current_names.erase_if_exists(l1_identifier); } - std::function get_l2_name_provider() const + std::function get_l2_name_provider() const { return fresh_l2_name_provider; } @@ -260,7 +260,7 @@ class goto_symex_statet final : public goto_statet private: const irep_idt language_mode; - std::function fresh_l2_name_provider; + std::function fresh_l2_name_provider; /// \brief Dangerous, do not use /// diff --git a/src/goto-symex/path_storage.h b/src/goto-symex/path_storage.h index 1b230776cd5..02bc4cc2161 100644 --- a/src/goto-symex/path_storage.h +++ b/src/goto-symex/path_storage.h @@ -101,12 +101,12 @@ class path_storaget /// Provide a unique L1 index for a given \p id, starting from /// \p minimum_index. - std::size_t get_unique_l1_index(const irep_idt &id, std::size_t minimum_index) + std::size_t get_unique_l1_index(irep_idt id, std::size_t minimum_index) { return get_unique_index(l1_indices, id, minimum_index); } - std::size_t get_unique_l2_index(const irep_idt &id) + std::size_t get_unique_l2_index(irep_idt id) { return get_unique_index(l2_indices, id, 1); } @@ -117,7 +117,7 @@ class path_storaget /// Generates a loop analysis for the instructions in goto_programt and /// keys it against function ID. - void add_function_loops(const irep_idt &identifier, const goto_programt &body) + void add_function_loops(irep_idt identifier, const goto_programt &body) { auto loop_iter = loop_analysis_map.find(identifier); if(loop_iter == loop_analysis_map.end()) @@ -127,8 +127,7 @@ class path_storaget } } - inline std::shared_ptr - get_loop_analysis(const irep_idt &function_id) + inline std::shared_ptr get_loop_analysis(irep_idt function_id) { return loop_analysis_map.at(function_id); } @@ -146,7 +145,7 @@ class path_storaget std::size_t get_unique_index( name_index_mapt &unique_index_map, - const irep_idt &id, + irep_idt id, std::size_t minimum_index) { auto entry = unique_index_map.emplace(id, minimum_index); diff --git a/src/goto-symex/postcondition.cpp b/src/goto-symex/postcondition.cpp index 5ac2bb6af42..3e42cc7e1f8 100644 --- a/src/goto-symex/postcondition.cpp +++ b/src/goto-symex/postcondition.cpp @@ -44,8 +44,8 @@ class postconditiont protected: void strengthen(exprt &dest); void weaken(exprt &dest); - bool is_used_address_of(const exprt &expr, const irep_idt &identifier); - bool is_used(const exprt &expr, const irep_idt &identifier); + bool is_used_address_of(const exprt &expr, irep_idt identifier); + bool is_used(const exprt &expr, irep_idt identifier); }; void postcondition( @@ -67,9 +67,7 @@ void postcondition( } } -bool postconditiont::is_used_address_of( - const exprt &expr, - const irep_idt &identifier) +bool postconditiont::is_used_address_of(const exprt &expr, irep_idt identifier) { if(expr.id()==ID_symbol) { @@ -144,9 +142,7 @@ void postconditiont::strengthen(exprt &dest) } } -bool postconditiont::is_used( - const exprt &expr, - const irep_idt &identifier) +bool postconditiont::is_used(const exprt &expr, irep_idt identifier) { if(expr.id()==ID_address_of) { diff --git a/src/goto-symex/renaming_level.cpp b/src/goto-symex/renaming_level.cpp index 0f89e3cccfe..0f0ac2a502e 100644 --- a/src/goto-symex/renaming_level.cpp +++ b/src/goto-symex/renaming_level.cpp @@ -128,16 +128,16 @@ void symex_level1t::restore_from(const symex_level1t &other) } } -unsigned symex_level2t::latest_index(const irep_idt &identifier) const +unsigned symex_level2t::latest_index(irep_idt identifier) const { const auto r_opt = current_names.find(identifier); return !r_opt ? 0 : r_opt->get().second; } std::size_t symex_level2t::increase_generation( - const irep_idt &l1_identifier, + irep_idt l1_identifier, const ssa_exprt &lhs, - std::function fresh_l2_name_provider) + std::function fresh_l2_name_provider) { const std::size_t n = fresh_l2_name_provider(l1_identifier); diff --git a/src/goto-symex/renaming_level.h b/src/goto-symex/renaming_level.h index eda7865f59a..f76741bb97b 100644 --- a/src/goto-symex/renaming_level.h +++ b/src/goto-symex/renaming_level.h @@ -74,14 +74,14 @@ struct symex_level2t renamedt operator()(renamedt l1_expr) const; /// Counter corresponding to an identifier - unsigned latest_index(const irep_idt &identifier) const; + unsigned latest_index(irep_idt identifier) const; /// Allocates a fresh L2 name for the given L1 identifier, and makes it the /// latest generation on this path. std::size_t increase_generation( - const irep_idt &l1_identifier, + irep_idt l1_identifier, const ssa_exprt &lhs, - std::function fresh_l2_name_provider); + std::function fresh_l2_name_provider); }; /// Undo all levels of renaming diff --git a/src/goto-symex/shadow_memory.cpp b/src/goto-symex/shadow_memory.cpp index 4d585fa8295..3667c486ea8 100644 --- a/src/goto-symex/shadow_memory.cpp +++ b/src/goto-symex/shadow_memory.cpp @@ -67,7 +67,7 @@ void shadow_memoryt::initialize_shadow_memory( const symbol_exprt &shadow_memoryt::add_field( goto_symex_statet &state, const exprt &expr, - const irep_idt &field_name, + irep_idt field_name, const typet &field_type) { const auto &function_symbol = ns.lookup(state.source.function_id); @@ -158,7 +158,7 @@ void shadow_memoryt::symex_set_field( } // Get the type of the shadow memory for this field - const typet &sm_field_type = get_field_init_type(field_name, state); + const typet sm_field_type = get_field_init_type(field_name, state); // Add a conditional cast to the shadow memory field type if `rhs` is not of // the expected type const exprt casted_rhs = @@ -222,7 +222,7 @@ void shadow_memoryt::symex_get_field( std::vector> rhs_conds_values; const null_pointer_exprt null_pointer(to_pointer_type(expr.type())); // Used to give a default value for invalid pointers and other usages - const exprt &field_init_expr = get_field_init_expr(field_name, state); + const exprt field_init_expr = get_field_init_expr(field_name, state); if(contains_null_or_invalid(value_set, null_pointer)) { diff --git a/src/goto-symex/shadow_memory.h b/src/goto-symex/shadow_memory.h index 206d8b51f15..4a71df1543e 100644 --- a/src/goto-symex/shadow_memory.h +++ b/src/goto-symex/shadow_memory.h @@ -128,7 +128,7 @@ class shadow_memoryt const symbol_exprt &add_field( goto_symex_statet &state, const exprt &expr, - const irep_idt &field_name, + irep_idt field_name, const typet &field_type); private: diff --git a/src/goto-symex/shadow_memory_util.cpp b/src/goto-symex/shadow_memory_util.cpp index bc1d1ed1476..e86f554fd06 100644 --- a/src/goto-symex/shadow_memory_util.cpp +++ b/src/goto-symex/shadow_memory_util.cpp @@ -32,7 +32,7 @@ Author: Peter Schrammel void shadow_memory_log_set_field( const namespacet &ns, const messaget &log, - const irep_idt &field_name, + irep_idt field_name, const exprt &expr, const exprt &value) { @@ -49,7 +49,7 @@ void shadow_memory_log_set_field( void shadow_memory_log_get_field( const namespacet &ns, const messaget &log, - const irep_idt &field_name, + irep_idt field_name, const exprt &expr) { #ifdef DEBUG_SHADOW_MEMORY @@ -297,7 +297,7 @@ void replace_invalid_object_by_null(exprt &expr) } const exprt & -get_field_init_expr(const irep_idt &field_name, const goto_symex_statet &state) +get_field_init_expr(irep_idt field_name, const goto_symex_statet &state) { auto field_type_it = state.shadow_memory.fields.local_fields.find(field_name); if(field_type_it != state.shadow_memory.fields.local_fields.end()) @@ -310,10 +310,9 @@ get_field_init_expr(const irep_idt &field_name, const goto_symex_statet &state) } const typet & -get_field_init_type(const irep_idt &field_name, const goto_symex_statet &state) +get_field_init_type(irep_idt field_name, const goto_symex_statet &state) { - const exprt &field_init_expr = get_field_init_expr(field_name, state); - return field_init_expr.type(); + return get_field_init_expr(field_name, state).type(); } bool contains_null_or_invalid( diff --git a/src/goto-symex/shadow_memory_util.h b/src/goto-symex/shadow_memory_util.h index 4b12eed37bf..55878ae8be8 100644 --- a/src/goto-symex/shadow_memory_util.h +++ b/src/goto-symex/shadow_memory_util.h @@ -27,7 +27,7 @@ class typet; void shadow_memory_log_set_field( const namespacet &ns, const messaget &log, - const irep_idt &field_name, + irep_idt field_name, const exprt &expr, const exprt &value); @@ -44,7 +44,7 @@ void shadow_memory_log_value_set( void shadow_memory_log_get_field( const namespacet &ns, const messaget &log, - const irep_idt &field_name, + irep_idt field_name, const exprt &expr); /// Logs a successful match between an address and a value within the value set. @@ -94,7 +94,7 @@ void replace_invalid_object_by_null(exprt &expr); /// expression. /// \returns The expression the field was initialised with. const exprt & -get_field_init_expr(const irep_idt &field_name, const goto_symex_statet &state); +get_field_init_expr(irep_idt field_name, const goto_symex_statet &state); /// Get a list of `(condition, value)` pairs for a certain pointer from /// the shadow memory, where each pair denotes the `value` of the pointer @@ -120,7 +120,7 @@ std::vector> get_shadow_dereference_candidates( /// the type of the value the field currently is associated with, but it's /// invariant since the declaration). const typet & -get_field_init_type(const irep_idt &field_name, const goto_symex_statet &state); +get_field_init_type(irep_idt field_name, const goto_symex_statet &state); /// Given a pointer expression check to see if it can be a null pointer or an /// invalid object within value_set. diff --git a/src/goto-symex/simplify_expr_with_value_set.cpp b/src/goto-symex/simplify_expr_with_value_set.cpp index 24a519f6364..3ab6324b222 100644 --- a/src/goto-symex/simplify_expr_with_value_set.cpp +++ b/src/goto-symex/simplify_expr_with_value_set.cpp @@ -31,7 +31,7 @@ Author: Michael Tautschnig /// \return If we were able to evaluate the condition as true or false then we /// return that, otherwise we return an empty std::optional static std::optional try_evaluate_pointer_comparison( - const irep_idt &operation, + irep_idt operation, const symbol_exprt &symbol_expr, const exprt &other_operand, const value_sett &value_set, diff --git a/src/goto-symex/simplify_expr_with_value_set.h b/src/goto-symex/simplify_expr_with_value_set.h index 446326cf04a..db2baa71a44 100644 --- a/src/goto-symex/simplify_expr_with_value_set.h +++ b/src/goto-symex/simplify_expr_with_value_set.h @@ -18,7 +18,7 @@ class simplify_expr_with_value_sett : public simplify_exprt public: simplify_expr_with_value_sett( const value_sett &_vs, - const irep_idt &_mode, + irep_idt _mode, const namespacet &_ns) : simplify_exprt(_ns), value_set(_vs), language_mode(_mode) { diff --git a/src/goto-symex/symex_assign.h b/src/goto-symex/symex_assign.h index e6a282637d7..345fdff3b8b 100644 --- a/src/goto-symex/symex_assign.h +++ b/src/goto-symex/symex_assign.h @@ -33,7 +33,7 @@ class symex_assignt symex_targett::assignment_typet assignment_type, const namespacet &ns, const symex_configt &symex_config, - const irep_idt &language_mode, + irep_idt language_mode, symex_targett &target) : shadow_memory(shadow_memory), state(state), @@ -67,7 +67,7 @@ class symex_assignt symex_targett::assignment_typet assignment_type; const namespacet &ns; const symex_configt &symex_config; - const irep_idt &language_mode; + irep_idt language_mode; symex_targett ⌖ void assign_from_struct( diff --git a/src/goto-symex/symex_builtin_functions.cpp b/src/goto-symex/symex_builtin_functions.cpp index 0ffc7b606f6..6c1fe4f0849 100644 --- a/src/goto-symex/symex_builtin_functions.cpp +++ b/src/goto-symex/symex_builtin_functions.cpp @@ -212,7 +212,7 @@ void goto_symext::symex_allocate( /// we need to put immediate values or pointers in there, depending on the size /// of the parameter. static exprt va_list_entry( - const irep_idt ¶meter, + irep_idt parameter, const pointer_typet &lhs_type, const namespacet &ns) { @@ -336,7 +336,7 @@ static irep_idt get_string_argument_rec(const exprt &src) static irep_idt get_string_argument( const exprt &src, const value_sett &value_set, - const irep_idt &language_mode, + irep_idt language_mode, const namespacet &ns) { exprt tmp=src; diff --git a/src/goto-symex/symex_decl.cpp b/src/goto-symex/symex_decl.cpp index a33352d2b83..fc7c429f010 100644 --- a/src/goto-symex/symex_decl.cpp +++ b/src/goto-symex/symex_decl.cpp @@ -31,9 +31,8 @@ void goto_symext::symex_decl(statet &state, const symbol_exprt &expr) // doing it this way). ssa_exprt ssa = state.add_object( expr, - [this](const irep_idt &l0_name) { - return path_storage.get_unique_l1_index(l0_name, 1); - }, + [this](irep_idt l0_name) + { return path_storage.get_unique_l1_index(l0_name, 1); }, ns); ssa = state.declare(std::move(ssa), ns); diff --git a/src/goto-symex/symex_function_call.cpp b/src/goto-symex/symex_function_call.cpp index a23c6a7b426..a6a33520b69 100644 --- a/src/goto-symex/symex_function_call.cpp +++ b/src/goto-symex/symex_function_call.cpp @@ -24,13 +24,13 @@ Author: Daniel Kroening, kroening@kroening.com #include "path_storage.h" #include "symex_assign.h" -bool goto_symext::get_unwind_recursion(const irep_idt &, unsigned, unsigned) +bool goto_symext::get_unwind_recursion(irep_idt, unsigned, unsigned) { return false; } void goto_symext::parameter_assignments( - const irep_idt &function_identifier, + irep_idt function_identifier, const goto_functionst::goto_functiont &goto_function, statet &state, const exprt::operandst &arguments) @@ -466,7 +466,7 @@ void goto_symext::symex_end_of_function(statet &state) } void goto_symext::locality( - const irep_idt &function_identifier, + irep_idt function_identifier, goto_symext::statet &state, const goto_functionst::goto_functiont &goto_function) { @@ -478,9 +478,8 @@ void goto_symext::locality( { const ssa_exprt &renamed_param = state.add_object( ns.lookup(param).symbol_expr(), - [this, &frame_nr](const irep_idt &l0_name) { - return path_storage.get_unique_l1_index(l0_name, frame_nr); - }, + [this, &frame_nr](irep_idt l0_name) + { return path_storage.get_unique_l1_index(l0_name, frame_nr); }, ns); // Allocate shadow memory for parameters. diff --git a/src/goto-symex/symex_goto.cpp b/src/goto-symex/symex_goto.cpp index 98eef067653..032a693a426 100644 --- a/src/goto-symex/symex_goto.cpp +++ b/src/goto-symex/symex_goto.cpp @@ -454,7 +454,7 @@ void goto_symext::symex_unreachable_goto(statet &state) symex_transition(state); } -bool goto_symext::check_break(const irep_idt &loop_id, unsigned unwind) +bool goto_symext::check_break(irep_idt loop_id, unsigned unwind) { // dummy implementation return false; diff --git a/src/goto-symex/symex_main.cpp b/src/goto-symex/symex_main.cpp index 9e9e519a68a..50be8133bce 100644 --- a/src/goto-symex/symex_main.cpp +++ b/src/goto-symex/symex_main.cpp @@ -179,7 +179,7 @@ void goto_symext::symex_assert( void goto_symext::vcc( const exprt &condition, - const irep_idt &property_id, + irep_idt property_id, const std::string &msg, statet &state) { @@ -420,7 +420,7 @@ std::unique_ptr goto_symext::initialize_entry_point_state( symex_config.simplify_opt, language_mode, guard_manager, - [storage](const irep_idt &id) { return storage->get_unique_l2_index(id); }); + [storage](irep_idt id) { return storage->get_unique_l2_index(id); }); CHECK_RETURN(!state->threads.empty()); CHECK_RETURN(!state->call_stack().empty()); @@ -492,10 +492,8 @@ void goto_symext::initialize_path_storage_from_entry_point_of( goto_symext::get_goto_functiont goto_symext::get_goto_function(abstract_goto_modelt &goto_model) { - return [&goto_model]( - const irep_idt &id) -> const goto_functionst::goto_functiont & { - return goto_model.get_goto_function(id); - }; + return [&goto_model](irep_idt id) -> const goto_functionst::goto_functiont & + { return goto_model.get_goto_function(id); }; } messaget::mstreamt & diff --git a/src/goto-symex/symex_target.h b/src/goto-symex/symex_target.h index 209bc6de49e..6fa1e45fef5 100644 --- a/src/goto-symex/symex_target.h +++ b/src/goto-symex/symex_target.h @@ -41,14 +41,12 @@ class symex_targett // is in its program sequence goto_programt::const_targett pc; - sourcet(const irep_idt &_function_id, goto_programt::const_targett _pc) + sourcet(irep_idt _function_id, goto_programt::const_targett _pc) : thread_nr(0), function_id(_function_id), pc(_pc) { } - explicit sourcet( - const irep_idt &_function_id, - const goto_programt &_goto_program) + explicit sourcet(irep_idt _function_id, const goto_programt &_goto_program) : thread_nr(0), function_id(_function_id), pc(_goto_program.instructions.begin()) @@ -157,7 +155,7 @@ class symex_targett /// function call virtual void function_call( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const std::vector> &ssa_function_arguments, const sourcet &source, bool hidden) = 0; @@ -170,7 +168,7 @@ class symex_targett /// function return virtual void function_return( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const sourcet &source, bool hidden) = 0; @@ -191,7 +189,7 @@ class symex_targett virtual void output( const exprt &guard, const sourcet &source, - const irep_idt &output_id, + irep_idt output_id, const std::list> &args) = 0; /// Record formatted output. @@ -204,9 +202,9 @@ class symex_targett virtual void output_fmt( const exprt &guard, const sourcet &source, - const irep_idt &output_id, - const irep_idt &fmt, - const std::list &args)=0; + irep_idt output_id, + irep_idt fmt, + const std::list &args) = 0; /// Record an input. /// \param guard: Precondition for reading from the input @@ -217,8 +215,8 @@ class symex_targett virtual void input( const exprt &guard, const sourcet &source, - const irep_idt &input_id, - const std::list &args)=0; + irep_idt input_id, + const std::list &args) = 0; /// Record an assumption. /// \param guard: Precondition for reaching this assumption @@ -240,7 +238,7 @@ class symex_targett virtual void assertion( const exprt &guard, const exprt &cond, - const irep_idt &property_id, + irep_idt property_id, const std::string &msg, const sourcet &source) = 0; diff --git a/src/goto-symex/symex_target_equation.cpp b/src/goto-symex/symex_target_equation.cpp index 0bb35155e01..46aa1df5f41 100644 --- a/src/goto-symex/symex_target_equation.cpp +++ b/src/goto-symex/symex_target_equation.cpp @@ -180,7 +180,7 @@ void symex_target_equationt::location( void symex_target_equationt::function_call( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const std::vector> &function_arguments, const sourcet &source, const bool hidden) @@ -199,7 +199,7 @@ void symex_target_equationt::function_call( void symex_target_equationt::function_return( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const sourcet &source, const bool hidden) { @@ -216,7 +216,7 @@ void symex_target_equationt::function_return( void symex_target_equationt::output( const exprt &guard, const sourcet &source, - const irep_idt &output_id, + irep_idt output_id, const std::list> &args) { SSA_steps.emplace_back(source, goto_trace_stept::typet::OUTPUT); @@ -233,8 +233,8 @@ void symex_target_equationt::output( void symex_target_equationt::output_fmt( const exprt &guard, const sourcet &source, - const irep_idt &output_id, - const irep_idt &fmt, + irep_idt output_id, + irep_idt fmt, const std::list &args) { SSA_steps.emplace_back(source, goto_trace_stept::typet::OUTPUT); @@ -252,7 +252,7 @@ void symex_target_equationt::output_fmt( void symex_target_equationt::input( const exprt &guard, const sourcet &source, - const irep_idt &input_id, + irep_idt input_id, const std::list &args) { SSA_steps.emplace_back(source, goto_trace_stept::typet::INPUT); @@ -282,7 +282,7 @@ void symex_target_equationt::assumption( void symex_target_equationt::assertion( const exprt &guard, const exprt &cond, - const irep_idt &property_id, + irep_idt property_id, const std::string &msg, const sourcet &source) { diff --git a/src/goto-symex/symex_target_equation.h b/src/goto-symex/symex_target_equation.h index b10a922b113..6f89979e96b 100644 --- a/src/goto-symex/symex_target_equation.h +++ b/src/goto-symex/symex_target_equation.h @@ -81,7 +81,7 @@ class symex_target_equationt:public symex_targett /// \copydoc symex_targett::function_call() virtual void function_call( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const std::vector> &ssa_function_arguments, const sourcet &source, bool hidden); @@ -89,7 +89,7 @@ class symex_target_equationt:public symex_targett /// \copydoc symex_targett::function_return() virtual void function_return( const exprt &guard, - const irep_idt &function_id, + irep_idt function_id, const sourcet &source, bool hidden); @@ -102,22 +102,22 @@ class symex_target_equationt:public symex_targett virtual void output( const exprt &guard, const sourcet &source, - const irep_idt &output_id, + irep_idt output_id, const std::list> &args); /// \copydoc symex_targett::output_fmt() virtual void output_fmt( const exprt &guard, const sourcet &source, - const irep_idt &output_id, - const irep_idt &fmt, + irep_idt output_id, + irep_idt fmt, const std::list &args); /// \copydoc symex_targett::input() virtual void input( const exprt &guard, const sourcet &source, - const irep_idt &input_id, + irep_idt input_id, const std::list &args); /// \copydoc symex_targett::assumption() @@ -130,7 +130,7 @@ class symex_target_equationt:public symex_targett virtual void assertion( const exprt &guard, const exprt &cond, - const irep_idt &property_id, + irep_idt property_id, const std::string &msg, const sourcet &source); diff --git a/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.cpp b/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.cpp index d1bdd3140ed..e0e5a2cd3c8 100644 --- a/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.cpp +++ b/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.cpp @@ -307,7 +307,7 @@ exprt enumerative_loop_contracts_synthesizert::synthesize_same_object_predicate( exprt enumerative_loop_contracts_synthesizert::synthesize_strengthening_clause( const std::vector terminal_symbols, const loop_idt &cause_loop_id, - const irep_idt &violation_id, + irep_idt violation_id, const std::vector &cexs) { // Synthesis of strengthening clauses is a enumerate-and-check process. diff --git a/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.h b/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.h index fd065e7e69f..0a80300b4a9 100644 --- a/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.h +++ b/src/goto-synthesizer/enumerative_loop_contracts_synthesizer.h @@ -81,7 +81,7 @@ class enumerative_loop_contracts_synthesizert exprt synthesize_strengthening_clause( const std::vector terminal_symbols, const loop_idt &cause_loop_id, - const irep_idt &violation_id, + irep_idt violation_id, const std::vector &cexs); /// Synthesize assigns target and update assigns_map. diff --git a/src/goto-synthesizer/expr_enumerator.cpp b/src/goto-synthesizer/expr_enumerator.cpp index 373897a2df2..97ad8d4f713 100644 --- a/src/goto-synthesizer/expr_enumerator.cpp +++ b/src/goto-synthesizer/expr_enumerator.cpp @@ -285,7 +285,7 @@ std::list non_leaf_enumeratort::get_partitions( return result; } -bool binary_functional_enumeratort::is_commutative(const irep_idt &op) const +bool binary_functional_enumeratort::is_commutative(irep_idt op) const { return op_id == ID_equal || op_id == ID_plus || op_id == ID_notequal || op_id == ID_or || op_id == ID_and || op_id == ID_xor || diff --git a/src/goto-synthesizer/expr_enumerator.h b/src/goto-synthesizer/expr_enumerator.h index 057be543d6d..352f956a005 100644 --- a/src/goto-synthesizer/expr_enumerator.h +++ b/src/goto-synthesizer/expr_enumerator.h @@ -217,7 +217,7 @@ class binary_functional_enumeratort : public non_leaf_enumeratort { public: binary_functional_enumeratort( - const irep_idt &op, + irep_idt op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const std::function partition_check, @@ -230,7 +230,7 @@ class binary_functional_enumeratort : public non_leaf_enumeratort } binary_functional_enumeratort( - const irep_idt &op, + irep_idt op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const std::function partition_check, @@ -246,7 +246,7 @@ class binary_functional_enumeratort : public non_leaf_enumeratort } binary_functional_enumeratort( - const irep_idt &op, + irep_idt op, const enumerator_baset &enumerator_1, const enumerator_baset &enumerator_2, const namespacet &ns) @@ -259,7 +259,7 @@ class binary_functional_enumeratort : public non_leaf_enumeratort { } - bool is_commutative(const irep_idt &op) const; + bool is_commutative(irep_idt op) const; /// Determine whether a tuple of expressions is the representation of some /// equivalence class. @@ -273,7 +273,7 @@ class binary_functional_enumeratort : public non_leaf_enumeratort // set of expressions. const bool is_exchangeable = false; - const irep_idt &op_id; + irep_idt op_id; }; /// Enumerators that enumerates expressions in the union of enumerated diff --git a/src/json-symtab-language/json_goto_function.cpp b/src/json-symtab-language/json_goto_function.cpp index b8545e95e46..cdfb1f1f095 100644 --- a/src/json-symtab-language/json_goto_function.cpp +++ b/src/json-symtab-language/json_goto_function.cpp @@ -38,7 +38,7 @@ static goto_instruction_codet try_get_code(const json_objectt &json) /// \param code_id: The expected code type /// \return An expression, unless an exception was thrown before. static goto_instruction_codet -try_get_code(const json_objectt &json, const irep_idt &code_id) +try_get_code(const json_objectt &json, irep_idt code_id) { goto_instruction_codet code = try_get_code(json); if(code.get_statement() != code_id) diff --git a/src/langapi/language.h b/src/langapi/language.h index 5b47d4c9475..bb4477e106a 100644 --- a/src/langapi/language.h +++ b/src/langapi/language.h @@ -101,7 +101,7 @@ class languaget /// advertised the given `function_id` could be provided by this `languaget` /// instance. virtual void convert_lazy_method( - const irep_idt &function_id, + irep_idt function_id, symbol_table_baset &symbol_table, message_handlert &message_handler) { diff --git a/src/langapi/language_file.cpp b/src/langapi/language_file.cpp index b46be2f3d17..9797a38c655 100644 --- a/src/langapi/language_file.cpp +++ b/src/langapi/language_file.cpp @@ -38,7 +38,7 @@ void language_filet::get_modules() } void language_filet::convert_lazy_method( - const irep_idt &id, + irep_idt id, symbol_table_baset &symbol_table, message_handlert &message_handler) { diff --git a/src/langapi/language_file.h b/src/langapi/language_file.h index be4722d4ad2..1c1b9d43d3c 100644 --- a/src/langapi/language_file.h +++ b/src/langapi/language_file.h @@ -49,7 +49,7 @@ class language_filet final void get_modules(); void convert_lazy_method( - const irep_idt &id, + irep_idt id, symbol_table_baset &symbol_table, message_handlert &message_handler); @@ -132,7 +132,7 @@ class language_filest // in lazy_method_map (currently always in language_filest::typecheck) // for this to be legal. void convert_lazy_method( - const irep_idt &id, + irep_idt id, symbol_table_baset &symbol_table, message_handlert &message_handler) { @@ -142,7 +142,7 @@ class language_filest it->second->convert_lazy_method(id, symbol_table, message_handler); } - bool can_convert_lazy_method(const irep_idt &id) const + bool can_convert_lazy_method(irep_idt id) const { return lazy_method_map.count(id) != 0; } diff --git a/src/langapi/language_util.cpp b/src/langapi/language_util.cpp index 324ed0f01da..36a8ca1b53a 100644 --- a/src/langapi/language_util.cpp +++ b/src/langapi/language_util.cpp @@ -19,10 +19,8 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include -std::string from_expr_using_mode( - const namespacet &ns, - const irep_idt &mode, - const exprt &expr) +std::string +from_expr_using_mode(const namespacet &ns, irep_idt mode, const exprt &expr) { std::unique_ptr language = (mode == ID_unknown) ? get_default_language() @@ -36,10 +34,8 @@ std::string from_expr_using_mode( return result; } -std::string from_expr( - const namespacet &ns, - const irep_idt &identifier, - const exprt &expr) +std::string +from_expr(const namespacet &ns, irep_idt identifier, const exprt &expr) { std::unique_ptr p(get_language_from_identifier(ns, identifier)); @@ -49,10 +45,8 @@ std::string from_expr( return result; } -std::string from_type( - const namespacet &ns, - const irep_idt &identifier, - const typet &type) +std::string +from_type(const namespacet &ns, irep_idt identifier, const typet &type) { std::unique_ptr p(get_language_from_identifier(ns, identifier)); @@ -62,10 +56,8 @@ std::string from_type( return result; } -std::string type_to_name( - const namespacet &ns, - const irep_idt &identifier, - const typet &type) +std::string +type_to_name(const namespacet &ns, irep_idt identifier, const typet &type) { std::unique_ptr p(get_language_from_identifier(ns, identifier)); @@ -87,10 +79,7 @@ std::string from_type(const typet &type) return from_type(namespacet(symbol_table), irep_idt(), type); } -exprt to_expr( - const namespacet &ns, - const irep_idt &identifier, - const std::string &src) +exprt to_expr(const namespacet &ns, irep_idt identifier, const std::string &src) { std::unique_ptr p(get_language_from_identifier(ns, identifier)); diff --git a/src/langapi/language_util.h b/src/langapi/language_util.h index 9e7f87466af..5610a865de6 100644 --- a/src/langapi/language_util.h +++ b/src/langapi/language_util.h @@ -18,34 +18,26 @@ class typet; /// Formats an expression using the given namespace, /// using the given mode to retrieve the language printer. -std::string from_expr_using_mode( - const namespacet &ns, - const irep_idt &mode, - const exprt &expr); +std::string +from_expr_using_mode(const namespacet &ns, irep_idt mode, const exprt &expr); -std::string from_expr( - const namespacet &ns, - const irep_idt &identifier, - const exprt &expr); +std::string +from_expr(const namespacet &ns, irep_idt identifier, const exprt &expr); std::string from_expr(const exprt &expr); -std::string from_type( - const namespacet &ns, - const irep_idt &identifier, - const typet &type); +std::string +from_type(const namespacet &ns, irep_idt identifier, const typet &type); std::string from_type(const typet &type); exprt to_expr( const namespacet &ns, - const irep_idt &identifier, + irep_idt identifier, const std::string &src); -std::string type_to_name( - const namespacet &ns, - const irep_idt &identifier, - const typet &type); +std::string +type_to_name(const namespacet &ns, irep_idt identifier, const typet &type); std::string type_to_name(const typet &type); diff --git a/src/langapi/mode.cpp b/src/langapi/mode.cpp index e401522750f..268988fc925 100644 --- a/src/langapi/mode.cpp +++ b/src/langapi/mode.cpp @@ -48,7 +48,7 @@ void register_language(language_factoryt factory) /// Get the language corresponding to the given mode /// \param mode: the mode, e.g. `ID_C` /// \return the language or `nullptr` if the language has not been registered -std::unique_ptr get_language_from_mode(const irep_idt &mode) +std::unique_ptr get_language_from_mode(irep_idt mode) { for(const auto &language : languages) if(mode == language.mode) @@ -63,7 +63,7 @@ std::unique_ptr get_language_from_mode(const irep_idt &mode) /// \return the mode, e.g. `ID_C`, if the identifier is in the given /// symbol table, or `ID_unknown` otherwise const irep_idt & -get_mode_from_identifier(const namespacet &ns, const irep_idt &identifier) +get_mode_from_identifier(const namespacet &ns, irep_idt identifier) { if(identifier.empty()) return ID_unknown; @@ -81,9 +81,9 @@ get_mode_from_identifier(const namespacet &ns, const irep_idt &identifier) /// Note: It is assumed as an invariant that languages of symbols in the symbol /// table have been registered. std::unique_ptr -get_language_from_identifier(const namespacet &ns, const irep_idt &identifier) +get_language_from_identifier(const namespacet &ns, irep_idt identifier) { - const irep_idt &mode = get_mode_from_identifier(ns, identifier); + const irep_idt mode = get_mode_from_identifier(ns, identifier); if(mode == ID_unknown) return get_default_language(); diff --git a/src/langapi/mode.h b/src/langapi/mode.h index 3223cf4a960..b05cc294ef1 100644 --- a/src/langapi/mode.h +++ b/src/langapi/mode.h @@ -17,11 +17,11 @@ Author: Daniel Kroening, kroening@cs.cmu.edu class languaget; class namespacet; -std::unique_ptr get_language_from_mode(const irep_idt &mode); +std::unique_ptr get_language_from_mode(irep_idt mode); const irep_idt & -get_mode_from_identifier(const namespacet &ns, const irep_idt &identifier); +get_mode_from_identifier(const namespacet &ns, irep_idt identifier); std::unique_ptr -get_language_from_identifier(const namespacet &ns, const irep_idt &identifier); +get_language_from_identifier(const namespacet &ns, irep_idt identifier); std::unique_ptr get_language_from_filename( const std::string &filename); std::unique_ptr get_default_language(); diff --git a/src/linking/linking.cpp b/src/linking/linking.cpp index 6bde1eb04cd..0606017798d 100644 --- a/src/linking/linking.cpp +++ b/src/linking/linking.cpp @@ -40,7 +40,7 @@ static const typet &follow_tags_symbols( } irep_idt -linkingt::rename(const symbol_table_baset &src_symbol_table, const irep_idt &id) +linkingt::rename(const symbol_table_baset &src_symbol_table, irep_idt id) { unsigned cnt=0; diff --git a/src/linking/linking_class.h b/src/linking/linking_class.h index 0f5c3f1cf23..5d8c610f2f3 100644 --- a/src/linking/linking_class.h +++ b/src/linking/linking_class.h @@ -120,7 +120,7 @@ class linkingt namespacet ns; message_handlert &message_handler; - irep_idt rename(const symbol_table_baset &, const irep_idt &); + irep_idt rename(const symbol_table_baset &, irep_idt); // the new IDs created by renaming std::unordered_set renamed_ids; diff --git a/src/linking/static_lifetime_init.cpp b/src/linking/static_lifetime_init.cpp index 336c848d7dd..0413ade02b9 100644 --- a/src/linking/static_lifetime_init.cpp +++ b/src/linking/static_lifetime_init.cpp @@ -22,9 +22,8 @@ Author: Daniel Kroening, kroening@kroening.com #include -static std::optional static_lifetime_init( - const irep_idt &identifier, - symbol_table_baset &symbol_table) +static std::optional +static_lifetime_init(irep_idt identifier, symbol_table_baset &symbol_table) { const namespacet ns(symbol_table); const symbolt &symbol = ns.lookup(identifier); diff --git a/src/memory-analyzer/analyze_symbol.cpp b/src/memory-analyzer/analyze_symbol.cpp index 0e1d1e7046f..0e968761a5f 100644 --- a/src/memory-analyzer/analyze_symbol.cpp +++ b/src/memory-analyzer/analyze_symbol.cpp @@ -35,7 +35,7 @@ gdb_value_extractort::gdb_value_extractort( gdb_value_extractort::memory_scopet::memory_scopet( const memory_addresst &begin, const mp_integer &byte_size, - const irep_idt &name) + irep_idt name) : // the address is given in hex, starting with 0x.... begin_int( safe_string2size_t(std::string_view{begin.address_string}.substr(2), 16)), @@ -151,7 +151,7 @@ void gdb_value_extractort::analyze_symbols( } } -void gdb_value_extractort::analyze_symbol(const irep_idt &symbol_name) +void gdb_value_extractort::analyze_symbol(irep_idt symbol_name) { const symbolt &symbol = ns.lookup(symbol_name); const symbol_exprt symbol_expr = symbol.symbol_expr(); diff --git a/src/memory-analyzer/analyze_symbol.h b/src/memory-analyzer/analyze_symbol.h index 308fa9590ae..0c3517856d3 100644 --- a/src/memory-analyzer/analyze_symbol.h +++ b/src/memory-analyzer/analyze_symbol.h @@ -115,7 +115,7 @@ class gdb_value_extractort memory_scopet( const memory_addresst &begin, const mp_integer &byte_size, - const irep_idt &name); + irep_idt name); /// Check if \p point points somewhere in this memory scope /// \param point: memory address to be check for presence @@ -153,7 +153,7 @@ class gdb_value_extractort /// Keep track of the memory location for the analyzed symbols std::map memory_map; - bool has_known_memory_location(const irep_idt &id) const + bool has_known_memory_location(irep_idt id) const { return memory_map.count(id) != 0; } @@ -197,7 +197,7 @@ class gdb_value_extractort /// expression and then process outstanding assignments that this /// extraction introduced. /// \param symbol_name: symbol table name to be analysed - void analyze_symbol(const irep_idt &symbol_name); + void analyze_symbol(irep_idt symbol_name); /// Create assignment \p lhs := \p value (see \ref analyze_symbol) /// \param lhs: the left-hand side of the assignment; expected to be a diff --git a/src/pointer-analysis/add_failed_symbols.cpp b/src/pointer-analysis/add_failed_symbols.cpp index f53947a767b..b8e978ad226 100644 --- a/src/pointer-analysis/add_failed_symbols.cpp +++ b/src/pointer-analysis/add_failed_symbols.cpp @@ -23,7 +23,7 @@ Author: Daniel Kroening, kroening@kroening.com /// to by a given pointer-typed symbol. /// \param id: base symbol id /// \return id of the corresponding unknown-object ("failed") symbol. -irep_idt failed_symbol_id(const irep_idt &id) +irep_idt failed_symbol_id(irep_idt id) { return id2string(id)+"$object"; } diff --git a/src/pointer-analysis/add_failed_symbols.h b/src/pointer-analysis/add_failed_symbols.h index c52a24b3e71..c70668cb5cb 100644 --- a/src/pointer-analysis/add_failed_symbols.h +++ b/src/pointer-analysis/add_failed_symbols.h @@ -24,7 +24,7 @@ void add_failed_symbols(symbol_table_baset &symbol_table); void add_failed_symbol_if_needed( const symbolt &symbol, symbol_table_baset &symbol_table); -irep_idt failed_symbol_id(const irep_idt &identifier); +irep_idt failed_symbol_id(irep_idt identifier); /// Get the failed-dereference symbol for the given symbol /// \param expr: symbol expression to get a failed symbol for diff --git a/src/pointer-analysis/goto_program_dereference.cpp b/src/pointer-analysis/goto_program_dereference.cpp index efa02a89046..b6e0c67c66b 100644 --- a/src/pointer-analysis/goto_program_dereference.cpp +++ b/src/pointer-analysis/goto_program_dereference.cpp @@ -245,7 +245,7 @@ void goto_program_dereferencet::dereference_instruction( /// Set the current target to `target` and remove derefence from expr. void goto_program_dereferencet::dereference_expression( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett target, exprt &expr) { @@ -276,7 +276,7 @@ void remove_pointers( /// Remove dereferences in `expr` using `value_sets` to determine to what /// objects the pointers may be pointing to. void dereference( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett target, exprt &expr, const namespacet &ns, diff --git a/src/pointer-analysis/goto_program_dereference.h b/src/pointer-analysis/goto_program_dereference.h index 1818323d0de..7f5eaae7617 100644 --- a/src/pointer-analysis/goto_program_dereference.h +++ b/src/pointer-analysis/goto_program_dereference.h @@ -62,7 +62,7 @@ class goto_program_dereferencet:protected dereference_callbackt bool checks_only=false); void dereference_expression( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett target, exprt &expr); @@ -94,7 +94,7 @@ class goto_program_dereferencet:protected dereference_callbackt }; void dereference( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett target, exprt &expr, const namespacet &, diff --git a/src/pointer-analysis/show_value_sets.cpp b/src/pointer-analysis/show_value_sets.cpp index 6e4f8fd6085..b690f5c4fd0 100644 --- a/src/pointer-analysis/show_value_sets.cpp +++ b/src/pointer-analysis/show_value_sets.cpp @@ -40,7 +40,7 @@ void show_value_sets( void show_value_sets( ui_message_handlert::uit ui, const namespacet &ns, - const irep_idt &function_name, + irep_idt function_name, const goto_programt &goto_program, const value_set_analysist &value_set_analysis) { diff --git a/src/pointer-analysis/value_set.cpp b/src/pointer-analysis/value_set.cpp index aad9ae75f69..e98fc087b55 100644 --- a/src/pointer-analysis/value_set.cpp +++ b/src/pointer-analysis/value_set.cpp @@ -40,7 +40,7 @@ Author: Daniel Kroening, kroening@kroening.com const value_sett::object_map_dt value_sett::empty_object_map{}; object_numberingt value_sett::object_numbering; -bool value_sett::field_sensitive(const irep_idt &id, const typet &type) +bool value_sett::field_sensitive(irep_idt id, const typet &type) { // we always track fields on these if( @@ -52,7 +52,7 @@ bool value_sett::field_sensitive(const irep_idt &id, const typet &type) return type.id() == ID_struct || type.id() == ID_struct_tag; } -const value_sett::entryt *value_sett::find_entry(const irep_idt &id) const +const value_sett::entryt *value_sett::find_entry(irep_idt id) const { auto found = values.find(id); return !found.has_value() ? nullptr : &(found->get()); @@ -137,81 +137,83 @@ bool value_sett::insert( void value_sett::output(std::ostream &out, const std::string &indent) const { - values.iterate([&](const irep_idt &, const entryt &e) { - irep_idt identifier, display_name; - - if(e.identifier.starts_with("value_set::dynamic_object")) - { - display_name = id2string(e.identifier) + e.suffix; - identifier.clear(); - } - else if(e.identifier == "value_set::return_value") - { - display_name = "RETURN_VALUE" + e.suffix; - identifier.clear(); - } - else + values.iterate( + [&](irep_idt, const entryt &e) { + irep_idt identifier, display_name; + + if(e.identifier.starts_with("value_set::dynamic_object")) + { + display_name = id2string(e.identifier) + e.suffix; + identifier.clear(); + } + else if(e.identifier == "value_set::return_value") + { + display_name = "RETURN_VALUE" + e.suffix; + identifier.clear(); + } + else + { #if 0 const symbolt &symbol=ns.lookup(e.identifier); display_name=id2string(symbol.display_name())+e.suffix; identifier=symbol.name; #else - identifier = id2string(e.identifier); - display_name = id2string(identifier) + e.suffix; + identifier = id2string(e.identifier); + display_name = id2string(identifier) + e.suffix; #endif - } - - out << indent << display_name << " = { "; - - const object_map_dt &object_map = e.object_map.read(); + } - std::size_t width = 0; + out << indent << display_name << " = { "; - for(object_map_dt::const_iterator o_it = object_map.begin(); - o_it != object_map.end(); - o_it++) - { - const exprt &o = object_numbering[o_it->first]; + const object_map_dt &object_map = e.object_map.read(); - std::ostringstream stream; + std::size_t width = 0; - if(o.id() == ID_invalid || o.id() == ID_unknown) - stream << format(o); - else + for(object_map_dt::const_iterator o_it = object_map.begin(); + o_it != object_map.end(); + o_it++) { - stream << "<" << format(o) << ", "; + const exprt &o = object_numbering[o_it->first]; - if(o_it->second) - stream << format(*o_it->second); - else - stream << '*'; + std::ostringstream stream; - if(o.type().is_nil()) - stream << ", ?"; + if(o.id() == ID_invalid || o.id() == ID_unknown) + stream << format(o); else - stream << ", " << format(o.type()); + { + stream << "<" << format(o) << ", "; - stream << '>'; - } + if(o_it->second) + stream << format(*o_it->second); + else + stream << '*'; - const std::string result = stream.str(); - out << result; - width += result.size(); + if(o.type().is_nil()) + stream << ", ?"; + else + stream << ", " << format(o.type()); - object_map_dt::const_iterator next(o_it); - next++; + stream << '>'; + } - if(next != object_map.end()) - { - out << ", "; - if(width >= 40) - out << "\n" << std::string(indent.size(), ' ') << " "; + const std::string result = stream.str(); + out << result; + width += result.size(); + + object_map_dt::const_iterator next(o_it); + next++; + + if(next != object_map.end()) + { + out << ", "; + if(width >= 40) + out << "\n" << std::string(indent.size(), ' ') << " "; + } } - } - out << " } \n"; - }); + out << " } \n"; + }); } xmlt value_sett::output_xml(void) const @@ -409,10 +411,12 @@ value_sett::object_mapt value_sett::get_value_set( if(includes_nondet_pointer && expr.type().id() == ID_pointer) { // we'll take the union of all objects we see, with unspecified offsets - values.iterate([this, &dest](const irep_idt &key, const entryt &value) { - for(const auto &object : value.object_map.read()) - insert(dest, object.first, offsett()); - }); + values.iterate( + [this, &dest](irep_idt key, const entryt &value) + { + for(const auto &object : value.object_map.read()) + insert(dest, object.first, offsett()); + }); // we'll add null, in case it's not there yet insert( @@ -1785,7 +1789,7 @@ void value_sett::assign_rec( } void value_sett::do_function_call( - const irep_idt &function, + irep_idt function, const exprt::operandst &arguments, const namespacet &ns) { @@ -1995,7 +1999,7 @@ void value_sett::guard( } void value_sett::erase_values_from_entry( - const irep_idt &index, + irep_idt index, const std::unordered_set &values_to_erase) { if(values_to_erase.empty()) diff --git a/src/pointer-analysis/value_set.h b/src/pointer-analysis/value_set.h index 73119a8ffb6..d4de9b8275e 100644 --- a/src/pointer-analysis/value_set.h +++ b/src/pointer-analysis/value_set.h @@ -65,7 +65,7 @@ class value_sett /// Determines whether an identifier of a given type should have its fields /// distinguished. Virtual so that subclasses can override this behaviour. - virtual bool field_sensitive(const irep_idt &id, const typet &type); + virtual bool field_sensitive(irep_idt id, const typet &type); /// Matches the location_number field of the instruction that corresponds /// to this value_sett instance in value_set_domaint's state map @@ -194,7 +194,7 @@ class value_sett { } - entryt(const irep_idt &_identifier, const std::string &_suffix) + entryt(irep_idt _identifier, const std::string &_suffix) : identifier(_identifier), suffix(_suffix) { } @@ -248,7 +248,7 @@ class value_sett /// \ref update_entry. /// \param id: identifier to find. /// \return a constant pointer to an entry if found, or null otherwise. - const entryt *find_entry(const irep_idt &id) const; + const entryt *find_entry(irep_idt id) const; /// Adds or replaces an entry in this value-set. /// \param e: entry to find. Its `id` and `suffix` fields will be used @@ -355,7 +355,7 @@ class value_sett /// \param arguments: actual arguments /// \param ns: global namespace void do_function_call( - const irep_idt &function, + irep_idt function, const exprt::operandst &arguments, const namespacet &ns); @@ -413,7 +413,7 @@ class value_sett /// \param index: index in the value set /// \param values_to_erase: set of values to remove from the entry void erase_values_from_entry( - const irep_idt &index, + irep_idt index, const std::unordered_set &values_to_erase); void erase_symbol(const symbol_exprt &symbol_expr, const namespacet &ns); diff --git a/src/pointer-analysis/value_set_analysis.h b/src/pointer-analysis/value_set_analysis.h index 4003ff47f05..b80f8729ec9 100644 --- a/src/pointer-analysis/value_set_analysis.h +++ b/src/pointer-analysis/value_set_analysis.h @@ -40,7 +40,7 @@ class value_set_analysis_templatet : public value_setst, public ait // interface value_sets std::vector - get_values(const irep_idt &, locationt l, const exprt &expr) override + get_values(irep_idt, locationt l, const exprt &expr) override { auto s = this->abstract_state_before(l); auto d = std::dynamic_pointer_cast(s); diff --git a/src/pointer-analysis/value_set_analysis_fi.cpp b/src/pointer-analysis/value_set_analysis_fi.cpp index dd407a12115..d62b040cb84 100644 --- a/src/pointer-analysis/value_set_analysis_fi.cpp +++ b/src/pointer-analysis/value_set_analysis_fi.cpp @@ -87,7 +87,7 @@ void value_set_analysis_fit::get_entries( } void value_set_analysis_fit::get_entries_rec( - const irep_idt &identifier, + irep_idt identifier, const std::string &suffix, const typet &type, std::list &dest) @@ -207,7 +207,7 @@ bool value_set_analysis_fit::check_type(const typet &type) } std::vector value_set_analysis_fit::get_values( - const irep_idt &function_id, + irep_idt function_id, flow_insensitive_analysis_baset::locationt l, const exprt &expr) { diff --git a/src/pointer-analysis/value_set_analysis_fi.h b/src/pointer-analysis/value_set_analysis_fi.h index 9d3887c345a..f63bc5610f2 100644 --- a/src/pointer-analysis/value_set_analysis_fi.h +++ b/src/pointer-analysis/value_set_analysis_fi.h @@ -53,17 +53,15 @@ class value_set_analysis_fit: std::list &dest); void get_entries_rec( - const irep_idt &identifier, + irep_idt identifier, const std::string &suffix, const typet &type, std::list &dest); public: // interface value_sets - std::vector get_values( - const irep_idt &function_id, - locationt l, - const exprt &expr) override; + std::vector + get_values(irep_idt function_id, locationt l, const exprt &expr) override; }; #endif // CPROVER_POINTER_ANALYSIS_VALUE_SET_ANALYSIS_FI_H diff --git a/src/pointer-analysis/value_set_dereference.cpp b/src/pointer-analysis/value_set_dereference.cpp index f9a99530a6c..406fce23270 100644 --- a/src/pointer-analysis/value_set_dereference.cpp +++ b/src/pointer-analysis/value_set_dereference.cpp @@ -423,7 +423,7 @@ bool value_set_dereferencet::dereference_type_compare( bool value_set_dereferencet::should_ignore_value( const exprt &what, bool exclude_null_derefs, - const irep_idt &language_mode) + irep_idt language_mode) { if(what.id() == ID_unknown || what.id() == ID_invalid) { diff --git a/src/pointer-analysis/value_set_dereference.h b/src/pointer-analysis/value_set_dereference.h index 96552e66af9..49045ca0bcf 100644 --- a/src/pointer-analysis/value_set_dereference.h +++ b/src/pointer-analysis/value_set_dereference.h @@ -71,7 +71,7 @@ class value_set_dereferencet final static bool should_ignore_value( const exprt &what, bool exclude_null_derefs, - const irep_idt &language_mode); + irep_idt language_mode); static valuet build_reference_to( const exprt &what, diff --git a/src/pointer-analysis/value_set_domain.h b/src/pointer-analysis/value_set_domain.h index b7de38763bc..afee42d3d17 100644 --- a/src/pointer-analysis/value_set_domain.h +++ b/src/pointer-analysis/value_set_domain.h @@ -80,9 +80,9 @@ class value_set_domain_templatet : public ai_domain_baset } void transform( - const irep_idt &function_from, + irep_idt function_from, trace_ptrt from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt to, ai_baset &ai, const namespacet &ns) override; @@ -118,9 +118,9 @@ typedef value_set_domain_templatet value_set_domaint; template void value_set_domain_templatet::transform( - const irep_idt &, + irep_idt, trace_ptrt from, - const irep_idt &function_to, + irep_idt function_to, trace_ptrt to, ai_baset &, const namespacet &ns) diff --git a/src/pointer-analysis/value_set_domain_fi.cpp b/src/pointer-analysis/value_set_domain_fi.cpp index 01c618d60c8..e42253904f0 100644 --- a/src/pointer-analysis/value_set_domain_fi.cpp +++ b/src/pointer-analysis/value_set_domain_fi.cpp @@ -14,9 +14,9 @@ Author: Daniel Kroening, kroening@kroening.com bool value_set_domain_fit::transform( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from_l, - const irep_idt &function_to, + irep_idt function_to, locationt to_l) { value_set.changed = false; diff --git a/src/pointer-analysis/value_set_domain_fi.h b/src/pointer-analysis/value_set_domain_fi.h index f6412dfb7a9..b8078f6ac5a 100644 --- a/src/pointer-analysis/value_set_domain_fi.h +++ b/src/pointer-analysis/value_set_domain_fi.h @@ -41,9 +41,9 @@ class value_set_domain_fit:public flow_insensitive_abstract_domain_baset bool transform( const namespacet &ns, - const irep_idt &function_from, + irep_idt function_from, locationt from_l, - const irep_idt &function_to, + irep_idt function_to, locationt to_l) override; void get_reference_set( diff --git a/src/pointer-analysis/value_set_fi.cpp b/src/pointer-analysis/value_set_fi.cpp index 7a57fdad707..3a8b296bc51 100644 --- a/src/pointer-analysis/value_set_fi.cpp +++ b/src/pointer-analysis/value_set_fi.cpp @@ -1319,7 +1319,7 @@ void value_set_fit::assign_rec( } void value_set_fit::do_function_call( - const irep_idt &function, + irep_idt function, const exprt::operandst &arguments, const namespacet &ns) { diff --git a/src/pointer-analysis/value_set_fi.h b/src/pointer-analysis/value_set_fi.h index d07e01ead43..c6ac264beee 100644 --- a/src/pointer-analysis/value_set_fi.h +++ b/src/pointer-analysis/value_set_fi.h @@ -41,13 +41,13 @@ class value_set_fit static object_numberingt object_numbering; static numberingt function_numbering; - void set_from(const irep_idt &function, unsigned inx) + void set_from(irep_idt function, unsigned inx) { from_function = function_numbering.number(function); from_target_index = inx; } - void set_to(const irep_idt &function, unsigned inx) + void set_to(irep_idt function, unsigned inx) { to_function = function_numbering.number(function); to_target_index = inx; @@ -180,9 +180,8 @@ class value_set_fit { } - entryt(const idt &_identifier, const std::string _suffix): - identifier(_identifier), - suffix(_suffix) + entryt(idt _identifier, const std::string _suffix) + : identifier(_identifier), suffix(_suffix) { } }; @@ -200,16 +199,14 @@ class value_set_fit std::vector get_value_set(const exprt &expr, const namespacet &ns) const; - expr_sett &get( - const idt &identifier, - const std::string &suffix); + expr_sett &get(idt identifier, const std::string &suffix); void clear() { values.clear(); } - void add_var(const idt &id) + void add_var(idt id) { get_entry(id, ""); } @@ -219,7 +216,7 @@ class value_set_fit get_entry(e.identifier, e.suffix); } - entryt &get_entry(const idt &id, const std::string &suffix) + entryt &get_entry(idt id, const std::string &suffix) { return get_entry(entryt(id, suffix)); } @@ -271,7 +268,7 @@ class value_set_fit const namespacet &ns); void do_function_call( - const irep_idt &function, + irep_idt function, const exprt::operandst &arguments, const namespacet &ns); diff --git a/src/pointer-analysis/value_sets.h b/src/pointer-analysis/value_sets.h index 2b04626d5f4..1b548b14970 100644 --- a/src/pointer-analysis/value_sets.h +++ b/src/pointer-analysis/value_sets.h @@ -29,7 +29,7 @@ class value_setst // this is not const to allow a lazy evaluation virtual std::vector get_values( - const irep_idt &function_id, + irep_idt function_id, goto_programt::const_targett l, const exprt &expr) = 0; diff --git a/src/solvers/flattening/boolbv_map.cpp b/src/solvers/flattening/boolbv_map.cpp index 9c1b2747948..543ed34181d 100644 --- a/src/solvers/flattening/boolbv_map.cpp +++ b/src/solvers/flattening/boolbv_map.cpp @@ -39,7 +39,7 @@ void boolbv_mapt::show(std::ostream &out) const } const bvt &boolbv_mapt::get_literals( - const irep_idt &identifier, + irep_idt identifier, const typet &type, std::size_t width) { @@ -73,7 +73,7 @@ const bvt &boolbv_mapt::get_literals( } void boolbv_mapt::set_literals( - const irep_idt &identifier, + irep_idt identifier, const typet &type, const bvt &literals) { @@ -115,9 +115,7 @@ void boolbv_mapt::set_literals( } } -void boolbv_mapt::erase_literals( - const irep_idt &identifier, - const typet &) +void boolbv_mapt::erase_literals(irep_idt identifier, const typet &) { mapping.erase(identifier); } diff --git a/src/solvers/flattening/boolbv_map.h b/src/solvers/flattening/boolbv_map.h index a9ba3063079..381d78399b1 100644 --- a/src/solvers/flattening/boolbv_map.h +++ b/src/solvers/flattening/boolbv_map.h @@ -39,22 +39,16 @@ class boolbv_mapt void show(std::ostream &out) const; - const bvt &get_literals( - const irep_idt &identifier, - const typet &type, - std::size_t width); + const bvt & + get_literals(irep_idt identifier, const typet &type, std::size_t width); - void set_literals( - const irep_idt &identifier, - const typet &type, - const bvt &literals); + void + set_literals(irep_idt identifier, const typet &type, const bvt &literals); - void erase_literals( - const irep_idt &identifier, - const typet &type); + void erase_literals(irep_idt identifier, const typet &type); std::optional> - get_map_entry(const irep_idt &identifier) const + get_map_entry(irep_idt identifier) const { const auto entry = mapping.find(identifier); if(entry == mapping.end()) diff --git a/src/solvers/flattening/boolbv_width.cpp b/src/solvers/flattening/boolbv_width.cpp index 998312fd37e..04fce2fe726 100644 --- a/src/solvers/flattening/boolbv_width.cpp +++ b/src/solvers/flattening/boolbv_width.cpp @@ -223,9 +223,8 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const return cache_entry; } -const boolbv_widtht::membert &boolbv_widtht::get_member( - const struct_typet &type, - const irep_idt &member) const +const boolbv_widtht::membert & +boolbv_widtht::get_member(const struct_typet &type, irep_idt member) const { const auto &entry_opt = get_entry(type); CHECK_RETURN(entry_opt.has_value()); diff --git a/src/solvers/flattening/boolbv_width.h b/src/solvers/flattening/boolbv_width.h index d6e66f75c09..c086b0db862 100644 --- a/src/solvers/flattening/boolbv_width.h +++ b/src/solvers/flattening/boolbv_width.h @@ -41,8 +41,7 @@ class boolbv_widtht std::size_t offset, width; }; - const membert & - get_member(const struct_typet &type, const irep_idt &member) const; + const membert &get_member(const struct_typet &type, irep_idt member) const; protected: const namespacet &ns; diff --git a/src/solvers/prop/prop.h b/src/solvers/prop/prop.h index dda20bfef39..cc58a15c04a 100644 --- a/src/solvers/prop/prop.h +++ b/src/solvers/prop/prop.h @@ -92,7 +92,9 @@ class propt // variables virtual literalt new_variable()=0; - virtual void set_variable_name(literalt, const irep_idt &) { } + virtual void set_variable_name(literalt, irep_idt) + { + } virtual size_t no_variables() const=0; virtual bvt new_variables(std::size_t width); diff --git a/src/solvers/prop/prop_conv_solver.cpp b/src/solvers/prop/prop_conv_solver.cpp index 575fdfc6565..c1b2b222dc5 100644 --- a/src/solvers/prop/prop_conv_solver.cpp +++ b/src/solvers/prop/prop_conv_solver.cpp @@ -57,7 +57,7 @@ exprt prop_conv_solvert::handle(const exprt &expr) return literal_exprt(l); } -literalt prop_conv_solvert::get_literal(const irep_idt &identifier) +literalt prop_conv_solvert::get_literal(irep_idt identifier) { auto result = symbols.insert(std::pair(identifier, literalt())); diff --git a/src/solvers/prop/prop_conv_solver.h b/src/solvers/prop/prop_conv_solver.h index f8bcb40fda1..e0905c4b53b 100644 --- a/src/solvers/prop/prop_conv_solver.h +++ b/src/solvers/prop/prop_conv_solver.h @@ -120,7 +120,7 @@ class prop_conv_solvert : public conflict_providert, // symbols symbolst symbols; - virtual literalt get_literal(const irep_idt &symbol); + virtual literalt get_literal(irep_idt symbol); // cache cachet cache; diff --git a/src/solvers/smt2/smt2_conv.cpp b/src/solvers/smt2/smt2_conv.cpp index d118a55ef32..c8c3357079f 100644 --- a/src/solvers/smt2/smt2_conv.cpp +++ b/src/solvers/smt2/smt2_conv.cpp @@ -275,9 +275,7 @@ static bool is_zero_width(const typet &type, const namespacet &ns) return false; } -void smt2_convt::define_object_size( - const irep_idt &id, - const object_size_exprt &expr) +void smt2_convt::define_object_size(irep_idt id, const object_size_exprt &expr) { const exprt &ptr = expr.pointer(); std::size_t pointer_width = boolbv_width(ptr.type()); @@ -1094,7 +1092,7 @@ static bool is_smt2_simple_identifier(const std::string &identifier) return true; } -std::string smt2_convt::convert_identifier(const irep_idt &identifier) +std::string smt2_convt::convert_identifier(irep_idt identifier) { // Is this a "simple identifier"? if(is_smt2_simple_identifier(id2string(identifier))) diff --git a/src/solvers/smt2/smt2_conv.h b/src/solvers/smt2/smt2_conv.h index ca94493a6be..7f381cea9aa 100644 --- a/src/solvers/smt2/smt2_conv.h +++ b/src/solvers/smt2/smt2_conv.h @@ -88,7 +88,7 @@ class smt2_convt : public stack_decision_proceduret std::size_t get_number_of_solver_calls() const override; - static std::string convert_identifier(const irep_idt &identifier); + static std::string convert_identifier(irep_idt identifier); void set_converter(irep_idt id, std::function converter) { @@ -212,7 +212,7 @@ class smt2_convt : public stack_decision_proceduret class smt2_symbolt : public nullary_exprt { public: - smt2_symbolt(const irep_idt &_identifier, const typet &_type) + smt2_symbolt(irep_idt _identifier, const typet &_type) : nullary_exprt(ID_smt2_symbol, _type) { set(ID_identifier, _identifier); } @@ -241,7 +241,7 @@ class smt2_convt : public stack_decision_proceduret void convert_address_of_rec( const exprt &expr, const pointer_typet &result_type); - void define_object_size(const irep_idt &id, const object_size_exprt &expr); + void define_object_size(irep_idt id, const object_size_exprt &expr); // keeps track of all non-Boolean symbols and their value struct identifiert diff --git a/src/solvers/smt2/smt2_parser.cpp b/src/solvers/smt2/smt2_parser.cpp index 94ceb8b3306..7dd29a67640 100644 --- a/src/solvers/smt2/smt2_parser.cpp +++ b/src/solvers/smt2/smt2_parser.cpp @@ -423,7 +423,7 @@ exprt smt2_parsert::function_application_ieee_float_eq( } exprt smt2_parsert::function_application_ieee_float_op( - const irep_idt &id, + irep_idt id, const exprt::operandst &op) { if(op.size() != 3) diff --git a/src/solvers/smt2/smt2_parser.h b/src/solvers/smt2/smt2_parser.h index cc923e6b67e..6b561966317 100644 --- a/src/solvers/smt2/smt2_parser.h +++ b/src/solvers/smt2/smt2_parser.h @@ -150,9 +150,7 @@ class smt2_parsert void setup_expressions(); exprt expression(); exprt function_application(); - exprt function_application_ieee_float_op( - const irep_idt &, - const exprt::operandst &); + exprt function_application_ieee_float_op(irep_idt, const exprt::operandst &); exprt function_application_ieee_float_eq(const exprt::operandst &); exprt function_application_fp(const exprt::operandst &); exprt::operandst operands(); diff --git a/src/solvers/smt2_incremental/ast/smt_commands.cpp b/src/solvers/smt2_incremental/ast/smt_commands.cpp index ca16b6a3311..be40df29707 100644 --- a/src/solvers/smt2_incremental/ast/smt_commands.cpp +++ b/src/solvers/smt2_incremental/ast/smt_commands.cpp @@ -179,7 +179,7 @@ const smt_optiont &smt_set_option_commandt::option() const } template -void accept(const smt_commandt &command, const irep_idt &id, visitort &&visitor) +void accept(const smt_commandt &command, irep_idt id, visitort &&visitor) { #define COMMAND_ID(the_id) \ if(id == ID_smt_##the_id##_command) \ diff --git a/src/solvers/smt2_incremental/ast/smt_logics.cpp b/src/solvers/smt2_incremental/ast/smt_logics.cpp index 8412c5c8c8c..eb7a5fc85ab 100644 --- a/src/solvers/smt2_incremental/ast/smt_logics.cpp +++ b/src/solvers/smt2_incremental/ast/smt_logics.cpp @@ -20,7 +20,7 @@ bool smt_logict::operator!=(const smt_logict &other) const } template -void accept(const smt_logict &logic, const irep_idt &id, visitort &&visitor) +void accept(const smt_logict &logic, irep_idt id, visitort &&visitor) { #define LOGIC_ID(the_id, the_name) \ if(id == ID_smt_logic_##the_id) \ diff --git a/src/solvers/smt2_incremental/ast/smt_options.cpp b/src/solvers/smt2_incremental/ast/smt_options.cpp index ab573690948..3ebe00e4147 100644 --- a/src/solvers/smt2_incremental/ast/smt_options.cpp +++ b/src/solvers/smt2_incremental/ast/smt_options.cpp @@ -35,7 +35,7 @@ bool smt_option_produce_modelst::setting() const } template -void accept(const smt_optiont &option, const irep_idt &id, visitort &&visitor) +void accept(const smt_optiont &option, irep_idt id, visitort &&visitor) { #define OPTION_ID(the_id) \ if(id == ID_smt_option_##the_id) \ diff --git a/src/solvers/smt2_incremental/ast/smt_sorts.cpp b/src/solvers/smt2_incremental/ast/smt_sorts.cpp index 589a21df8c9..a83c4f295db 100644 --- a/src/solvers/smt2_incremental/ast/smt_sorts.cpp +++ b/src/solvers/smt2_incremental/ast/smt_sorts.cpp @@ -84,7 +84,7 @@ const smt_sortt &smt_array_sortt::element_sort() const } template -void accept(const smt_sortt &sort, const irep_idt &id, visitort &&visitor) +void accept(const smt_sortt &sort, irep_idt id, visitort &&visitor) { #define SORT_ID(the_id) \ if(id == ID_smt_##the_id##_sort) \ diff --git a/src/solvers/smt2_incremental/ast/smt_terms.cpp b/src/solvers/smt2_incremental/ast/smt_terms.cpp index f679217e1c4..02be309f701 100644 --- a/src/solvers/smt2_incremental/ast/smt_terms.cpp +++ b/src/solvers/smt2_incremental/ast/smt_terms.cpp @@ -221,7 +221,7 @@ smt_exists_termt::bound_variables() const } template -void accept(const smt_termt &term, const irep_idt &id, visitort &&visitor) +void accept(const smt_termt &term, irep_idt id, visitort &&visitor) { #define TERM_ID(the_id) \ if(id == ID_smt_##the_id##_term) \ diff --git a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp index 2817ba012fe..b90632d5749 100644 --- a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp +++ b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp @@ -165,7 +165,7 @@ void smt2_incremental_decision_proceduret::define_array_function( void send_function_definition( const exprt &expr, - const irep_idt &symbol_identifier, + irep_idt symbol_identifier, const std::unique_ptr &solver_process, std::unordered_map &expression_identifiers, diff --git a/src/solvers/smt2_incremental/smt_to_smt2_string.cpp b/src/solvers/smt2_incremental/smt_to_smt2_string.cpp index 4d3558af3cc..f848357818f 100644 --- a/src/solvers/smt2_incremental/smt_to_smt2_string.cpp +++ b/src/solvers/smt2_incremental/smt_to_smt2_string.cpp @@ -16,7 +16,7 @@ #include #include -static std::string escape_identifier(const irep_idt &identifier) +static std::string escape_identifier(irep_idt identifier) { return smt2_convt::convert_identifier(identifier); } diff --git a/src/solvers/strings/array_pool.cpp b/src/solvers/strings/array_pool.cpp index 4b88e8fad56..1b276ba1644 100644 --- a/src/solvers/strings/array_pool.cpp +++ b/src/solvers/strings/array_pool.cpp @@ -10,8 +10,7 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #include -symbol_exprt symbol_generatort:: -operator()(const irep_idt &prefix, const typet &type) +symbol_exprt symbol_generatort::operator()(irep_idt prefix, const typet &type) { std::ostringstream buf; buf << "string_refinement#" << prefix << "#" << ++symbol_count; diff --git a/src/solvers/strings/array_pool.h b/src/solvers/strings/array_pool.h index fc210f76f5f..07412a2489f 100644 --- a/src/solvers/strings/array_pool.h +++ b/src/solvers/strings/array_pool.h @@ -24,8 +24,7 @@ class symbol_generatort final /// Generate a new symbol expression of the given \p type with some \p prefix /// \return a symbol of type \p type whose name starts with /// "string_refinement#" followed by \p prefix - symbol_exprt - operator()(const irep_idt &prefix, const typet &type = bool_typet()); + symbol_exprt operator()(irep_idt prefix, const typet &type = bool_typet()); private: unsigned symbol_count = 0; diff --git a/src/solvers/strings/string_format_builtin_function.cpp b/src/solvers/strings/string_format_builtin_function.cpp index 14e32a86e8c..48cbf46e4df 100644 --- a/src/solvers/strings/string_format_builtin_function.cpp +++ b/src/solvers/strings/string_format_builtin_function.cpp @@ -23,7 +23,7 @@ Author: Romain Brenguier, Joel Allred static exprt format_arg_from_string( const array_string_exprt &string, - const irep_idt &id, + irep_idt id, array_poolt &array_pool); string_format_builtin_functiont::string_format_builtin_functiont( @@ -242,7 +242,7 @@ add_axioms_for_format_specifier( /// The characters of `string` must be of type `unsignedbv_typet(16)`. static exprt format_arg_from_string( const array_string_exprt &string, - const irep_idt &id, + irep_idt id, array_poolt &array_pool) { PRECONDITION( diff --git a/src/statement-list/converters/expr2statement_list.cpp b/src/statement-list/converters/expr2statement_list.cpp index 6c0dae703fe..ec4791ffc0f 100644 --- a/src/statement-list/converters/expr2statement_list.cpp +++ b/src/statement-list/converters/expr2statement_list.cpp @@ -288,7 +288,7 @@ void expr2stlt::convert_first_non_trivial_operand(std::vector &operands) inside_bit_string = true; } -irep_idt expr2stlt::id_shorthand(const irep_idt &identifier) +irep_idt expr2stlt::id_shorthand(irep_idt identifier) { const symbolt *symbol; std::string shorthand = id2string(identifier); diff --git a/src/statement-list/converters/expr2statement_list.h b/src/statement-list/converters/expr2statement_list.h index 2071c92c934..3d1a9013ab5 100644 --- a/src/statement-list/converters/expr2statement_list.h +++ b/src/statement-list/converters/expr2statement_list.h @@ -148,7 +148,7 @@ class expr2stlt /// looking up the symbol or cutting the scope when needed. /// \param identifier: Identifier that should be converted. /// \return Converted identifier. - irep_idt id_shorthand(const irep_idt &identifier); + irep_idt id_shorthand(irep_idt identifier); }; #endif // CPROVER_STATEMENT_LIST_CONVERTERS_EXPR2STATEMENT_LIST_H diff --git a/src/statement-list/statement_list_entry_point.cpp b/src/statement-list/statement_list_entry_point.cpp index 97a2323297a..231e9adecac 100644 --- a/src/statement-list/statement_list_entry_point.cpp +++ b/src/statement-list/statement_list_entry_point.cpp @@ -41,7 +41,7 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com static bool is_main_symbol_invalid( const symbol_table_baset &symbol_table, message_handlert &message_handler, - const irep_idt &main_symbol_name) + irep_idt main_symbol_name) { bool found = false; diff --git a/src/statement-list/statement_list_parse_tree.cpp b/src/statement-list/statement_list_parse_tree.cpp index 16ddf744136..857c1c740df 100644 --- a/src/statement-list/statement_list_parse_tree.cpp +++ b/src/statement-list/statement_list_parse_tree.cpp @@ -72,14 +72,14 @@ void statement_list_parse_treet::networkt::add_instruction( } statement_list_parse_treet::tia_modulet::tia_modulet( - const irep_idt &name, + irep_idt name, const std::string &version) : name(name), version(version) { } statement_list_parse_treet::function_blockt::function_blockt( - const irep_idt &name, + irep_idt name, const std::string &version) : tia_modulet(name, version) { @@ -110,7 +110,7 @@ void statement_list_parse_treet::swap(statement_list_parse_treet &other) } statement_list_parse_treet::functiont::functiont( - const irep_idt &name, + irep_idt name, const std::string &version, const typet &return_type) : tia_modulet(name, version), return_type(return_type) diff --git a/src/statement-list/statement_list_parse_tree.h b/src/statement-list/statement_list_parse_tree.h index e7fa7aa50e0..cb25c125a04 100644 --- a/src/statement-list/statement_list_parse_tree.h +++ b/src/statement-list/statement_list_parse_tree.h @@ -122,7 +122,7 @@ class statement_list_parse_treet /// Create the module \p name with a specific \p version. /// \param name: Name of the module. /// \param version: Version of the module. - tia_modulet(const irep_idt &name, const std::string &version); + tia_modulet(irep_idt name, const std::string &version); }; /// Structure for a simple function in Statement List. Includes fields for @@ -138,7 +138,7 @@ class statement_list_parse_treet /// \param version: Version of the function. /// \param return_type: Type of the function's return value. functiont( - const irep_idt &name, + irep_idt name, const std::string &version, const typet &return_type); }; @@ -154,7 +154,7 @@ class statement_list_parse_treet /// Create the function block \p name with a specific \p version. /// \param name: Name of the function block. /// \param version: Version of the function block. - function_blockt(const irep_idt &name, const std::string &version); + function_blockt(irep_idt name, const std::string &version); /// Adds a variable declaration to the list of static variables. /// \param declaration: Variable declaration to be added. diff --git a/src/statement-list/statement_list_typecheck.cpp b/src/statement-list/statement_list_typecheck.cpp index f8ecf3a3fe2..10a5b0f1f09 100644 --- a/src/statement-list/statement_list_typecheck.cpp +++ b/src/statement-list/statement_list_typecheck.cpp @@ -69,7 +69,7 @@ static const std::vector logic_sequence_terminators = { /// \return Parameter of the data block. static code_typet::parametert create_data_block_parameter( const struct_typet &data_block_type, - const irep_idt &function_block_name) + irep_idt function_block_name) { const pointer_typet db_ptr{data_block_type, STATEMENT_LIST_PTR_WIDTH}; code_typet::parametert param{db_ptr}; @@ -264,7 +264,7 @@ struct_typet statement_list_typecheckt::create_instance_data_block_type( void statement_list_typecheckt::typecheck_function_block_var_decls( const statement_list_parse_treet::var_declarationst &var_decls, struct_union_typet::componentst &components, - const irep_idt &var_property) + irep_idt var_property) { for(const statement_list_parse_treet::var_declarationt &declaration : var_decls) @@ -280,8 +280,8 @@ void statement_list_typecheckt::typecheck_function_block_var_decls( void statement_list_typecheckt::typecheck_function_var_decls( const statement_list_parse_treet::var_declarationst &var_decls, code_typet::parameterst ¶ms, - const irep_idt &function_name, - const irep_idt &var_property) + irep_idt function_name, + irep_idt var_property) { for(const statement_list_parse_treet::var_declarationt &declaration : var_decls) @@ -1401,7 +1401,7 @@ void statement_list_typecheckt::typecheck_statement_list_accu_real_arith( } void statement_list_typecheckt::typecheck_accumulator_compare_instruction( - const irep_idt &comparison) + irep_idt comparison) { const exprt &accu1{accumulator.back()}; const exprt &accu2{accumulator.at(accumulator.size() - 2)}; @@ -1411,7 +1411,7 @@ void statement_list_typecheckt::typecheck_accumulator_compare_instruction( } void statement_list_typecheckt::typecheck_label_reference( - const irep_idt &label, + irep_idt label, bool sets_fc_false) { // If the label is already present in the list, check if it matches the @@ -1520,7 +1520,7 @@ exprt statement_list_typecheckt::typecheck_simple_boolean_instruction_operand( exprt statement_list_typecheckt::typecheck_identifier( const symbolt &tia_element, - const irep_idt &identifier) + irep_idt identifier) { const code_typet &element_type{to_code_type(tia_element.type)}; diff --git a/src/statement-list/statement_list_typecheck.h b/src/statement-list/statement_list_typecheck.h index c37fc401a58..796e81b348e 100644 --- a/src/statement-list/statement_list_typecheck.h +++ b/src/statement-list/statement_list_typecheck.h @@ -215,7 +215,7 @@ class statement_list_typecheckt : public typecheckt void typecheck_function_block_var_decls( const statement_list_parse_treet::var_declarationst &var_decls, struct_union_typet::componentst &components, - const irep_idt &var_property); + irep_idt var_property); /// Performs a typecheck on a variable declaration list and saves the result /// to the given component element. @@ -228,8 +228,8 @@ class statement_list_typecheckt : public typecheckt void typecheck_function_var_decls( const statement_list_parse_treet::var_declarationst &var_decls, code_typet::parameterst ¶ms, - const irep_idt &function_name, - const irep_idt &var_property); + irep_idt function_name, + irep_idt var_property); /// Performs a typecheck on the temp variables of a TIA module and saves the /// result to the given symbol value. @@ -667,7 +667,7 @@ class statement_list_typecheckt : public typecheckt /// Performs a typecheck on an STL comparison instruction. Modifies the RLO. /// \param comparison: ID of the compare expression that should be pushed to /// the RLO. - void typecheck_accumulator_compare_instruction(const irep_idt &comparison); + void typecheck_accumulator_compare_instruction(irep_idt comparison); /// Checks if the given label is already present and compares the current /// state with it. If there is no entry for the label, a new jump location @@ -675,14 +675,13 @@ class statement_list_typecheckt : public typecheckt /// \param label: Label to check. /// \param sets_fc_false: Whether the encountered jump instruction sets the /// /FC bit to false. - void typecheck_label_reference(const irep_idt &label, bool sets_fc_false); + void typecheck_label_reference(irep_idt label, bool sets_fc_false); /// Performs a typecheck on the given identifier and returns its symbol. /// \param identifier: Identifier that should be checked. /// \param tia_element: Symbol representation of the current TIA module. /// \return Expression including the symbol's name and type. - exprt - typecheck_identifier(const symbolt &tia_element, const irep_idt &identifier); + exprt typecheck_identifier(const symbolt &tia_element, irep_idt identifier); /// Performs a typecheck on a call of __CPOVER_ASSERT and saves the result /// to the given symbol. diff --git a/src/util/arith_tools.cpp b/src/util/arith_tools.cpp index f0c1c2793ba..a20a8e8264d 100644 --- a/src/util/arith_tools.cpp +++ b/src/util/arith_tools.cpp @@ -283,10 +283,7 @@ void mp_max(mp_integer &a, const mp_integer &b) /// \param src: the bitvector representation /// \param width: the number of bits in the bitvector /// \param bit_index: index (0 is the least significant) -bool get_bvrep_bit( - const irep_idt &src, - std::size_t width, - std::size_t bit_index) +bool get_bvrep_bit(irep_idt src, std::size_t width, std::size_t bit_index) { PRECONDITION(bit_index < width); @@ -372,8 +369,8 @@ make_bvrep(const std::size_t width, const std::function f) /// \param f: the functor /// \return new bitvector representation irep_idt bvrep_bitwise_op( - const irep_idt &a, - const irep_idt &b, + irep_idt a, + irep_idt b, const std::size_t width, const std::function f) { @@ -389,7 +386,7 @@ irep_idt bvrep_bitwise_op( /// \param f: the functor /// \return new bitvector representation irep_idt bvrep_bitwise_op( - const irep_idt &a, + irep_idt a, const std::size_t width, const std::function f) { @@ -423,7 +420,7 @@ irep_idt integer2bvrep(const mp_integer &src, std::size_t width) } /// convert a bit-vector representation (possibly signed) to integer -mp_integer bvrep2integer(const irep_idt &src, std::size_t width, bool is_signed) +mp_integer bvrep2integer(irep_idt src, std::size_t width, bool is_signed) { if(is_signed) { diff --git a/src/util/arith_tools.h b/src/util/arith_tools.h index 92aaf3686f8..ed054cfac2d 100644 --- a/src/util/arith_tools.h +++ b/src/util/arith_tools.h @@ -168,15 +168,12 @@ bool is_power_of_two(const mp_integer &); void mp_min(mp_integer &a, const mp_integer &b); void mp_max(mp_integer &a, const mp_integer &b); -bool get_bvrep_bit( - const irep_idt &src, - std::size_t width, - std::size_t bit_index); +bool get_bvrep_bit(irep_idt src, std::size_t width, std::size_t bit_index); irep_idt make_bvrep(const std::size_t width, const std::function f); irep_idt integer2bvrep(const mp_integer &, std::size_t width); -mp_integer bvrep2integer(const irep_idt &, std::size_t width, bool is_signed); +mp_integer bvrep2integer(irep_idt, std::size_t width, bool is_signed); #endif // CPROVER_UTIL_ARITH_TOOLS_H diff --git a/src/util/bitvector_expr.cpp b/src/util/bitvector_expr.cpp index e578f52b6ea..69a29a87f2a 100644 --- a/src/util/bitvector_expr.cpp +++ b/src/util/bitvector_expr.cpp @@ -12,10 +12,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "bitvector_types.h" #include "mathematical_types.h" -shift_exprt::shift_exprt( - exprt _src, - const irep_idt &_id, - const std::size_t _distance) +shift_exprt::shift_exprt(exprt _src, irep_idt _id, const std::size_t _distance) : binary_exprt(std::move(_src), _id, from_integer(_distance, integer_typet())) { } diff --git a/src/util/bitvector_expr.h b/src/util/bitvector_expr.h index b3dcb793602..19941af960f 100644 --- a/src/util/bitvector_expr.h +++ b/src/util/bitvector_expr.h @@ -421,12 +421,12 @@ inline bitnand_exprt &to_bitnand_expr(exprt &expr) class shift_exprt : public binary_exprt { public: - shift_exprt(exprt _src, const irep_idt &_id, exprt _distance) + shift_exprt(exprt _src, irep_idt _id, exprt _distance) : binary_exprt(std::move(_src), _id, std::move(_distance)) { } - shift_exprt(exprt _src, const irep_idt &_id, const std::size_t _distance); + shift_exprt(exprt _src, irep_idt _id, const std::size_t _distance); exprt &op() { @@ -1056,7 +1056,7 @@ inline popcount_exprt &to_popcount_expr(exprt &expr) class binary_overflow_exprt : public binary_predicate_exprt { public: - binary_overflow_exprt(exprt _lhs, const irep_idt &kind, exprt _rhs) + binary_overflow_exprt(exprt _lhs, irep_idt kind, exprt _rhs) : binary_predicate_exprt(std::move(_lhs), make_id(kind), std::move(_rhs)) { INVARIANT( @@ -1090,14 +1090,14 @@ class binary_overflow_exprt : public binary_predicate_exprt } /// Returns true iff \p id is a valid identifier of a `binary_overflow_exprt`. - static bool valid_id(const irep_idt &id) + static bool valid_id(irep_idt id) { return id == ID_overflow_plus || id == ID_overflow_mult || id == ID_overflow_minus || id == ID_overflow_shl; } private: - static irep_idt make_id(const irep_idt &kind) + static irep_idt make_id(irep_idt kind) { if(valid_id(kind)) return kind; @@ -1223,7 +1223,7 @@ inline bool can_cast_expr(const exprt &base) class unary_overflow_exprt : public unary_predicate_exprt { public: - unary_overflow_exprt(const irep_idt &kind, exprt _op) + unary_overflow_exprt(irep_idt kind, exprt _op) : unary_predicate_exprt("overflow-" + id2string(kind), std::move(_op)) { } @@ -1656,7 +1656,7 @@ inline saturating_minus_exprt &to_saturating_minus_expr(exprt &expr) class overflow_result_exprt : public expr_protectedt { public: - overflow_result_exprt(exprt _lhs, const irep_idt &kind, exprt _rhs) + overflow_result_exprt(exprt _lhs, irep_idt kind, exprt _rhs) : expr_protectedt( make_id(kind), struct_typet{ @@ -1670,7 +1670,7 @@ class overflow_result_exprt : public expr_protectedt "of expected valid kinds."); } - overflow_result_exprt(exprt _op, const irep_idt &kind) + overflow_result_exprt(exprt _op, irep_idt kind) : expr_protectedt( make_id(kind), struct_typet{ @@ -1721,7 +1721,7 @@ class overflow_result_exprt : public expr_protectedt } /// Returns true iff \p id is a valid identifier of an `overflow_exprt`. - static bool valid_id(const irep_idt &id) + static bool valid_id(irep_idt id) { return id == ID_overflow_result_plus || id == ID_overflow_result_mult || id == ID_overflow_result_minus || id == ID_overflow_result_shl || @@ -1729,7 +1729,7 @@ class overflow_result_exprt : public expr_protectedt } private: - static irep_idt make_id(const irep_idt &kind) + static irep_idt make_id(irep_idt kind) { return "overflow_result-" + id2string(kind); } diff --git a/src/util/bitvector_types.h b/src/util/bitvector_types.h index f3db88296f1..3cb72e41e01 100644 --- a/src/util/bitvector_types.h +++ b/src/util/bitvector_types.h @@ -26,16 +26,16 @@ class constant_exprt; class bitvector_typet : public typet { public: - explicit bitvector_typet(const irep_idt &_id) : typet(_id) + explicit bitvector_typet(irep_idt _id) : typet(_id) { } - bitvector_typet(const irep_idt &_id, std::size_t width) : typet(_id) + bitvector_typet(irep_idt _id, std::size_t width) : typet(_id) { set_width(width); } - bitvector_typet(const irep_idt &_id, mp_integer _width) : typet(_id) + bitvector_typet(irep_idt _id, mp_integer _width) : typet(_id) { width(_width); } @@ -165,12 +165,12 @@ inline bv_typet &to_bv_type(typet &type) class integer_bitvector_typet : public bitvector_typet { public: - integer_bitvector_typet(const irep_idt &id, std::size_t width) + integer_bitvector_typet(irep_idt id, std::size_t width) : bitvector_typet(id, width) { } - integer_bitvector_typet(const irep_idt &id, const mp_integer &width) + integer_bitvector_typet(irep_idt id, const mp_integer &width) : bitvector_typet(id, width) { } diff --git a/src/util/c_types.cpp b/src/util/c_types.cpp index 2b18e322f59..2c52b33c161 100644 --- a/src/util/c_types.cpp +++ b/src/util/c_types.cpp @@ -248,7 +248,7 @@ empty_typet void_type() return result; } -std::string c_type_as_string(const irep_idt &c_type) +std::string c_type_as_string(irep_idt c_type) { if(c_type==ID_signed_int) return "signed int"; diff --git a/src/util/c_types.h b/src/util/c_types.h index a16151d17d8..d5d1b4780b8 100644 --- a/src/util/c_types.h +++ b/src/util/c_types.h @@ -198,7 +198,7 @@ inline union_typet &to_union_type(typet &type) class union_tag_typet : public struct_or_union_tag_typet { public: - explicit union_tag_typet(const irep_idt &identifier) + explicit union_tag_typet(irep_idt identifier) : struct_or_union_tag_typet(ID_union_tag, identifier) { } @@ -250,7 +250,7 @@ class c_enum_typet : public type_with_subtypet { return get(ID_value); } - void set_value(const irep_idt &value) + void set_value(irep_idt value) { set(ID_value, value); } @@ -258,7 +258,7 @@ class c_enum_typet : public type_with_subtypet { return get(ID_identifier); } - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_identifier, identifier); } @@ -266,7 +266,7 @@ class c_enum_typet : public type_with_subtypet { return get(ID_base_name); } - void set_base_name(const irep_idt &base_name) + void set_base_name(irep_idt base_name) { set(ID_base_name, base_name); } @@ -351,7 +351,7 @@ inline c_enum_typet &to_c_enum_type(typet &type) class c_enum_tag_typet : public tag_typet { public: - explicit c_enum_tag_typet(const irep_idt &identifier) + explicit c_enum_tag_typet(irep_idt identifier) : tag_typet(ID_c_enum_tag, identifier) { } @@ -509,6 +509,6 @@ reference_typet reference_type(const typet &); // Turns an ID_C_c_type into a string, e.g., // ID_signed_int gets "signed int". -std::string c_type_as_string(const irep_idt &); +std::string c_type_as_string(irep_idt); #endif // CPROVER_UTIL_C_TYPES_H diff --git a/src/util/c_types_util.h b/src/util/c_types_util.h index bc943f914e3..a0ddf59246d 100644 --- a/src/util/c_types_util.h +++ b/src/util/c_types_util.h @@ -83,7 +83,7 @@ inline bool is_c_enum_type(const typet &type) /// \return constant, that could be assigned as the value of an expression with /// type c_enum. inline constant_exprt convert_member_name_to_enum_value( - const irep_idt &member_name, + irep_idt member_name, const c_enum_typet &c_enum) { for(const auto &enum_value : c_enum.members()) diff --git a/src/util/config.cpp b/src/util/config.cpp index da70a3b9888..7e93ae4b8a6 100644 --- a/src/util/config.cpp +++ b/src/util/config.cpp @@ -217,7 +217,7 @@ void configt::ansi_ct::set_arch_spec_x86_64() } } -void configt::ansi_ct::set_arch_spec_power(const irep_idt &subarch) +void configt::ansi_ct::set_arch_spec_power(irep_idt subarch) { if(subarch=="powerpc") set_ILP32(); @@ -278,7 +278,7 @@ void configt::ansi_ct::set_arch_spec_power(const irep_idt &subarch) } } -void configt::ansi_ct::set_arch_spec_arm(const irep_idt &subarch) +void configt::ansi_ct::set_arch_spec_arm(irep_idt subarch) { if(subarch=="arm64") { @@ -353,7 +353,7 @@ void configt::ansi_ct::set_arch_spec_alpha() } } -void configt::ansi_ct::set_arch_spec_mips(const irep_idt &subarch) +void configt::ansi_ct::set_arch_spec_mips(irep_idt subarch) { if(subarch=="mipsel" || subarch=="mips" || @@ -486,7 +486,7 @@ void configt::ansi_ct::set_arch_spec_s390x() } } -void configt::ansi_ct::set_arch_spec_sparc(const irep_idt &subarch) +void configt::ansi_ct::set_arch_spec_sparc(irep_idt subarch) { if(subarch=="sparc64") { @@ -760,7 +760,7 @@ configt::cppt::cpp_standardt configt::cppt::default_cpp_standard() #endif } -void configt::set_arch(const irep_idt &arch) +void configt::set_arch(irep_idt arch) { ansi_c.arch=arch; diff --git a/src/util/config.h b/src/util/config.h index e1cdc3eb99c..49bf5c65ee8 100644 --- a/src/util/config.h +++ b/src/util/config.h @@ -251,14 +251,14 @@ class configt void set_arch_spec_i386(); void set_arch_spec_x86_64(); - void set_arch_spec_power(const irep_idt &subarch); - void set_arch_spec_arm(const irep_idt &subarch); + void set_arch_spec_power(irep_idt subarch); + void set_arch_spec_arm(irep_idt subarch); void set_arch_spec_alpha(); - void set_arch_spec_mips(const irep_idt &subarch); + void set_arch_spec_mips(irep_idt subarch); void set_arch_spec_riscv64(); void set_arch_spec_s390(); void set_arch_spec_s390x(); - void set_arch_spec_sparc(const irep_idt &subarch); + void set_arch_spec_sparc(irep_idt subarch); void set_arch_spec_ia64(); void set_arch_spec_x32(); void set_arch_spec_v850(); @@ -389,7 +389,7 @@ class configt // this is the function to start executing std::optional main; - void set_arch(const irep_idt &); + void set_arch(irep_idt); void set_from_symbol_table(const symbol_table_baset &); diff --git a/src/util/dstring.h b/src/util/dstring.h index 38926cb754e..48d57727486 100644 --- a/src/util/dstring.h +++ b/src/util/dstring.h @@ -125,14 +125,17 @@ class dstringt final // ordering -- not the same as lexicographical ordering - bool operator< (const dstringt &b) const { return no=(const std::string &b) const { return as_string()>=b; } - int compare(const dstringt &b) const + int compare(dstringt b) const { if(no==b.no) return 0; // equal @@ -216,21 +219,24 @@ class dstringt final }; // the reference returned is guaranteed to be stable -inline const std::string &as_string(const dstringt &s) +inline const std::string &as_string(dstringt s) { return get_string_container().get_string(s.get_no()); } // NOLINTNEXTLINE(readability/identifiers) struct dstring_hash { - size_t operator()(const dstringt &s) const { return s.hash(); } + size_t operator()(dstringt s) const + { + return s.hash(); + } }; -inline size_t hash_string(const dstringt &s) +inline size_t hash_string(dstringt s) { return s.hash(); } -inline std::ostream &operator<<(std::ostream &out, const dstringt &a) +inline std::ostream &operator<<(std::ostream &out, dstringt a) { return a.operator<<(out); } diff --git a/src/util/expr.h b/src/util/expr.h index b5bbfecce09..346a07b2c51 100644 --- a/src/util/expr.h +++ b/src/util/expr.h @@ -60,7 +60,9 @@ class exprt:public irept // constructors exprt() { } - explicit exprt(const irep_idt &_id):irept(_id) { } + explicit exprt(irep_idt _id) : irept(_id) + { + } exprt(irep_idt _id, typet _type) : irept(std::move(_id), {{ID_type, std::move(_type)}}, {}) @@ -75,7 +77,7 @@ class exprt:public irept { } - exprt(const irep_idt &id, typet type, source_locationt loc) + exprt(irep_idt id, typet type, source_locationt loc) : exprt(id, std::move(type)) { add_source_location() = std::move(loc); @@ -305,12 +307,12 @@ class exprt:public irept } protected: - exprt &add_expr(const irep_idt &name) + exprt &add_expr(irep_idt name) { return static_cast(add(name)); } - const exprt &find_expr(const irep_idt &name) const + const exprt &find_expr(irep_idt name) const { return static_cast(find(name)); } diff --git a/src/util/expr_util.cpp b/src/util/expr_util.cpp index 6e20238e988..05c9e7a7942 100644 --- a/src/util/expr_util.cpp +++ b/src/util/expr_util.cpp @@ -115,7 +115,7 @@ bool has_subexpr( return it != expr.depth_end(); } -bool has_subexpr(const exprt &src, const irep_idt &id) +bool has_subexpr(const exprt &src, irep_idt id) { return has_subexpr( src, [&](const exprt &subexpr) { return subexpr.id() == id; }); @@ -163,7 +163,7 @@ bool has_subtype( return false; } -bool has_subtype(const typet &type, const irep_idt &id, const namespacet &ns) +bool has_subtype(const typet &type, irep_idt id, const namespacet &ns) { return has_subtype( type, [&](const typet &subtype) { return subtype.id() == id; }, ns); diff --git a/src/util/expr_util.h b/src/util/expr_util.h index 3b4d1dfa9e4..438aecaff2f 100644 --- a/src/util/expr_util.h +++ b/src/util/expr_util.h @@ -51,7 +51,7 @@ exprt boolean_negate(const exprt &); bool has_subexpr(const exprt &, const std::function &pred); /// returns true if the expression has a subexpression with given ID -bool has_subexpr(const exprt &, const irep_idt &); +bool has_subexpr(const exprt &, irep_idt); /// returns true if any of the contained types satisfies pred /// \param type: a type @@ -70,7 +70,7 @@ bool has_subtype( const namespacet &ns); /// returns true if any of the contained types is id -bool has_subtype(const typet &, const irep_idt &id, const namespacet &); +bool has_subtype(const typet &, irep_idt id, const namespacet &); /// lift up an if_exprt one level if_exprt lift_if(const exprt &, std::size_t operand_number); diff --git a/src/util/find_symbols.cpp b/src/util/find_symbols.cpp index 4b15498c771..5187951d15d 100644 --- a/src/util/find_symbols.cpp +++ b/src/util/find_symbols.cpp @@ -266,7 +266,7 @@ void find_symbols(const exprt &src, std::set &dest) bool has_symbol_expr( const exprt &src, - const irep_idt &identifier, + irep_idt identifier, bool include_bound_symbols) { return !find_symbols( diff --git a/src/util/find_symbols.h b/src/util/find_symbols.h index c699ebd7380..711a7fb52cf 100644 --- a/src/util/find_symbols.h +++ b/src/util/find_symbols.h @@ -26,7 +26,7 @@ typedef std::unordered_set find_symbols_sett; /// \p include_bound_symbols is true, then bindings are included in the search. bool has_symbol_expr( const exprt &src, - const irep_idt &identifier, + irep_idt identifier, bool include_bound_symbols); /// Add to the set \p dest the sub-expressions of \p src with id ID_symbol, for diff --git a/src/util/floatbv_expr.h b/src/util/floatbv_expr.h index e11fda2a02e..b9f211493cc 100644 --- a/src/util/floatbv_expr.h +++ b/src/util/floatbv_expr.h @@ -427,11 +427,7 @@ inline ieee_float_notequal_exprt &to_ieee_float_notequal_expr(exprt &expr) class ieee_float_op_exprt : public ternary_exprt { public: - ieee_float_op_exprt( - const exprt &_lhs, - const irep_idt &_id, - exprt _rhs, - exprt _rm) + ieee_float_op_exprt(const exprt &_lhs, irep_idt _id, exprt _rhs, exprt _rm) : ternary_exprt(_id, _lhs, std::move(_rhs), std::move(_rm), _lhs.type()) { } diff --git a/src/util/fresh_symbol.cpp b/src/util/fresh_symbol.cpp index 8a3738b56c9..09c4fa5dd62 100644 --- a/src/util/fresh_symbol.cpp +++ b/src/util/fresh_symbol.cpp @@ -34,7 +34,7 @@ symbolt &get_fresh_aux_symbol( const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &symbol_mode, + irep_idt symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table) { @@ -73,7 +73,7 @@ symbolt &get_fresh_aux_symbol( const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &symbol_mode, + irep_idt symbol_mode, symbol_table_baset &symbol_table) { return get_fresh_aux_symbol( diff --git a/src/util/fresh_symbol.h b/src/util/fresh_symbol.h index 72d2ca22ac7..d15cad4c995 100644 --- a/src/util/fresh_symbol.h +++ b/src/util/fresh_symbol.h @@ -31,7 +31,7 @@ get_fresh_aux_symbol( const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &symbol_mode, + irep_idt symbol_mode, symbol_table_baset &symbol_table); #if defined(__GNUC__) && __GNUC__ >= 14 @@ -43,7 +43,7 @@ get_fresh_aux_symbol( const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, - const irep_idt &symbol_mode, + irep_idt symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table); diff --git a/src/util/interval.cpp b/src/util/interval.cpp index 8236240a1cf..cb109ab2dbd 100644 --- a/src/util/interval.cpp +++ b/src/util/interval.cpp @@ -471,7 +471,7 @@ constant_interval_exprt constant_interval_exprt::decrement() const constant_interval_exprt constant_interval_exprt::get_extremes( const constant_interval_exprt &a, const constant_interval_exprt &b, - const irep_idt &operation) + irep_idt operation) { std::vector results; @@ -572,7 +572,7 @@ exprt constant_interval_exprt::get_extreme( void constant_interval_exprt::generate_expression( const exprt &lhs, const exprt &rhs, - const irep_idt &operation, + irep_idt operation, std::vector &collection) { if(operation == ID_mult) @@ -790,7 +790,7 @@ exprt constant_interval_exprt::generate_modulo_expression( return simplified_expr(modulo_expr); } -constant_interval_exprt constant_interval_exprt::eval(const irep_idt &id) const +constant_interval_exprt constant_interval_exprt::eval(irep_idt id) const { if(id == ID_unary_plus) { @@ -813,7 +813,7 @@ constant_interval_exprt constant_interval_exprt::eval(const irep_idt &id) const } constant_interval_exprt constant_interval_exprt::eval( - const irep_idt &binary_operator, + irep_idt binary_operator, const constant_interval_exprt &other) const { if(binary_operator == ID_plus) @@ -899,7 +899,7 @@ constant_interval_exprt constant_interval_exprt::eval( exprt constant_interval_exprt::generate_shift_expression( const exprt &lhs, const exprt &rhs, - const irep_idt &operation) + irep_idt operation) { PRECONDITION(operation == ID_shl || operation == ID_ashr); @@ -936,8 +936,7 @@ exprt constant_interval_exprt::generate_shift_expression( } constant_interval_exprt -constant_interval_exprt::handle_constant_unary_expression( - const irep_idt &op) const +constant_interval_exprt::handle_constant_unary_expression(irep_idt op) const { if(is_single_value_interval()) { @@ -950,7 +949,7 @@ constant_interval_exprt::handle_constant_unary_expression( constant_interval_exprt constant_interval_exprt::handle_constant_binary_expression( const constant_interval_exprt &other, - const irep_idt &op) const + irep_idt op) const { PRECONDITION(is_single_value_interval() && other.is_single_value_interval()); auto expr = binary_exprt(get_lower(), op, other.get_lower()); diff --git a/src/util/interval.h b/src/util/interval.h index 9e70d2a637f..4d0f07a9fba 100644 --- a/src/util/interval.h +++ b/src/util/interval.h @@ -131,15 +131,14 @@ class constant_interval_exprt : public binary_exprt const exprt &get_upper() const; /** SET OF ARITHMETIC OPERATORS */ - constant_interval_exprt - handle_constant_unary_expression(const irep_idt &op) const; + constant_interval_exprt handle_constant_unary_expression(irep_idt op) const; constant_interval_exprt handle_constant_binary_expression( const constant_interval_exprt &other, - const irep_idt &) const; + irep_idt) const; - constant_interval_exprt eval(const irep_idt &unary_operator) const; + constant_interval_exprt eval(irep_idt unary_operator) const; constant_interval_exprt - eval(const irep_idt &binary_operator, const constant_interval_exprt &o) const; + eval(irep_idt binary_operator, const constant_interval_exprt &o) const; /* Unary arithmetic */ constant_interval_exprt unary_plus() const; @@ -366,7 +365,7 @@ class constant_interval_exprt : public binary_exprt static constant_interval_exprt get_extremes( const constant_interval_exprt &lhs, const constant_interval_exprt &rhs, - const irep_idt &operation); + irep_idt operation); static exprt get_extreme(std::vector values, bool min = true); static exprt get_max(const exprt &a, const exprt &b); static exprt get_min(const exprt &a, const exprt &b); @@ -437,7 +436,7 @@ class constant_interval_exprt : public binary_exprt static void generate_expression( const exprt &lhs, const exprt &rhs, - const irep_idt &operation, + irep_idt operation, std::vector &collection); static void append_multiply_expression( const exprt &lower, @@ -455,7 +454,7 @@ class constant_interval_exprt : public binary_exprt static exprt generate_shift_expression( const exprt &lhs, const exprt &rhs, - const irep_idt &operation); + irep_idt operation); }; inline const constant_interval_exprt & diff --git a/src/util/irep.cpp b/src/util/irep.cpp index 36e103ea8ff..fa670164c81 100644 --- a/src/util/irep.cpp +++ b/src/util/irep.cpp @@ -23,7 +23,7 @@ const irept &get_nil_irep() return nil_rep_storage; } -void irept::move_to_named_sub(const irep_idt &name, irept &irep) +void irept::move_to_named_sub(irep_idt name, irept &irep) { #ifdef SHARING detach(); @@ -41,7 +41,7 @@ void irept::move_to_sub(irept &irep) get_sub().back().swap(irep); } -const irep_idt &irept::get(const irep_idt &name) const +const irep_idt &irept::get(irep_idt name) const { const named_subt &s = get_named_sub(); named_subt::const_iterator it=s.find(name); @@ -54,43 +54,43 @@ const irep_idt &irept::get(const irep_idt &name) const return it->second.id(); } -bool irept::get_bool(const irep_idt &name) const +bool irept::get_bool(irep_idt name) const { return get(name)==ID_1; } -int irept::get_int(const irep_idt &name) const +int irept::get_int(irep_idt name) const { return unsafe_string2int(get_string(name)); } -std::size_t irept::get_size_t(const irep_idt &name) const +std::size_t irept::get_size_t(irep_idt name) const { return unsafe_string2size_t(get_string(name)); } -long long irept::get_long_long(const irep_idt &name) const +long long irept::get_long_long(irep_idt name) const { return unsafe_string2signedlonglong(get_string(name)); } -void irept::set(const irep_idt &name, const long long value) +void irept::set(irep_idt name, const long long value) { add(name).id(to_dstring(value)); } -void irept::set_size_t(const irep_idt &name, const std::size_t value) +void irept::set_size_t(irep_idt name, const std::size_t value) { add(name).id(to_dstring(value)); } -void irept::remove(const irep_idt &name) +void irept::remove(irep_idt name) { named_subt &s = get_named_sub(); s.erase(name); } -const irept &irept::find(const irep_idt &name) const +const irept &irept::find(irep_idt name) const { const named_subt &s = get_named_sub(); auto it = s.find(name); @@ -100,13 +100,13 @@ const irept &irept::find(const irep_idt &name) const return it->second; } -irept &irept::add(const irep_idt &name) +irept &irept::add(irep_idt name) { named_subt &s = get_named_sub(); return s[name]; } -irept &irept::add(const irep_idt &name, irept irep) +irept &irept::add(irep_idt name, irept irep) { named_subt &s = get_named_sub(); diff --git a/src/util/irep.h b/src/util/irep.h index 28f87062c48..770d037544a 100644 --- a/src/util/irep.h +++ b/src/util/irep.h @@ -41,7 +41,7 @@ typedef dstring_hash irep_id_hash; [[gnu::no_dangling]] #endif inline const std::string & -id2string(const irep_idt &d) +id2string(irep_idt d) { return as_string(d); } @@ -374,11 +374,11 @@ class irept return id() != ID_nil; } - explicit irept(const irep_idt &_id) : baset(_id) + explicit irept(irep_idt _id) : baset(_id) { } - irept(const irep_idt &_id, const named_subt &_named_sub, const subt &_sub) + irept(irep_idt _id, const named_subt &_named_sub, const subt &_sub) : baset(_id, _named_sub, _sub) { } @@ -391,38 +391,38 @@ class irept const std::string &id_string() const { return id2string(read().data); } - void id(const irep_idt &_data) + void id(irep_idt _data) { write().data=_data; } - const irept &find(const irep_idt &name) const; - irept &add(const irep_idt &name); - irept &add(const irep_idt &name, irept irep); + const irept &find(irep_idt name) const; + irept &add(irep_idt name); + irept &add(irep_idt name, irept irep); - const std::string &get_string(const irep_idt &name) const + const std::string &get_string(irep_idt name) const { return id2string(get(name)); } - const irep_idt &get(const irep_idt &name) const; - bool get_bool(const irep_idt &name) const; - signed int get_int(const irep_idt &name) const; - std::size_t get_size_t(const irep_idt &name) const; - long long get_long_long(const irep_idt &name) const; + const irep_idt &get(irep_idt name) const; + bool get_bool(irep_idt name) const; + signed int get_int(irep_idt name) const; + std::size_t get_size_t(irep_idt name) const; + long long get_long_long(irep_idt name) const; - void set(const irep_idt &name, const irep_idt &value) + void set(irep_idt name, irep_idt value) { add(name, irept(value)); } - void set(const irep_idt &name, irept irep) + void set(irep_idt name, irept irep) { add(name, std::move(irep)); } - void set(const irep_idt &name, const long long value); - void set_size_t(const irep_idt &name, const std::size_t value); + void set(irep_idt name, const long long value); + void set_size_t(irep_idt name, const std::size_t value); - void remove(const irep_idt &name); + void remove(irep_idt name); void move_to_sub(irept &irep); - void move_to_named_sub(const irep_idt &name, irept &irep); + void move_to_named_sub(irep_idt name, irept &irep); bool operator==(const irept &other) const; @@ -457,7 +457,7 @@ class irept std::string pretty(unsigned indent=0, unsigned max_indent=0) const; - static bool is_comment(const irep_idt &name) + static bool is_comment(irep_idt name) { return !name.empty() && name[0]=='#'; } /// count the number of named_sub elements that are not comments diff --git a/src/util/irep_serialization.cpp b/src/util/irep_serialization.cpp index 20f37d8a194..6ba85f2702b 100644 --- a/src/util/irep_serialization.cpp +++ b/src/util/irep_serialization.cpp @@ -208,9 +208,7 @@ irep_idt irep_serializationt::read_gb_string(std::istream &in) /// Output a string and maintain a reference to it /// \param out: output stream /// \param s: string to output -void irep_serializationt::write_string_ref( - std::ostream &out, - const irep_idt &s) +void irep_serializationt::write_string_ref(std::ostream &out, irep_idt s) { size_t id = s.get_no(); if(id>=ireps_container.string_map.size()) diff --git a/src/util/irep_serialization.h b/src/util/irep_serialization.h index 275e9268ff5..2a8a4fe2c9f 100644 --- a/src/util/irep_serialization.h +++ b/src/util/irep_serialization.h @@ -65,7 +65,7 @@ class irep_serializationt void reference_convert(const irept &irep, std::ostream &); irep_idt read_string_ref(std::istream &); - void write_string_ref(std::ostream &, const irep_idt &); + void write_string_ref(std::ostream &, irep_idt); void clear() { ireps_container.clear(); } diff --git a/src/util/journalling_symbol_table.h b/src/util/journalling_symbol_table.h index a1f9643d048..bf33ab48118 100644 --- a/src/util/journalling_symbol_table.h +++ b/src/util/journalling_symbol_table.h @@ -73,7 +73,7 @@ class journalling_symbol_tablet : public symbol_table_baset { } - virtual const symbol_tablet &get_symbol_table() const override + const symbol_tablet &get_symbol_table() const override { return base_symbol_table.get_symbol_table(); } @@ -83,7 +83,7 @@ class journalling_symbol_tablet : public symbol_table_baset return journalling_symbol_tablet(base_symbol_table); } - virtual bool move(symbolt &symbol, symbolt *&new_symbol) override + bool move(symbolt &symbol, symbolt *&new_symbol) override { bool ret = base_symbol_table.move(symbol, new_symbol); if(!ret) @@ -93,7 +93,7 @@ class journalling_symbol_tablet : public symbol_table_baset return ret; } - virtual symbolt *get_writeable(const irep_idt &identifier) override + symbolt *get_writeable(irep_idt identifier) override { symbolt *result = base_symbol_table.get_writeable(identifier); if(result) @@ -106,7 +106,7 @@ class journalling_symbol_tablet : public symbol_table_baset return base_symbol_table.next_unused_suffix(prefix); } - virtual std::pair insert(symbolt symbol) override + std::pair insert(symbolt symbol) override { std::pair result = base_symbol_table.insert(std::move(symbol)); @@ -115,30 +115,29 @@ class journalling_symbol_tablet : public symbol_table_baset return result; } - virtual void - erase(const symbol_table_baset::symbolst::const_iterator &entry) override + void erase(const symbol_table_baset::symbolst::const_iterator &entry) override { const irep_idt entry_name = entry->first; base_symbol_table.erase(entry); on_remove(entry_name); } - virtual void clear() override + void clear() override { for(const auto &named_symbol : base_symbol_table.symbols) on_remove(named_symbol.first); base_symbol_table.clear(); } - virtual iteratort begin() override + iteratort begin() override { return iteratort( - base_symbol_table.begin(), [this](const irep_idt &id) { on_update(id); }); + base_symbol_table.begin(), [this](irep_idt id) { on_update(id); }); } - virtual iteratort end() override + iteratort end() override { return iteratort( - base_symbol_table.end(), [this](const irep_idt &id) { on_update(id); }); + base_symbol_table.end(), [this](irep_idt id) { on_update(id); }); } using symbol_table_baset::begin; @@ -164,19 +163,19 @@ class journalling_symbol_tablet : public symbol_table_baset } private: - void on_insert(const irep_idt &id) + void on_insert(irep_idt id) { if(removed.erase(id) == 0) inserted.insert(id); updated.insert(id); } - void on_update(const irep_idt &id) + void on_update(irep_idt id) { updated.insert(id); } - void on_remove(const irep_idt &id) + void on_remove(irep_idt id) { if(inserted.erase(id) == 0) removed.insert(id); diff --git a/src/util/json.h b/src/util/json.h index 2ef36d85f07..cec99d23617 100644 --- a/src/util/json.h +++ b/src/util/json.h @@ -274,7 +274,7 @@ class json_stringt:public jsont { } - explicit json_stringt(const irep_idt &_value) + explicit json_stringt(irep_idt _value) : jsont(kindt::J_STRING, id2string(_value)) { } diff --git a/src/util/mathematical_expr.h b/src/util/mathematical_expr.h index b8c0eb76a6c..6f10c8d47be 100644 --- a/src/util/mathematical_expr.h +++ b/src/util/mathematical_expr.h @@ -21,7 +21,7 @@ class transt : public ternary_exprt { public: transt( - const irep_idt &_id, + irep_idt _id, const exprt &_op0, const exprt &_op1, const exprt &_op2, diff --git a/src/util/namespace.cpp b/src/util/namespace.cpp index 82c80725071..f959898fe9f 100644 --- a/src/util/namespace.cpp +++ b/src/util/namespace.cpp @@ -131,9 +131,7 @@ std::size_t namespacet::smallest_unused_suffix(const std::string &prefix) const /// \param symbol: The const pointer to the reference of the symbol /// if it's found during lookup. /// \return False if the symbol was found, True otherwise. -bool namespacet::lookup( - const irep_idt &name, - const symbolt *&symbol) const +bool namespacet::lookup(irep_idt name, const symbolt *&symbol) const { symbol_table_baset::symbolst::const_iterator it; @@ -182,9 +180,7 @@ multi_namespacet::smallest_unused_suffix(const std::string &prefix) const /// \param symbol: The const pointer to the reference of the symbol /// if it's found during lookup. /// \return False if the symbol was found, True otherwise. -bool multi_namespacet::lookup( - const irep_idt &name, - const symbolt *&symbol) const +bool multi_namespacet::lookup(irep_idt name, const symbolt *&symbol) const { symbol_table_baset::symbolst::const_iterator s_it; diff --git a/src/util/namespace.h b/src/util/namespace.h index 1594fea198d..cab07f4e5c5 100644 --- a/src/util/namespace.h +++ b/src/util/namespace.h @@ -42,7 +42,7 @@ class namespace_baset /// \return A reference to the symbol found. /// \remarks: It is a PRECONDITION that the symbol name exists /// in the namespace. - const symbolt &lookup(const irep_idt &name) const + const symbolt &lookup(irep_idt name) const { const symbolt *symbol; bool not_found = lookup(name, symbol); @@ -79,7 +79,7 @@ class namespace_baset /// and then symbol_table2. /// \return False iff the requested symbol is found in at least one of the /// tables. - virtual bool lookup(const irep_idt &name, const symbolt *&symbol) const=0; + virtual bool lookup(irep_idt name, const symbolt *&symbol) const = 0; }; /// A namespacet is essentially one or two symbol tables bound @@ -114,7 +114,7 @@ class namespacet:public namespace_baset /// See documentation for namespace_baset::lookup(). Note that /// \ref namespacet has two symbol tables. - bool lookup(const irep_idt &name, const symbolt *&symbol) const override; + bool lookup(irep_idt name, const symbolt *&symbol) const override; /// See documentation for namespace_baset::smallest_unused_suffix(). std::size_t smallest_unused_suffix(const std::string &prefix) const override; @@ -151,7 +151,7 @@ class multi_namespacet:public namespacet using namespace_baset::lookup; /// See documentation for namespace_baset::lookup(). - bool lookup(const irep_idt &name, const symbolt *&symbol) const override; + bool lookup(irep_idt name, const symbolt *&symbol) const override; /// See documentation for namespace_baset::smallest_unused_suffix(). std::size_t smallest_unused_suffix(const std::string &prefix) const override; diff --git a/src/util/parser.h b/src/util/parser.h index eeec3b469a0..be9b8dbb503 100644 --- a/src/util/parser.h +++ b/src/util/parser.h @@ -81,7 +81,7 @@ class parsert line_no=_line_no; } - void set_file(const irep_idt &file) + void set_file(irep_idt file) { _source_location.set_file(file); _source_location.set_working_directory( @@ -130,7 +130,7 @@ class parsert e.add_source_location() = source_location(); } - void set_function(const irep_idt &function) + void set_function(irep_idt function) { _source_location.set_function(function); } diff --git a/src/util/pointer_expr.cpp b/src/util/pointer_expr.cpp index 7de79c38a1c..99cbb025561 100644 --- a/src/util/pointer_expr.cpp +++ b/src/util/pointer_expr.cpp @@ -148,7 +148,7 @@ symbol_exprt object_address_exprt::object_expr() const field_address_exprt::field_address_exprt( exprt compound_ptr, - const irep_idt &component_name, + irep_idt component_name, pointer_typet _type) : unary_exprt(ID_field_address, std::move(compound_ptr), std::move(_type)) { diff --git a/src/util/pointer_expr.h b/src/util/pointer_expr.h index d3130b3110c..95ecce00ba0 100644 --- a/src/util/pointer_expr.h +++ b/src/util/pointer_expr.h @@ -665,10 +665,7 @@ class field_address_exprt : public unary_exprt public: /// constructor for field addresses. /// The base address must be a pointer to a compound type. - field_address_exprt( - exprt base, - const irep_idt &component_name, - pointer_typet type); + field_address_exprt(exprt base, irep_idt component_name, pointer_typet type); exprt &base() { @@ -1209,9 +1206,7 @@ inline const prophecy_w_ok_exprt &to_prophecy_w_ok_expr(const exprt &expr) class annotated_pointer_constant_exprt : public unary_exprt { public: - annotated_pointer_constant_exprt( - const irep_idt &_value, - const exprt &_pointer) + annotated_pointer_constant_exprt(irep_idt _value, const exprt &_pointer) : unary_exprt(ID_annotated_pointer_constant, _pointer, _pointer.type()) { set_value(_value); @@ -1222,7 +1217,7 @@ class annotated_pointer_constant_exprt : public unary_exprt return get(ID_value); } - void set_value(const irep_idt &value) + void set_value(irep_idt value) { set(ID_value, value); } diff --git a/src/util/pointer_offset_size.cpp b/src/util/pointer_offset_size.cpp index cdc1b87c9c8..f050efa3d45 100644 --- a/src/util/pointer_offset_size.cpp +++ b/src/util/pointer_offset_size.cpp @@ -22,10 +22,8 @@ Author: Daniel Kroening, kroening@kroening.com #include "ssa_expr.h" #include "std_expr.h" -std::optional member_offset( - const struct_typet &type, - const irep_idt &member, - const namespacet &ns) +std::optional +member_offset(const struct_typet &type, irep_idt member, const namespacet &ns) { mp_integer result = 0; std::size_t bit_field_bits = 0; @@ -65,7 +63,7 @@ std::optional member_offset( std::optional member_offset_bits( const struct_typet &type, - const irep_idt &member, + irep_idt member, const namespacet &ns) { mp_integer offset=0; @@ -240,7 +238,7 @@ member_offset_expr(const member_exprt &member_expr, const namespacet &ns) std::optional member_offset_expr( const struct_typet &type, - const irep_idt &member, + irep_idt member, const namespacet &ns) { PRECONDITION(size_type().get_width() != 0); diff --git a/src/util/pointer_offset_size.h b/src/util/pointer_offset_size.h index 97107b11b87..f0c7b1d803d 100644 --- a/src/util/pointer_offset_size.h +++ b/src/util/pointer_offset_size.h @@ -23,14 +23,12 @@ class struct_typet; class typet; class member_exprt; -std::optional member_offset( - const struct_typet &type, - const irep_idt &member, - const namespacet &ns); +std::optional +member_offset(const struct_typet &type, irep_idt member, const namespacet &ns); std::optional member_offset_bits( const struct_typet &type, - const irep_idt &member, + irep_idt member, const namespacet &ns); std::optional @@ -47,7 +45,7 @@ member_offset_expr(const member_exprt &, const namespacet &ns); std::optional member_offset_expr( const struct_typet &type, - const irep_idt &member, + irep_idt member, const namespacet &ns); std::optional size_of_expr(const typet &type, const namespacet &ns); diff --git a/src/util/rename.cpp b/src/util/rename.cpp index 2b622b96874..10635a96763 100644 --- a/src/util/rename.cpp +++ b/src/util/rename.cpp @@ -12,8 +12,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "namespace.h" -irep_idt -get_new_name(const irep_idt &name, const namespacet &ns, char delimiter) +irep_idt get_new_name(irep_idt name, const namespacet &ns, char delimiter) { const symbolt *symbol; if(ns.lookup(name, symbol)) diff --git a/src/util/rename.h b/src/util/rename.h index b60f472ca74..7c2e9ee4b82 100644 --- a/src/util/rename.h +++ b/src/util/rename.h @@ -26,6 +26,6 @@ class namespacet; /// suffix /// \return Identifier that is not yet part of the namespace. [[nodiscard]] irep_idt -get_new_name(const irep_idt &name, const namespacet &ns, char delimiter = '_'); +get_new_name(irep_idt name, const namespacet &ns, char delimiter = '_'); #endif // CPROVER_UTIL_RENAME_H diff --git a/src/util/rename_symbol.h b/src/util/rename_symbol.h index 8fcd4538cb3..a4b923af8df 100644 --- a/src/util/rename_symbol.h +++ b/src/util/rename_symbol.h @@ -28,8 +28,7 @@ class rename_symbolt typedef std::unordered_map expr_mapt; typedef std::unordered_map type_mapt; - void insert_expr(const irep_idt &old_id, - const irep_idt &new_id) + void insert_expr(irep_idt old_id, irep_idt new_id) { expr_map.insert(std::pair(old_id, new_id)); } @@ -37,8 +36,7 @@ class rename_symbolt void insert(const class symbol_exprt &old_expr, const class symbol_exprt &new_expr); - void insert_type(const irep_idt &old_id, - const irep_idt &new_id) + void insert_type(irep_idt old_id, irep_idt new_id) { type_map.insert(std::pair(old_id, new_id)); } diff --git a/src/util/replace_symbol.h b/src/util/replace_symbol.h index 15fecca5181..c6f3232b9f5 100644 --- a/src/util/replace_symbol.h +++ b/src/util/replace_symbol.h @@ -61,7 +61,7 @@ class replace_symbolt return expr_map.empty(); } - std::size_t erase(const irep_idt &id) + std::size_t erase(irep_idt id) { return expr_map.erase(id); } @@ -71,7 +71,7 @@ class replace_symbolt return expr_map.erase(it); } - bool replaces_symbol(const irep_idt &id) const + bool replaces_symbol(irep_idt id) const { return expr_map.find(id) != expr_map.end(); } diff --git a/src/util/simplify_utils.cpp b/src/util/simplify_utils.cpp index ce2b5f8f4a3..ebd10d55823 100644 --- a/src/util/simplify_utils.cpp +++ b/src/util/simplify_utils.cpp @@ -108,7 +108,7 @@ struct saj_tablet static bool is_associative_and_commutative_for_type( const struct saj_tablet &saj_entry, - const irep_idt &type_id) + irep_idt type_id) { for(unsigned i=0; !saj_entry.type_ids[i].empty(); i++) if(type_id==saj_entry.type_ids[i]) @@ -118,7 +118,7 @@ static bool is_associative_and_commutative_for_type( } static const struct saj_tablet & -get_sort_and_join_table_entry(const irep_idt &id, const irep_idt &type_id) +get_sort_and_join_table_entry(irep_idt id, irep_idt type_id) { unsigned i=0; @@ -140,7 +140,7 @@ static bool sort_and_join(exprt &expr, bool do_sort) if(!expr.has_operands()) return true; - const struct saj_tablet &saj_entry = + const struct saj_tablet saj_entry = get_sort_and_join_table_entry(expr.id(), as_const(expr).type().id()); if(saj_entry.id.empty()) return true; diff --git a/src/util/source_location.h b/src/util/source_location.h index d2dc44f6d7b..2996fbd003a 100644 --- a/src/util/source_location.h +++ b/src/util/source_location.h @@ -101,17 +101,17 @@ class source_locationt:public irept return get_bool(ID_property_fatal); } - void set_file(const irep_idt &file) + void set_file(irep_idt file) { set(ID_file, file); } - void set_working_directory(const irep_idt &cwd) + void set_working_directory(irep_idt cwd) { set(ID_working_directory, cwd); } - void set_line(const irep_idt &line) + void set_line(irep_idt line) { set(ID_line, line); } @@ -121,7 +121,7 @@ class source_locationt:public irept set(ID_line, line); } - void set_column(const irep_idt &column) + void set_column(irep_idt column) { set(ID_column, column); } @@ -132,7 +132,7 @@ class source_locationt:public irept } DEPRECATED(SINCE(2022, 10, 13, "use identifier of containing function")) - void set_function(const irep_idt &function) + void set_function(irep_idt function) { PRECONDITION(!function.empty()); set(ID_function, function); @@ -143,28 +143,28 @@ class source_locationt:public irept remove(ID_function); } - void set_property_id(const irep_idt &property_id) + void set_property_id(irep_idt property_id) { set(ID_property_id, property_id); } - void set_property_class(const irep_idt &property_class) + void set_property_class(irep_idt property_class) { set(ID_property_class, property_class); } - void set_comment(const irep_idt &comment) + void set_comment(irep_idt comment) { set(ID_comment, comment); } // for switch case number - void set_case_number(const irep_idt &number) + void set_case_number(irep_idt number) { set(ID_switch_case_number, number); } - void set_java_bytecode_index(const irep_idt &index) + void set_java_bytecode_index(irep_idt index) { set(ID_java_bytecode_index, index); } @@ -210,7 +210,7 @@ class source_locationt:public irept std::optional full_path() const; - void add_pragma(const irep_idt &pragma) + void add_pragma(irep_idt pragma) { add(ID_pragma).add(pragma); } diff --git a/src/util/ssa_expr.cpp b/src/util/ssa_expr.cpp index 2edb9ef296a..072beb029f7 100644 --- a/src/util/ssa_expr.cpp +++ b/src/util/ssa_expr.cpp @@ -55,9 +55,9 @@ ssa_exprt::ssa_exprt(const exprt &expr) : symbol_exprt(expr.type()) /// and add "..component_name" or "[[index]]" to \p os. static void build_ssa_identifier_rec( const exprt &expr, - const irep_idt &l0, - const irep_idt &l1, - const irep_idt &l2, + irep_idt l0, + irep_idt l1, + irep_idt l2, std::ostream &os, std::ostream &l1_object_os) { @@ -110,11 +110,8 @@ static void build_ssa_identifier_rec( UNREACHABLE; } -static std::pair build_identifier( - const exprt &expr, - const irep_idt &l0, - const irep_idt &l1, - const irep_idt &l2) +static std::pair +build_identifier(const exprt &expr, irep_idt l0, irep_idt l1, irep_idt l2) { std::ostringstream oss; std::ostringstream l1_object_oss; diff --git a/src/util/std_code.h b/src/util/std_code.h index 41f137b3dcf..9eb8382946f 100644 --- a/src/util/std_code.h +++ b/src/util/std_code.h @@ -840,12 +840,12 @@ inline code_fort &to_code_for(codet &code) class code_gotot:public codet { public: - explicit code_gotot(const irep_idt &label):codet(ID_goto) + explicit code_gotot(irep_idt label) : codet(ID_goto) { set_destination(label); } - void set_destination(const irep_idt &label) + void set_destination(irep_idt label) { set(ID_destination, label); } @@ -958,7 +958,7 @@ inline code_frontend_returnt &to_code_frontend_return(codet &code) class code_labelt:public codet { public: - code_labelt(const irep_idt &_label, codet _code) + code_labelt(irep_idt _label, codet _code) : codet(ID_label, {std::move(_code)}) { set_label(_label); @@ -969,7 +969,7 @@ class code_labelt:public codet return get(ID_label); } - void set_label(const irep_idt &label) + void set_label(irep_idt label) { set(ID_label, label); } @@ -1265,7 +1265,7 @@ class code_asmt:public codet return get(ID_flavor); } - void set_flavor(const irep_idt &f) + void set_flavor(irep_idt f) { set(ID_flavor, f); } @@ -1450,7 +1450,7 @@ class side_effect_exprt : public exprt { public: side_effect_exprt( - const irep_idt &statement, + irep_idt statement, operandst _operands, typet _type, source_locationt loc) @@ -1460,10 +1460,7 @@ class side_effect_exprt : public exprt operands() = std::move(_operands); } - side_effect_exprt( - const irep_idt &statement, - typet _type, - source_locationt loc) + side_effect_exprt(irep_idt statement, typet _type, source_locationt loc) : exprt(ID_side_effect, std::move(_type), std::move(loc)) { set_statement(statement); @@ -1474,7 +1471,7 @@ class side_effect_exprt : public exprt return get(ID_statement); } - void set_statement(const irep_idt &statement) + void set_statement(irep_idt statement) { return set(ID_statement, statement); } @@ -1816,18 +1813,18 @@ class code_push_catcht:public codet { } - explicit exception_list_entryt(const irep_idt &tag) + explicit exception_list_entryt(irep_idt tag) { set(ID_tag, tag); } - exception_list_entryt(const irep_idt &tag, const irep_idt &label) + exception_list_entryt(irep_idt tag, irep_idt label) { set(ID_tag, tag); set(ID_label, label); } - void set_tag(const irep_idt &tag) + void set_tag(irep_idt tag) { set(ID_tag, tag); } @@ -1836,7 +1833,7 @@ class code_push_catcht:public codet return get(ID_tag); } - void set_label(const irep_idt &label) + void set_label(irep_idt label) { set(ID_label, label); } @@ -1848,10 +1845,7 @@ class code_push_catcht:public codet typedef std::vector exception_listt; - code_push_catcht( - const irep_idt &tag, - const irep_idt &label): - codet(ID_push_catch) + code_push_catcht(irep_idt tag, irep_idt label) : codet(ID_push_catch) { set(ID_exception_list, irept(ID_exception_list)); exception_list().push_back(exception_list_entryt(tag, label)); diff --git a/src/util/std_code_base.h b/src/util/std_code_base.h index 9c50cf0f1ad..dc38d35a794 100644 --- a/src/util/std_code_base.h +++ b/src/util/std_code_base.h @@ -31,12 +31,12 @@ class codet : public exprt /// \param statement: Specifies the type of the `codet` to be constructed, /// e.g. `ID_block` for a \ref code_blockt or `ID_assign` for a /// \ref code_frontend_assignt. - explicit codet(const irep_idt &statement) : exprt(ID_code, empty_typet()) + explicit codet(irep_idt statement) : exprt(ID_code, empty_typet()) { set_statement(statement); } - codet(const irep_idt &statement, source_locationt loc) + codet(irep_idt statement, source_locationt loc) : exprt(ID_code, empty_typet(), std::move(loc)) { set_statement(statement); @@ -46,18 +46,18 @@ class codet : public exprt /// e.g. `ID_block` for a \ref code_blockt or `ID_assign` for a /// \ref code_frontend_assignt. /// \param _op: any operands to be added - explicit codet(const irep_idt &statement, operandst _op) : codet(statement) + explicit codet(irep_idt statement, operandst _op) : codet(statement) { operands() = std::move(_op); } - codet(const irep_idt &statement, operandst op, source_locationt loc) + codet(irep_idt statement, operandst op, source_locationt loc) : codet(statement, std::move(loc)) { operands() = std::move(op); } - void set_statement(const irep_idt &statement) + void set_statement(irep_idt statement) { set(ID_statement, statement); } diff --git a/src/util/std_expr.cpp b/src/util/std_expr.cpp index fe99bb30a0e..d62dca90693 100644 --- a/src/util/std_expr.cpp +++ b/src/util/std_expr.cpp @@ -288,7 +288,7 @@ exprt conjunction(const exprt::operandst &op) // Implementation of struct_exprt::component for const / non const overloads. template -auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) +auto component(T &struct_expr, irep_idt name, const namespacet &ns) -> decltype(struct_expr.op0()) { static_assert( @@ -305,14 +305,13 @@ auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) } /// \return The expression for a named component of this struct. -exprt &struct_exprt::component(const irep_idt &name, const namespacet &ns) +exprt &struct_exprt::component(irep_idt name, const namespacet &ns) { return ::component(*this, name, ns); } /// \return The expression for a named component of this struct. -const exprt & -struct_exprt::component(const irep_idt &name, const namespacet &ns) const +const exprt &struct_exprt::component(irep_idt name, const namespacet &ns) const { return ::component(*this, name, ns); } diff --git a/src/util/std_expr.h b/src/util/std_expr.h index 1c1ee58fd42..18d125f6b6c 100644 --- a/src/util/std_expr.h +++ b/src/util/std_expr.h @@ -22,7 +22,7 @@ Author: Daniel Kroening, kroening@kroening.com class nullary_exprt : public expr_protectedt { public: - nullary_exprt(const irep_idt &_id, typet _type) + nullary_exprt(irep_idt _id, typet _type) : expr_protectedt(_id, std::move(_type)) { } @@ -68,12 +68,7 @@ class ternary_exprt : public expr_protectedt { public: // constructor - ternary_exprt( - const irep_idt &_id, - exprt _op0, - exprt _op1, - exprt _op2, - typet _type) + ternary_exprt(irep_idt _id, exprt _op0, exprt _op1, exprt _op2, typet _type) : expr_protectedt( _id, std::move(_type), @@ -138,7 +133,7 @@ class symbol_exprt : public nullary_exprt /// \param identifier: Name of symbol /// \param type: Type of symbol - symbol_exprt(const irep_idt &identifier, typet type) + symbol_exprt(irep_idt identifier, typet type) : nullary_exprt{ID_symbol, std::move(type)} { this->identifier(identifier); @@ -146,18 +141,18 @@ class symbol_exprt : public nullary_exprt /// Generate a symbol_exprt without a proper type. Use if, and only if, the /// type either cannot be determined just yet (such as before type checking). - static symbol_exprt typeless(const irep_idt &id) + static symbol_exprt typeless(irep_idt id) { return symbol_exprt{id, typet{}}; } DEPRECATED(SINCE(2026, 1, 18, "use identifier(...) instead")) - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { this->identifier(identifier); } - void identifier(const irep_idt &identifier) + void identifier(irep_idt identifier) { set(ID_identifier, identifier); } @@ -254,7 +249,7 @@ class decorated_symbol_exprt:public symbol_exprt public: /// \param identifier: Name of symbol /// \param type: Type of symbol - decorated_symbol_exprt(const irep_idt &identifier, typet type) + decorated_symbol_exprt(irep_idt identifier, typet type) : symbol_exprt(identifier, std::move(type)) { } @@ -296,7 +291,7 @@ class nondet_symbol_exprt : public nullary_exprt public: /// \param identifier: Name of symbol /// \param type: Type of symbol - nondet_symbol_exprt(const irep_idt &identifier, typet type) + nondet_symbol_exprt(irep_idt identifier, typet type) : nullary_exprt(ID_nondet_symbol, std::move(type)) { set_identifier(identifier); @@ -315,7 +310,7 @@ class nondet_symbol_exprt : public nullary_exprt add_source_location() = std::move(location); } - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_identifier, identifier); } @@ -363,12 +358,12 @@ inline nondet_symbol_exprt &to_nondet_symbol_expr(exprt &expr) class unary_exprt : public expr_protectedt { public: - unary_exprt(const irep_idt &_id, const exprt &_op) + unary_exprt(irep_idt _id, const exprt &_op) : expr_protectedt(_id, _op.type(), {_op}) { } - unary_exprt(const irep_idt &_id, exprt _op, typet _type) + unary_exprt(irep_idt _id, exprt _op, typet _type) : expr_protectedt(_id, std::move(_type), {std::move(_op)}) { } @@ -556,8 +551,7 @@ inline unary_plus_exprt &to_unary_plus_expr(exprt &expr) class predicate_exprt : public expr_protectedt { public: - explicit predicate_exprt(const irep_idt &_id) - : expr_protectedt(_id, bool_typet()) + explicit predicate_exprt(irep_idt _id) : expr_protectedt(_id, bool_typet()) { } @@ -573,7 +567,7 @@ class predicate_exprt : public expr_protectedt class unary_predicate_exprt:public unary_exprt { public: - unary_predicate_exprt(const irep_idt &_id, exprt _op) + unary_predicate_exprt(irep_idt _id, exprt _op) : unary_exprt(_id, std::move(_op), bool_typet()) { } @@ -648,12 +642,12 @@ inline sign_exprt &to_sign_expr(exprt &expr) class binary_exprt : public expr_protectedt { public: - binary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs) + binary_exprt(const exprt &_lhs, irep_idt _id, exprt _rhs) : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)}) { } - binary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs, typet _type) + binary_exprt(exprt _lhs, irep_idt _id, exprt _rhs, typet _type) : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)}) { } @@ -736,7 +730,7 @@ inline binary_exprt &to_binary_expr(exprt &expr) class binary_predicate_exprt:public binary_exprt { public: - binary_predicate_exprt(exprt _op0, const irep_idt &_id, exprt _op1) + binary_predicate_exprt(exprt _op0, irep_idt _id, exprt _op1) : binary_exprt(std::move(_op0), _id, std::move(_op1), bool_typet()) { } @@ -783,7 +777,7 @@ inline binary_predicate_exprt &to_binary_predicate_expr(exprt &expr) class binary_relation_exprt:public binary_predicate_exprt { public: - binary_relation_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs) + binary_relation_exprt(exprt _lhs, irep_idt _id, exprt _rhs) : binary_predicate_exprt(std::move(_lhs), _id, std::move(_rhs)) { } @@ -907,13 +901,13 @@ inline bool can_cast_expr(const exprt &base) class multi_ary_exprt : public expr_protectedt { public: - multi_ary_exprt(const irep_idt &_id, operandst _operands, typet _type) + multi_ary_exprt(irep_idt _id, operandst _operands, typet _type) : expr_protectedt(_id, std::move(_type)) { operands() = std::move(_operands); } - multi_ary_exprt(const irep_idt &_id, operandst _operands) + multi_ary_exprt(irep_idt _id, operandst _operands) : expr_protectedt(_id, typet{}) { PRECONDITION(!_operands.empty()); @@ -921,12 +915,12 @@ class multi_ary_exprt : public expr_protectedt operands() = std::move(_operands); } - multi_ary_exprt(const exprt &_lhs, const irep_idt &_id, exprt _rhs) + multi_ary_exprt(const exprt &_lhs, irep_idt _id, exprt _rhs) : expr_protectedt(_id, _lhs.type(), {_lhs, std::move(_rhs)}) { } - multi_ary_exprt(exprt _lhs, const irep_idt &_id, exprt _rhs, typet _type) + multi_ary_exprt(exprt _lhs, irep_idt _id, exprt _rhs, typet _type) : expr_protectedt(_id, std::move(_type), {std::move(_lhs), std::move(_rhs)}) { } @@ -1723,7 +1717,7 @@ inline vector_exprt &to_vector_expr(exprt &expr) class union_exprt:public unary_exprt { public: - union_exprt(const irep_idt &_component_name, exprt _value, typet _type) + union_exprt(irep_idt _component_name, exprt _value, typet _type) : unary_exprt(ID_union, std::move(_value), std::move(_type)) { set_component_name(_component_name); @@ -1734,7 +1728,7 @@ class union_exprt:public unary_exprt return get(ID_component_name); } - void set_component_name(const irep_idt &component_name) + void set_component_name(irep_idt component_name) { set(ID_component_name, component_name); } @@ -1824,8 +1818,8 @@ class struct_exprt : public multi_ary_exprt { } - exprt &component(const irep_idt &name, const namespacet &ns); - const exprt &component(const irep_idt &name, const namespacet &ns) const; + exprt &component(irep_idt name, const namespacet &ns); + const exprt &component(irep_idt name, const namespacet &ns) const; }; template <> @@ -2634,7 +2628,7 @@ inline index_designatort &to_index_designator(exprt &expr) class member_designatort : public expr_protectedt { public: - explicit member_designatort(const irep_idt &_component_name) + explicit member_designatort(irep_idt _component_name) : expr_protectedt(ID_member_designator, typet()) { set(ID_component_name, _component_name); @@ -2865,7 +2859,7 @@ inline array_update_exprt &to_array_update_expr(exprt &expr) class member_exprt:public unary_exprt { public: - member_exprt(exprt op, const irep_idt &component_name, typet _type) + member_exprt(exprt op, irep_idt component_name, typet _type) : unary_exprt(ID_member, std::move(op), std::move(_type)) { const auto &compound_type_id = compound().type().id(); @@ -2890,7 +2884,7 @@ class member_exprt:public unary_exprt return get(ID_component_name); } - void set_component_name(const irep_idt &component_name) + void set_component_name(irep_idt component_name) { set(ID_component_name, component_name); } @@ -3006,7 +3000,7 @@ inline type_exprt &to_type_expr(exprt &expr) class constant_exprt : public nullary_exprt { public: - constant_exprt(const irep_idt &_value, typet _type) + constant_exprt(irep_idt _value, typet _type) : nullary_exprt(ID_constant, std::move(_type)) { set_value(_value); @@ -3017,7 +3011,7 @@ class constant_exprt : public nullary_exprt return get(ID_value); } - void set_value(const irep_idt &value) + void set_value(irep_idt value) { set(ID_value, value); } diff --git a/src/util/std_types.cpp b/src/util/std_types.cpp index 34deb1776ef..6db1e4a1843 100644 --- a/src/util/std_types.cpp +++ b/src/util/std_types.cpp @@ -44,8 +44,7 @@ typet array_typet::index_type() const } /// Return the sequence number of the component with given name. -std::size_t struct_union_typet::component_number( - const irep_idt &component_name) const +std::size_t struct_union_typet::component_number(irep_idt component_name) const { std::size_t number=0; @@ -61,8 +60,8 @@ std::size_t struct_union_typet::component_number( } /// Get the reference to a component with given name. -const struct_union_typet::componentt &struct_union_typet::get_component( - const irep_idt &component_name) const +const struct_union_typet::componentt & +struct_union_typet::get_component(irep_idt component_name) const { for(const auto &c : components()) { @@ -73,8 +72,7 @@ const struct_union_typet::componentt &struct_union_typet::get_component( return static_cast(get_nil_irep()); } -const typet & -struct_union_typet::component_type(const irep_idt &component_name) const +const typet &struct_union_typet::component_type(irep_idt component_name) const { const auto &c = get_component(component_name); CHECK_RETURN(c.is_not_nil()); @@ -101,8 +99,7 @@ void struct_typet::add_base(const struct_tag_typet &base) bases().push_back(baset(base)); } -std::optional -struct_typet::get_base(const irep_idt &id) const +std::optional struct_typet::get_base(irep_idt id) const { for(const auto &b : bases()) { diff --git a/src/util/std_types.h b/src/util/std_types.h index 1ab4dc069ba..6ebbe218900 100644 --- a/src/util/std_types.h +++ b/src/util/std_types.h @@ -60,7 +60,7 @@ class empty_typet:public typet class struct_union_typet:public typet { public: - explicit struct_union_typet(const irep_idt &_id):typet(_id) + explicit struct_union_typet(irep_idt _id) : typet(_id) { } @@ -69,7 +69,7 @@ class struct_union_typet:public typet public: componentt() = default; - componentt(const irep_idt &_name, typet _type) + componentt(irep_idt _name, typet _type) { set_name(_name); type().swap(_type); @@ -80,7 +80,7 @@ class struct_union_typet:public typet return get(ID_name); } - void set_name(const irep_idt &name) + void set_name(irep_idt name) { return set(ID_name, name); } @@ -90,7 +90,7 @@ class struct_union_typet:public typet return get(ID_C_base_name); } - void set_base_name(const irep_idt &base_name) + void set_base_name(irep_idt base_name) { return set(ID_C_base_name, base_name); } @@ -100,7 +100,7 @@ class struct_union_typet:public typet return get(ID_access); } - void set_access(const irep_idt &access) + void set_access(irep_idt access) { return set(ID_access, access); } @@ -110,7 +110,7 @@ class struct_union_typet:public typet return get(ID_C_pretty_name); } - void set_pretty_name(const irep_idt &name) + void set_pretty_name(irep_idt name) { return set(ID_C_pretty_name, name); } @@ -138,7 +138,7 @@ class struct_union_typet:public typet typedef std::vector componentst; - struct_union_typet(const irep_idt &_id, componentst _components) : typet(_id) + struct_union_typet(irep_idt _id, componentst _components) : typet(_id) { components() = std::move(_components); } @@ -153,19 +153,21 @@ class struct_union_typet:public typet return (componentst &)(add(ID_components).get_sub()); } - bool has_component(const irep_idt &component_name) const + bool has_component(irep_idt component_name) const { return get_component(component_name).is_not_nil(); } - const componentt &get_component( - const irep_idt &component_name) const; + const componentt &get_component(irep_idt component_name) const; - std::size_t component_number(const irep_idt &component_name) const; - const typet &component_type(const irep_idt &component_name) const; + std::size_t component_number(irep_idt component_name) const; + const typet &component_type(irep_idt component_name) const; irep_idt get_tag() const { return get(ID_tag); } - void set_tag(const irep_idt &tag) { set(ID_tag, tag); } + void set_tag(irep_idt tag) + { + set(ID_tag, tag); + } /// A struct may be a class, where members may have access restrictions. bool is_class() const @@ -276,12 +278,12 @@ class struct_typet:public struct_union_typet /// Return the base with the given name, if exists. /// \param id: The name of the base we are looking for. /// \return The base if exists. - std::optional get_base(const irep_idt &id) const; + std::optional get_base(irep_idt id) const; /// Test whether `id` is a base class/struct. /// \param id: symbol type name /// \return True if, and only if, the symbol type `id` is a base class/struct. - bool has_base(const irep_idt &id) const + bool has_base(irep_idt id) const { return get_base(id).has_value(); } @@ -394,14 +396,12 @@ inline class_typet &to_class_type(typet &type) class tag_typet:public typet { public: - explicit tag_typet( - const irep_idt &_id, - const irep_idt &identifier):typet(_id) + explicit tag_typet(irep_idt _id, irep_idt identifier) : typet(_id) { set_identifier(identifier); } - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_identifier, identifier); } @@ -449,7 +449,7 @@ inline tag_typet &to_tag_type(typet &type) class struct_or_union_tag_typet : public tag_typet { protected: - struct_or_union_tag_typet(const irep_idt &id, const irep_idt &identifier) + struct_or_union_tag_typet(irep_idt id, irep_idt identifier) : tag_typet(id, identifier) { PRECONDITION(id == ID_struct_tag || id == ID_union_tag); @@ -491,7 +491,7 @@ inline struct_or_union_tag_typet &to_struct_or_union_tag_type(typet &type) class struct_tag_typet : public struct_or_union_tag_typet { public: - explicit struct_tag_typet(const irep_idt &identifier) + explicit struct_tag_typet(irep_idt identifier) : struct_or_union_tag_typet(ID_struct_tag, identifier) { } @@ -620,12 +620,12 @@ class code_typet:public typet // The following for methods will go away; // these should not be part of the signature of a function, // but rather part of the body. - void set_identifier(const irep_idt &identifier) + void set_identifier(irep_idt identifier) { set(ID_C_identifier, identifier); } - void set_base_name(const irep_idt &name) + void set_base_name(irep_idt name) { set(ID_C_base_name, name); } @@ -720,7 +720,7 @@ class code_typet:public typet return get(ID_access); } - void set_access(const irep_idt &access) + void set_access(irep_idt access) { return set(ID_access, access); } diff --git a/src/util/string_constant.cpp b/src/util/string_constant.cpp index 6f26c62a4c6..b894858f303 100644 --- a/src/util/string_constant.cpp +++ b/src/util/string_constant.cpp @@ -12,19 +12,19 @@ Author: Daniel Kroening, kroening@kroening.com #include "c_types.h" #include "std_expr.h" -static array_typet make_type(const irep_idt &value) +static array_typet make_type(irep_idt value) { exprt size_expr = from_integer(value.size() + 1, c_index_type()); return array_typet(char_type(), size_expr); } -string_constantt::string_constantt(const irep_idt &_value) +string_constantt::string_constantt(irep_idt _value) : nullary_exprt(ID_string_constant, make_type(_value)) { value(_value); } -void string_constantt::value(const irep_idt &_value) +void string_constantt::value(irep_idt _value) { exprt::type() = make_type(_value); set(ID_value, _value); diff --git a/src/util/string_constant.h b/src/util/string_constant.h index 05d8ee7b9c9..2bf914feabf 100644 --- a/src/util/string_constant.h +++ b/src/util/string_constant.h @@ -14,9 +14,9 @@ Author: Daniel Kroening, kroening@kroening.com class string_constantt : public nullary_exprt { public: - explicit string_constantt(const irep_idt &); + explicit string_constantt(irep_idt); - void value(const irep_idt &); + void value(irep_idt); const irep_idt &value() const { diff --git a/src/util/symbol.h b/src/util/symbol.h index 1a7121234e8..10530645a25 100644 --- a/src/util/symbol.h +++ b/src/util/symbol.h @@ -84,7 +84,7 @@ class symbolt { } - symbolt(const irep_idt &_name, typet _type, const irep_idt &_mode) + symbolt(irep_idt _name, typet _type, irep_idt _mode) : type(std::move(_type)), value(static_cast(get_nil_irep())), location(source_locationt::nil()), @@ -138,7 +138,7 @@ std::ostream &operator<<(std::ostream &out, const symbolt &symbol); class type_symbolt:public symbolt { public: - type_symbolt(const irep_idt &_name, typet _type, const irep_idt &_mode) + type_symbolt(irep_idt _name, typet _type, irep_idt _mode) : symbolt(_name, _type, _mode) { is_type = true; @@ -161,7 +161,7 @@ class auxiliary_symbolt:public symbolt is_auxiliary=true; } - auxiliary_symbolt(const irep_idt &name, typet type, const irep_idt &mode) + auxiliary_symbolt(irep_idt name, typet type, irep_idt mode) : symbolt(name, type, mode) { is_lvalue = true; diff --git a/src/util/symbol_table.h b/src/util/symbol_table.h index a6fa8b798fe..d7664c26a47 100644 --- a/src/util/symbol_table.h +++ b/src/util/symbol_table.h @@ -79,7 +79,7 @@ class symbol_tablet : public symbol_table_baset } public: - virtual const symbol_tablet &get_symbol_table() const override + const symbol_tablet &get_symbol_table() const override { return *this; } @@ -87,29 +87,29 @@ class symbol_tablet : public symbol_table_baset /// Find a symbol in the symbol table for read-write access. /// \param name: The name of the symbol to look for /// \return A pointer to the found symbol if it exists, nullptr otherwise. - virtual symbolt *get_writeable(const irep_idt &name) override + symbolt *get_writeable(irep_idt name) override { symbolst::iterator it = internal_symbols.find(name); return it != internal_symbols.end() ? &it->second : nullptr; } - virtual std::pair insert(symbolt symbol) override; - virtual bool move(symbolt &symbol, symbolt *&new_symbol) override; + std::pair insert(symbolt symbol) override; + bool move(symbolt &symbol, symbolt *&new_symbol) override; - virtual void erase(const symbolst::const_iterator &entry) override; + void erase(const symbolst::const_iterator &entry) override; /// Wipe internal state of the symbol table. - virtual void clear() override + void clear() override { internal_symbols.clear(); internal_symbol_base_map.clear(); internal_symbol_module_map.clear(); } - virtual iteratort begin() override + iteratort begin() override { return iteratort(internal_symbols.begin()); } - virtual iteratort end() override + iteratort end() override { return iteratort(internal_symbols.end()); } diff --git a/src/util/symbol_table_base.cpp b/src/util/symbol_table_base.cpp index c97ff46d059..3d493120475 100644 --- a/src/util/symbol_table_base.cpp +++ b/src/util/symbol_table_base.cpp @@ -24,7 +24,7 @@ bool symbol_table_baset::add(const symbolt &symbol) /// \param name: The name of the symbol to remove /// \return Returns a boolean indicating whether the process failed /// i.e. false if the symbol was removed, or true if it didn't exist. -bool symbol_table_baset::remove(const irep_idt &name) +bool symbol_table_baset::remove(irep_idt name) { symbolst::const_iterator entry = symbols.find(name); if(entry == symbols.end()) @@ -44,7 +44,7 @@ std::vector symbol_table_baset::sorted_symbol_names() const std::sort( sorted_names.begin(), sorted_names.end(), - [](const irep_idt &a, const irep_idt &b) { return a.compare(b) < 0; }); + [](irep_idt a, irep_idt b) { return a.compare(b) < 0; }); return sorted_names; } diff --git a/src/util/symbol_table_base.h b/src/util/symbol_table_base.h index 976d108f4b7..c3c353fb02c 100644 --- a/src/util/symbol_table_base.h +++ b/src/util/symbol_table_base.h @@ -85,7 +85,7 @@ class symbol_table_baset /// Check whether a symbol exists in the symbol table /// \param name: The name of the symbol to look for /// \return True if the symbol exists - bool has_symbol(const irep_idt &name) const + bool has_symbol(irep_idt name) const { return symbols.find(name) != symbols.end(); } @@ -93,7 +93,7 @@ class symbol_table_baset /// Find a symbol in the symbol table for read-only access. /// \param name: The name of the symbol to look for /// \return A pointer to the found symbol if it exists, nullptr otherwise. - const symbolt *lookup(const irep_idt &name) const + const symbolt *lookup(irep_idt name) const { symbolst::const_iterator it = symbols.find(name); return it != symbols.end() ? &it->second : nullptr; @@ -102,7 +102,7 @@ class symbol_table_baset /// Find a symbol in the symbol table for read-only access. /// \param name: The name of the symbol to look for /// \return A reference to the symbol - const symbolt &lookup_ref(const irep_idt &name) const + const symbolt &lookup_ref(irep_idt name) const { const symbolt *const symbol = lookup(name); INVARIANT( @@ -112,8 +112,7 @@ class symbol_table_baset /// Collect all symbols the name of which matches \p id or the base name of /// which matches \p id. - std::list - match_name_or_base_name(const irep_idt &id) const + std::list match_name_or_base_name(irep_idt id) const { std::list results; @@ -140,13 +139,13 @@ class symbol_table_baset /// Find a symbol in the symbol table for read-write access. /// \param name: The name of the symbol to look for /// \return A pointer to the found symbol if it exists, nullptr otherwise. - virtual symbolt *get_writeable(const irep_idt &name) = 0; + virtual symbolt *get_writeable(irep_idt name) = 0; /// Find a symbol in the symbol table for read-write access. /// \param name: The name of the symbol to look for. /// \return A reference to the symbol. /// \throw `std::out_of_range` if no such symbol exists - symbolt &get_writeable_ref(const irep_idt &name) + symbolt &get_writeable_ref(irep_idt name) { symbolt *symbol = get_writeable(name); if(symbol == nullptr) @@ -167,7 +166,7 @@ class symbol_table_baset virtual std::pair insert(symbolt symbol) = 0; virtual bool move(symbolt &symbol, symbolt *&new_symbol) = 0; - bool remove(const irep_idt &name); + bool remove(irep_idt name); /// Remove a symbol from the symbol table /// \param entry: an iterator pointing at the symbol to remove virtual void erase(const symbolst::const_iterator &entry) = 0; @@ -183,7 +182,7 @@ class symbol_table_baset { private: symbolst::iterator it; - std::function on_get_writeable; + std::function on_get_writeable; public: explicit iteratort(symbolst::iterator it) : it(std::move(it)) @@ -191,8 +190,8 @@ class symbol_table_baset } iteratort( - const iteratort &it, - std::function on_get_writeable) + const iteratort &it, + std::function on_get_writeable) : it(it.it), on_get_writeable(std::move(on_get_writeable)) { } diff --git a/src/util/symbol_table_builder.h b/src/util/symbol_table_builder.h index 28046919de6..90ca0bf4aec 100644 --- a/src/util/symbol_table_builder.h +++ b/src/util/symbol_table_builder.h @@ -65,7 +65,7 @@ class symbol_table_buildert : public symbol_table_baset return base_symbol_table.move(symbol, new_symbol); } - symbolt *get_writeable(const irep_idt &identifier) override + symbolt *get_writeable(irep_idt identifier) override { return base_symbol_table.get_writeable(identifier); } diff --git a/src/util/type.h b/src/util/type.h index 94170e003db..a23346772e1 100644 --- a/src/util/type.h +++ b/src/util/type.h @@ -30,7 +30,9 @@ class typet:public irept public: typet() { } - explicit typet(const irep_idt &_id):irept(_id) { } + explicit typet(irep_idt _id) : irept(_id) + { + } // the STL implementation shipped with GCC 5 is broken #if !defined(__GLIBCXX__) || __GLIBCXX__ >= 20181026 @@ -112,12 +114,12 @@ class typet:public irept return *this; } - typet &add_type(const irep_idt &name) + typet &add_type(irep_idt name) { return static_cast(add(name)); } - const typet &find_type(const irep_idt &name) const + const typet &find_type(irep_idt name) const { return static_cast(find(name)); } @@ -223,13 +225,12 @@ class type_with_subtypest:public typet public: typedef std::vector subtypest; - type_with_subtypest(const irep_idt &_id, const subtypest &_subtypes) - : typet(_id) + type_with_subtypest(irep_idt _id, const subtypest &_subtypes) : typet(_id) { subtypes() = _subtypes; } - type_with_subtypest(const irep_idt &_id, subtypest &&_subtypes) : typet(_id) + type_with_subtypest(irep_idt _id, subtypest &&_subtypes) : typet(_id) { subtypes() = std::move(_subtypes); } diff --git a/unit/analyses/ai/ai.cpp b/unit/analyses/ai/ai.cpp index aa888cc33f3..314bea3777c 100644 --- a/unit/analyses/ai/ai.cpp +++ b/unit/analyses/ai/ai.cpp @@ -31,9 +31,9 @@ class instruction_counter_domaint : public ai_domain_baset std::optional path_length; void transform( - const irep_idt &, + irep_idt, trace_ptrt, - const irep_idt &, + irep_idt, trace_ptrt, ai_baset &, const namespacet &) override diff --git a/unit/analyses/ai/ai_simplify_lhs.cpp b/unit/analyses/ai/ai_simplify_lhs.cpp index 7e38f26f392..918ce433403 100644 --- a/unit/analyses/ai/ai_simplify_lhs.cpp +++ b/unit/analyses/ai/ai_simplify_lhs.cpp @@ -28,9 +28,9 @@ class constant_simplification_mockt:public ai_domain_baset { public: void transform( - const irep_idt &, + irep_idt, trace_ptrt, - const irep_idt &, + irep_idt, trace_ptrt, ai_baset &, const namespacet &) override diff --git a/unit/analyses/variable-sensitivity/eval.cpp b/unit/analyses/variable-sensitivity/eval.cpp index 15f50e48a36..3ae53f8751a 100644 --- a/unit/analyses/variable-sensitivity/eval.cpp +++ b/unit/analyses/variable-sensitivity/eval.cpp @@ -12,7 +12,7 @@ #include #include -static symbolt simple_symbol(const irep_idt &identifier, const typet &type) +static symbolt simple_symbol(irep_idt identifier, const typet &type) { symbolt b1{identifier, type, irep_idt{}}; b1.base_name = b1.pretty_name = identifier; diff --git a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp index f26e0da09b5..0657d85c35d 100644 --- a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp +++ b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp @@ -24,7 +24,7 @@ #include exprt binary_expression( - const irep_idt &exprId, + irep_idt exprId, const abstract_object_pointert &op1, const abstract_object_pointert &op2, abstract_environmentt &environment, @@ -83,7 +83,7 @@ class assume_testert } void test_fn( - const irep_idt &exprId, + irep_idt exprId, bool is_true, std::string const &test, std::string const &delimiter) diff --git a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp index 18c7e0b86ca..3b5f37b6c84 100644 --- a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp +++ b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp @@ -25,7 +25,7 @@ static void ASSUME_TRUE( symbol_exprt const &x, - const irep_idt &id, + irep_idt id, symbol_exprt const &y, abstract_environmentt &env, const namespacet &ns) diff --git a/unit/goto-checker/report_util/is_property_less_than.cpp b/unit/goto-checker/report_util/is_property_less_than.cpp index fca7802da02..ab1bfbc032f 100644 --- a/unit/goto-checker/report_util/is_property_less_than.cpp +++ b/unit/goto-checker/report_util/is_property_less_than.cpp @@ -3,10 +3,8 @@ #include #include -static goto_programt::instructiont instruction_for_location( - const irep_idt &file, - const irep_idt &function, - size_t line_no) +static goto_programt::instructiont +instruction_for_location(irep_idt file, irep_idt function, size_t line_no) { source_locationt location; location.set_file(file); @@ -26,8 +24,7 @@ static property_infot test_info(const goto_programt::const_targett &target) return property_infot(target, "ignored", property_statust::UNKNOWN); } -static propertyt -property(const irep_idt &identifier, const property_infot &info) +static propertyt property(irep_idt identifier, const property_infot &info) { return std::make_pair(identifier, info); } diff --git a/unit/goto-instrument/cover/cover_only.cpp b/unit/goto-instrument/cover/cover_only.cpp index 68c413f7253..6132ec31826 100644 --- a/unit/goto-instrument/cover/cover_only.cpp +++ b/unit/goto-instrument/cover/cover_only.cpp @@ -15,7 +15,7 @@ Author: Diffblue Ltd namespace { -symbolt create_new_symbol(const irep_idt &name, const irep_idt &file_name) +symbolt create_new_symbol(irep_idt name, irep_idt file_name) { symbolt symbol; symbol.name = name; diff --git a/unit/goto-symex/apply_condition.cpp b/unit/goto-symex/apply_condition.cpp index 9702a683c53..7b28db43637 100644 --- a/unit/goto-symex/apply_condition.cpp +++ b/unit/goto-symex/apply_condition.cpp @@ -41,7 +41,7 @@ SCENARIO( symex_targett::sourcet source{"fun", target.begin()}; guard_managert guard_manager; std::size_t count = 0; - auto fresh_name = [&count](const irep_idt &) { return count++; }; + auto fresh_name = [&count](irep_idt) { return count++; }; goto_symex_statet state{ source, DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE, diff --git a/unit/goto-symex/goto_symex_state.cpp b/unit/goto-symex/goto_symex_state.cpp index e84340e6709..3771a881baf 100644 --- a/unit/goto-symex/goto_symex_state.cpp +++ b/unit/goto-symex/goto_symex_state.cpp @@ -35,9 +35,8 @@ SCENARIO( symex_targett::sourcet source{"fun", target.begin()}; guard_managert manager; std::size_t fresh_name_count = 1; - auto fresh_name = [&fresh_name_count](const irep_idt &) { - return fresh_name_count++; - }; + auto fresh_name = [&fresh_name_count](irep_idt) + { return fresh_name_count++; }; goto_symex_statet state{ source, DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE, diff --git a/unit/goto-symex/symex_assign.cpp b/unit/goto-symex/symex_assign.cpp index 934138fe490..55fc9d81846 100644 --- a/unit/goto-symex/symex_assign.cpp +++ b/unit/goto-symex/symex_assign.cpp @@ -45,9 +45,8 @@ SCENARIO( symex_targett::sourcet source{"fun", target.begin()}; guard_managert manager; std::size_t fresh_name_count = 1; - auto fresh_name = [&fresh_name_count](const irep_idt &) { - return fresh_name_count++; - }; + auto fresh_name = [&fresh_name_count](irep_idt) + { return fresh_name_count++; }; goto_symex_statet state{ source, DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE, diff --git a/unit/goto-symex/try_evaluate_pointer_comparisons.cpp b/unit/goto-symex/try_evaluate_pointer_comparisons.cpp index f2dff4a284d..9c03a150802 100644 --- a/unit/goto-symex/try_evaluate_pointer_comparisons.cpp +++ b/unit/goto-symex/try_evaluate_pointer_comparisons.cpp @@ -57,7 +57,7 @@ SCENARIO( symex_targett::sourcet source{"fun", target.begin()}; guard_managert guard_manager; std::size_t count = 0; - auto fresh_name = [&count](const irep_idt &) { return count++; }; + auto fresh_name = [&count](irep_idt) { return count++; }; goto_symex_statet state{ source, DEFAULT_MAX_FIELD_SENSITIVITY_ARRAY_SIZE, diff --git a/unit/testing-utils/call_graph_test_utils.cpp b/unit/testing-utils/call_graph_test_utils.cpp index 167deaecfc7..ac24335a77a 100644 --- a/unit/testing-utils/call_graph_test_utils.cpp +++ b/unit/testing-utils/call_graph_test_utils.cpp @@ -10,8 +10,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include -symbolt -create_void_function_symbol(const irep_idt &name, const codet &code) +symbolt create_void_function_symbol(irep_idt name, const codet &code) { const code_typet void_function_type({}, empty_typet()); symbolt function{name, void_function_type, ID_java}; @@ -21,7 +20,7 @@ create_void_function_symbol(const irep_idt &name, const codet &code) bool multimap_key_matches( const std::multimap &map, - const irep_idt &key, + irep_idt key, const std::set &values) { auto matching_values = map.equal_range(key); diff --git a/unit/testing-utils/call_graph_test_utils.h b/unit/testing-utils/call_graph_test_utils.h index ec37b7449e1..fe81b612e95 100644 --- a/unit/testing-utils/call_graph_test_utils.h +++ b/unit/testing-utils/call_graph_test_utils.h @@ -16,12 +16,11 @@ Author: Chris Smowton, chris.smowton@diffblue.com class codet; -symbolt -create_void_function_symbol(const irep_idt &name, const codet &code); +symbolt create_void_function_symbol(irep_idt name, const codet &code); bool multimap_key_matches( const std::multimap &map, - const irep_idt &key, + irep_idt key, const std::set &values); #endif /* CPROVER_TESTING_UTILS_CALL_GRAPH_TEST_UTILS_HT */ diff --git a/unit/testing-utils/require_expr.cpp b/unit/testing-utils/require_expr.cpp index f5fc7d32dc8..36c0a16b695 100644 --- a/unit/testing-utils/require_expr.cpp +++ b/unit/testing-utils/require_expr.cpp @@ -52,8 +52,8 @@ index_exprt require_expr::require_top_index(const exprt &expr) /// \param component_identifier: The name of the component that should be being /// accessed. /// \return The expr cast to a member_exprt. -member_exprt require_expr::require_member( - const exprt &expr, const irep_idt &component_identifier) +member_exprt +require_expr::require_member(const exprt &expr, irep_idt component_identifier) { REQUIRE(expr.id()==ID_member); const member_exprt &member_expr=to_member_expr(expr); @@ -66,8 +66,8 @@ member_exprt require_expr::require_member( /// \param expr: The expression. /// \param symbol_name: The intended identifier of the symbol /// \return The expr cast to a symbol_exprt -symbol_exprt require_expr::require_symbol( - const exprt &expr, const irep_idt &symbol_name) +symbol_exprt +require_expr::require_symbol(const exprt &expr, irep_idt symbol_name) { const symbol_exprt &symbol_expr = require_symbol(expr); REQUIRE(symbol_expr.identifier() == symbol_name); @@ -98,7 +98,7 @@ typecast_exprt require_expr::require_typecast(const exprt &expr) /// \return The expr cast to a side_effect_exprt side_effect_exprt require_expr::require_side_effect_expr( const exprt &expr, - const irep_idt &side_effect_statement) + irep_idt side_effect_statement) { REQUIRE(expr.id() == ID_side_effect); const side_effect_exprt &side_effect_expr = to_side_effect_expr(expr); diff --git a/unit/testing-utils/require_expr.h b/unit/testing-utils/require_expr.h index c2e28295428..62e55660435 100644 --- a/unit/testing-utils/require_expr.h +++ b/unit/testing-utils/require_expr.h @@ -23,19 +23,16 @@ namespace require_expr index_exprt require_index(const exprt &expr, int expected_index); index_exprt require_top_index(const exprt &expr); - member_exprt require_member( - const exprt &expr, const irep_idt &component_identifier); + member_exprt require_member(const exprt &expr, irep_idt component_identifier); - symbol_exprt require_symbol( - const exprt &expr, const irep_idt &symbol_name); + symbol_exprt require_symbol(const exprt &expr, irep_idt symbol_name); symbol_exprt require_symbol(const exprt &expr); typecast_exprt require_typecast(const exprt &expr); - side_effect_exprt require_side_effect_expr( - const exprt &expr, - const irep_idt &side_effect_statement); + side_effect_exprt + require_side_effect_expr(const exprt &expr, irep_idt side_effect_statement); } #endif // CPROVER_TESTING_UTILS_REQUIRE_EXPR_H diff --git a/unit/testing-utils/require_symbol.cpp b/unit/testing-utils/require_symbol.cpp index 4e3289ff32f..234648326b3 100644 --- a/unit/testing-utils/require_symbol.cpp +++ b/unit/testing-utils/require_symbol.cpp @@ -17,7 +17,7 @@ Author: Diffblue Limited. /// \param symbol_identifier: The name of the symbol const symbolt &require_symbol::require_symbol_exists( const symbol_tablet &symbol_table, - const irep_idt &symbol_identifier) + irep_idt symbol_identifier) { const symbolt *found_symbol = symbol_table.lookup(symbol_identifier); INFO("Looking for symbol: " + id2string(symbol_identifier)); diff --git a/unit/testing-utils/require_symbol.h b/unit/testing-utils/require_symbol.h index 846b17d10df..ddc4c8e4d61 100644 --- a/unit/testing-utils/require_symbol.h +++ b/unit/testing-utils/require_symbol.h @@ -26,7 +26,7 @@ namespace require_symbol const symbolt & require_symbol_exists( const symbol_tablet &symbol_table, - const irep_idt &symbol_identifier); + irep_idt symbol_identifier); } #endif // CPROVER_TESTING_UTILS_REQUIRE_SYMBOL_H diff --git a/unit/util/sharing_map.cpp b/unit/util/sharing_map.cpp index 8b4640405e2..ef265e6cacd 100644 --- a/unit/util/sharing_map.cpp +++ b/unit/util/sharing_map.cpp @@ -534,16 +534,17 @@ TEST_CASE("Sharing map views and iteration", "[core][util]") { sharing_map_standardt sm; - sm.iterate([](const irep_idt &key, const std::string &value) {}); + sm.iterate([](irep_idt key, const std::string &value) {}); fill(sm); typedef std::pair pt; std::vector pairs; - sm.iterate([&pairs](const irep_idt &key, const std::string &value) { - pairs.push_back({id2string(key), value}); - }); + sm.iterate( + [&pairs](irep_idt key, const std::string &value) { + pairs.push_back({id2string(key), value}); + }); std::sort(pairs.begin(), pairs.end()); REQUIRE(pairs.size() == 3);