diff --git a/.github/workflows/pull-request-checks.yaml b/.github/workflows/pull-request-checks.yaml index e98c0b30fba..16628d3aaca 100644 --- a/.github/workflows/pull-request-checks.yaml +++ b/.github/workflows/pull-request-checks.yaml @@ -785,6 +785,33 @@ jobs: - name: Smoke test goto-analyzer run: docker run -v ${PWD}/.github/workflows/smoke_test_assets:/mnt/smoke -t cbmc goto-analyzer /mnt/smoke/test.goto --unreachable-functions + include-what-you-use: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Fetch dependencies + env: + # This is needed in addition to -yq to prevent apt-get from asking for + # user input + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -yq cmake ninja-build gcc gdb g++ maven flex bison iwyu + - name: Configure using CMake + run: | + mkdir build + cd build + cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ + - name: Run include-what-you-use + run: | + iwyu_tool -p build/compile_commands.json -j2 | tee includes.txt + if sed '/minisat2-src/,/^--$/d' includes.txt | grep '^- ' -B1 ; then + echo "Unnecessary includes found. Use '// IWYU pragma: keep' to override this." + exit 1 + fi + codecov-coverage-report: runs-on: ubuntu-20.04 steps: diff --git a/jbmc/src/janalyzer/janalyzer_parse_options.cpp b/jbmc/src/janalyzer/janalyzer_parse_options.cpp index 2dee778f015..d233a47f710 100644 --- a/jbmc/src/janalyzer/janalyzer_parse_options.cpp +++ b/jbmc/src/janalyzer/janalyzer_parse_options.cpp @@ -43,7 +43,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include // exit() -#include +#include // IWYU pragma: keep #include #include diff --git a/jbmc/src/java_bytecode/character_refine_preprocess.cpp b/jbmc/src/java_bytecode/character_refine_preprocess.cpp index 3ee99059eca..6387c743fa3 100644 --- a/jbmc/src/java_bytecode/character_refine_preprocess.cpp +++ b/jbmc/src/java_bytecode/character_refine_preprocess.cpp @@ -19,6 +19,8 @@ Date: March 2017 #include #include +#include + /// converts based on a function on expressions /// \param expr_function: A reference to a function on expressions /// \param target: A position in a goto program diff --git a/jbmc/src/java_bytecode/character_refine_preprocess.h b/jbmc/src/java_bytecode/character_refine_preprocess.h index 829aa8c19d5..a9ae6e4e8ce 100644 --- a/jbmc/src/java_bytecode/character_refine_preprocess.h +++ b/jbmc/src/java_bytecode/character_refine_preprocess.h @@ -20,13 +20,13 @@ Date: March 2017 #ifndef CPROVER_JAVA_BYTECODE_CHARACTER_REFINE_PREPROCESS_H #define CPROVER_JAVA_BYTECODE_CHARACTER_REFINE_PREPROCESS_H -#include - #include -#include +#include #include +class code_function_callt; + class character_refine_preprocesst { public: diff --git a/jbmc/src/java_bytecode/ci_lazy_methods.cpp b/jbmc/src/java_bytecode/ci_lazy_methods.cpp index 59b90f8f2ec..e3a05104dc9 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods.cpp +++ b/jbmc/src/java_bytecode/ci_lazy_methods.cpp @@ -7,17 +7,19 @@ Author: Diffblue Ltd. \*******************************************************************/ #include "ci_lazy_methods.h" -#include "java_bytecode_language.h" -#include "java_class_loader.h" -#include "java_entry_point.h" -#include "remove_exceptions.h" #include #include #include +#include #include +#include "java_bytecode_language.h" +#include "java_class_loader.h" +#include "java_entry_point.h" +#include "remove_exceptions.h" + /// Constructor for lazy-method loading /// \param symbol_table: the symbol table to use /// \param main_class: identifier of the entry point / main class @@ -34,7 +36,7 @@ Author: Diffblue Ltd. /// these method bodies are produced internally, rather than generated from /// Java bytecode. ci_lazy_methodst::ci_lazy_methodst( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const irep_idt &main_class, const std::vector &main_jar_classes, const std::vector &lazy_methods_extra_entry_points, @@ -96,7 +98,7 @@ static bool references_class_model(const exprt &expr) /// \param message_handler: the message handler to use for output /// \return Returns false on success bool ci_lazy_methodst::operator()( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, method_bytecodet &method_bytecode, const method_convertert &method_converter, message_handlert &message_handler) @@ -221,7 +223,16 @@ bool ci_lazy_methodst::operator()( << symbol_table.symbols.size() - keep_symbols.symbols.size() << " unreachable methods and globals" << messaget::eom; - symbol_table.swap(keep_symbols); + auto sorted_to_keep = keep_symbols.sorted_symbol_names(); + auto all_sorted = symbol_table.sorted_symbol_names(); + auto it = sorted_to_keep.cbegin(); + for(const auto &id : all_sorted) + { + if(it == sorted_to_keep.cend() || id != *it) + symbol_table.remove(id); + else + ++it; + } return false; } @@ -238,7 +249,7 @@ bool ci_lazy_methodst::handle_virtual_methods_with_no_callees( std::unordered_set &instantiated_classes, const std::unordered_set &virtual_functions, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { ci_lazy_methods_neededt lazy_methods_loader( methods_to_convert_later, @@ -321,7 +332,7 @@ ci_lazy_methodst::convert_and_analyze_method( std::unordered_set &methods_already_populated, const bool class_initializer_already_seen, const irep_idt &method_name, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, std::unordered_set &methods_to_convert_later, std::unordered_set &instantiated_classes, std::unordered_set @@ -367,7 +378,7 @@ ci_lazy_methodst::convert_and_analyze_method( /// * all the methods of the main jar file /// \return set of identifiers of entry point methods std::unordered_set ci_lazy_methodst::entry_point_methods( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, message_handlert &message_handler) { std::unordered_set methods_to_convert_later; @@ -481,7 +492,7 @@ void ci_lazy_methodst::get_virtual_method_targets( const class_method_descriptor_exprt &called_function, const std::unordered_set &instantiated_classes, std::unordered_set &callable_methods, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { const auto &call_class = called_function.class_id(); const auto &method_name = called_function.mangled_method_name(); @@ -506,8 +517,8 @@ void ci_lazy_methodst::get_virtual_method_targets( /// `e` or its children. void ci_lazy_methodst::gather_needed_globals( const exprt &e, - const symbol_tablet &symbol_table, - symbol_tablet &needed) + const symbol_table_baset &symbol_table, + symbol_table_baset &needed) { if(e.id()==ID_symbol) { @@ -546,7 +557,7 @@ irep_idt ci_lazy_methodst::get_virtual_method_target( const std::unordered_set &instantiated_classes, const irep_idt &call_basename, const irep_idt &classname, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { // Program-wide, is this class ever instantiated? if(!instantiated_classes.count(classname)) diff --git a/jbmc/src/java_bytecode/ci_lazy_methods.h b/jbmc/src/java_bytecode/ci_lazy_methods.h index 558b92bc0e4..04fab8e5068 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods.h +++ b/jbmc/src/java_bytecode/ci_lazy_methods.h @@ -27,6 +27,7 @@ class ci_lazy_methods_neededt; class java_class_loadert; class message_handlert; class select_pointer_typet; +class symbol_table_baset; // Map from method id to class_method_and_bytecodet class method_bytecodet @@ -90,14 +91,14 @@ typedef std::function< bool(const irep_idt &function_id, ci_lazy_methods_neededt)> method_convertert; -typedef std::function(const symbol_tablet &)> +typedef std::function(const symbol_table_baset &)> load_extra_methodst; class ci_lazy_methodst { public: ci_lazy_methodst( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const irep_idt &main_class, const std::vector &main_jar_classes, const std::vector &lazy_methods_extra_entry_points, @@ -108,7 +109,7 @@ class ci_lazy_methodst // not const since messaget bool operator()( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, method_bytecodet &method_bytecode, const method_convertert &method_converter, message_handlert &message_handler); @@ -127,18 +128,18 @@ class ci_lazy_methodst const class_method_descriptor_exprt &called_function, const std::unordered_set &instantiated_classes, std::unordered_set &callable_methods, - symbol_tablet &symbol_table); + symbol_table_baset &symbol_table); void gather_needed_globals( const exprt &e, - const symbol_tablet &symbol_table, - symbol_tablet &needed); + const symbol_table_baset &symbol_table, + symbol_table_baset &needed); irep_idt get_virtual_method_target( const std::unordered_set &instantiated_classes, const irep_idt &call_basename, const irep_idt &classname, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); static irep_idt build_virtual_method_name( const irep_idt &class_name, @@ -154,7 +155,7 @@ class ci_lazy_methodst const synthetic_methods_mapt &synthetic_methods; std::unordered_set entry_point_methods( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, message_handlert &message_handler); struct convert_method_resultt @@ -168,7 +169,7 @@ class ci_lazy_methodst std::unordered_set &methods_already_populated, const bool class_initializer_already_seen, const irep_idt &method_name, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, std::unordered_set &methods_to_convert_later, std::unordered_set &instantiated_classes, std::unordered_set @@ -180,7 +181,7 @@ class ci_lazy_methodst std::unordered_set &instantiated_classes, const std::unordered_set &virtual_functions, - symbol_tablet &symbol_table); + symbol_table_baset &symbol_table); }; #endif // CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H diff --git a/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp b/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp index 0fbd027ffae..2cc9ac0c453 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp +++ b/jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp @@ -11,13 +11,13 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include "ci_lazy_methods_needed.h" -#include - #include #include -#include +#include + +#include -#include "generic_parameter_specialization_map.h" +#include "generic_parameter_specialization_map.h" // IWYU pragma: keep #include "java_static_initializers.h" #include "java_types.h" #include "select_pointer_type.h" diff --git a/jbmc/src/java_bytecode/ci_lazy_methods_needed.h b/jbmc/src/java_bytecode/ci_lazy_methods_needed.h index 188d6509d18..9e4ebe9096a 100644 --- a/jbmc/src/java_bytecode/ci_lazy_methods_needed.h +++ b/jbmc/src/java_bytecode/ci_lazy_methods_needed.h @@ -19,7 +19,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com class namespacet; class pointer_typet; class select_pointer_typet; -class symbol_tablet; +class symbol_table_baset; class typet; class ci_lazy_methods_neededt @@ -28,7 +28,7 @@ class ci_lazy_methods_neededt ci_lazy_methods_neededt( std::unordered_set &_callable_methods, std::unordered_set &_instantiated_classes, - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const select_pointer_typet &pointer_type_selector) : callable_methods(_callable_methods), instantiated_classes(_instantiated_classes), @@ -53,7 +53,7 @@ class ci_lazy_methods_neededt // found so far, so we can use a membership test to avoid // repeatedly exploring a class hierarchy. std::unordered_set &instantiated_classes; - const symbol_tablet &symbol_table; + const symbol_table_baset &symbol_table; const select_pointer_typet &pointer_type_selector; diff --git a/jbmc/src/java_bytecode/code_with_references.cpp b/jbmc/src/java_bytecode/code_with_references.cpp index 7bc38bab3f7..7435303a0ab 100644 --- a/jbmc/src/java_bytecode/code_with_references.cpp +++ b/jbmc/src/java_bytecode/code_with_references.cpp @@ -9,8 +9,6 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #include "code_with_references.h" #include "java_types.h" -#include - #include codet allocate_array( 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 a9ecc43be65..9712da07b92 100644 --- a/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h +++ b/jbmc/src/java_bytecode/create_array_with_type_intrinsic.h @@ -12,7 +12,7 @@ Author: Diffblue Ltd. #ifndef CPROVER_JAVA_BYTECODE_CREATE_ARRAY_WITH_TYPE_INTRINSIC_H #define CPROVER_JAVA_BYTECODE_CREATE_ARRAY_WITH_TYPE_INTRINSIC_H -#include +#include class message_handlert; class symbol_table_baset; diff --git a/jbmc/src/java_bytecode/java_bmc_util.cpp b/jbmc/src/java_bytecode/java_bmc_util.cpp index fff94bc9a37..dbe3ed8f2a2 100644 --- a/jbmc/src/java_bytecode/java_bmc_util.cpp +++ b/jbmc/src/java_bytecode/java_bmc_util.cpp @@ -4,7 +4,7 @@ Module: Bounded Model Checking Utils for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Bounded Model Checking Utils for Java diff --git a/jbmc/src/java_bytecode/java_bmc_util.h b/jbmc/src/java_bytecode/java_bmc_util.h index d21a21d7c4f..6f1a622f78d 100644 --- a/jbmc/src/java_bytecode/java_bmc_util.h +++ b/jbmc/src/java_bytecode/java_bmc_util.h @@ -4,7 +4,7 @@ Module: Bounded Model Checking Utils for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Bounded Model Checking Utils for Java diff --git a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp index cc5168eb627..d62c0b53d32 100644 --- a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp @@ -7,9 +7,6 @@ Author: Kurt Degiogrio, kurt.degiorgio@diffblue.com \*******************************************************************/ #include "java_bytecode_concurrency_instrumentation.h" -#include "expr2java.h" -#include "java_types.h" -#include "java_utils.h" #include #include @@ -17,7 +14,11 @@ Author: Kurt Degiogrio, kurt.degiorgio@diffblue.com #include #include #include -#include +#include + +#include "expr2java.h" +#include "java_types.h" +#include "java_utils.h" // Disable linter to allow an std::string constant. const std::string next_thread_id = CPROVER_PREFIX "_next_thread_id";// NOLINT(*) @@ -33,7 +34,7 @@ const std::string thread_id = CPROVER_PREFIX "_thread_id";// NOLINT(*) /// /param is_static_lifetime: if true this symbol will be set as static /// /return returns new or existing symbol. static symbolt add_or_get_symbol( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &name, const irep_idt &base_name, const typet &type, @@ -101,7 +102,7 @@ static const std::string get_thread_block_identifier( /// \param object: expression representing a 'java.Lang.Object'. This object is /// used to achieve object-level locking by calling monitoroenter/monitorexit. static codet get_monitor_call( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, bool is_enter, const exprt &object) { @@ -206,7 +207,7 @@ static void monitor_exits(codet &code, const codet &monitorexit) /// \param symbol: writeable symbol hosting code to synchronize /// \param sync_object: object to use as a lock static void instrument_synchronized_code( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, symbolt &symbol, const exprt &sync_object) { @@ -271,7 +272,7 @@ static void instrument_synchronized_code( static void instrument_start_thread( const code_function_callt &f_code, codet &code, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { PRECONDITION(f_code.arguments().size() == 1); @@ -341,7 +342,7 @@ static void instrument_start_thread( static void instrument_end_thread( const code_function_callt &f_code, codet &code, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { PRECONDITION(f_code.arguments().size() == 1); (void)symbol_table; // unused parameter @@ -375,7 +376,7 @@ static void instrument_end_thread( static void instrument_get_current_thread_id( const code_function_callt &f_code, codet &code, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { PRECONDITION(f_code.arguments().size() == 0); @@ -406,7 +407,7 @@ static void instrument_get_current_thread_id( static void instrument_get_monitor_count( const code_function_callt &f_code, codet &code, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { PRECONDITION(f_code.arguments().size() == 1); @@ -484,10 +485,10 @@ static void instrument_get_monitor_count( /// symex. See https://github.com/diffblue/cbmc/issues/1630/for more details. /// /// \param symbol_table: a symbol table -void convert_threadblock(symbol_tablet &symbol_table) +void convert_threadblock(symbol_table_baset &symbol_table) { - using instrument_callbackt = - std::function; + using instrument_callbackt = std::function; using expr_replacement_mapt = std::unordered_map; @@ -603,7 +604,7 @@ void convert_threadblock(symbol_tablet &symbol_table) /// \param symbol_table: a symbol table /// \param message_handler: status output void convert_synchronized_methods( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { namespacet ns(symbol_table); diff --git a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.h b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.h index 24f571407d0..045655c59b1 100644 --- a/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.h +++ b/jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.h @@ -9,11 +9,11 @@ Author: Kurt Degiogrio, kurt.degiorgio@diffblue.com #define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONCURRENCY_INSTRUMENTATION_H class message_handlert; -class symbol_tablet; +class symbol_table_baset; -void convert_threadblock(symbol_tablet &symbol_table); +void convert_threadblock(symbol_table_baset &symbol_table); void convert_synchronized_methods( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler); #endif diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp b/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp index 8a49ba53cde..2c1fbca5a83 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_convert_class.cpp @@ -15,23 +15,26 @@ Author: Daniel Kroening, kroening@kroening.com #include #endif -#include "ci_lazy_methods.h" -#include "java_bytecode_convert_method.h" #include "java_root_class.h" -#include "java_types.h" -#include "java_utils.h" #include #include #include #include #include +#include + +#include "ci_lazy_methods.h" +#include "java_bytecode_convert_method.h" +#include "java_string_library_preprocess.h" +#include "java_types.h" +#include "java_utils.h" class java_bytecode_convert_classt { public: java_bytecode_convert_classt( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, message_handlert &_message_handler, size_t _max_array_length, method_bytecodet &method_bytecode, @@ -105,7 +108,7 @@ class java_bytecode_convert_classt private: messaget log; - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; const size_t max_array_length; method_bytecodet &method_bytecode; java_string_library_preprocesst &string_preprocess; @@ -790,7 +793,7 @@ void java_bytecode_convert_classt::convert( } } -void add_java_array_types(symbol_tablet &symbol_table) +void add_java_array_types(symbol_table_baset &symbol_table) { const std::string letters="ijsbcfdza"; @@ -1003,7 +1006,7 @@ void add_java_array_types(symbol_tablet &symbol_table) bool java_bytecode_convert_class( const java_class_loadert::parse_tree_with_overlayst &parse_trees, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, size_t max_array_length, method_bytecodet &method_bytecode, @@ -1188,7 +1191,7 @@ void convert_java_annotations( /// corresponding outer classes. void mark_java_implicitly_generic_class_type( const irep_idt &class_name, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { const std::string qualified_class_name = "java::" + id2string(class_name); PRECONDITION(symbol_table.has_symbol(qualified_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 d3e7a3d40cf..432dc8a7760 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_class.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_class.h @@ -19,12 +19,12 @@ Author: Daniel Kroening, kroening@kroening.com class java_string_library_preprocesst; class method_bytecodet; -class symbol_tablet; +class symbol_table_baset; /// See class \ref java_bytecode_convert_classt bool java_bytecode_convert_class( const java_class_loadert::parse_tree_with_overlayst &parse_trees, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, size_t max_array_length, method_bytecodet &, @@ -41,14 +41,14 @@ void convert_java_annotations( void mark_java_implicitly_generic_class_type( const irep_idt &class_name, - symbol_tablet &symbol_table); + symbol_table_baset &symbol_table); /// Register in the \p symbol_table new symbols for the objects /// java::array[X] where X is byte, short, int, long, char, boolean, float, /// double and reference. /// Also registers a java::array[X].clone():Ljava/lang/Object; method for each /// type. -void add_java_array_types(symbol_tablet &symbol_table); +void add_java_array_types(symbol_table_baset &symbol_table); /// An exception that is raised checking whether a class is implicitly /// generic if a symbol for an outer class is missing diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp b/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp index 78491480ef3..037095bb366 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method.cpp @@ -13,17 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #endif -#include "bytecode_info.h" -#include "java_bytecode_convert_method.h" #include "java_bytecode_convert_method_class.h" -#include "java_expr.h" -#include "java_static_initializers.h" -#include "java_string_library_preprocess.h" -#include "java_string_literal_expr.h" -#include "java_types.h" -#include "java_utils.h" -#include "lambda_synthesis.h" -#include "pattern.h" #include #include @@ -34,14 +24,26 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include +#include // IWYU pragma: keep #include +#include #include #include #include +#include "bytecode_info.h" +#include "java_bytecode_convert_method.h" +#include "java_expr.h" +#include "java_static_initializers.h" +#include "java_string_library_preprocess.h" +#include "java_string_literal_expr.h" +#include "java_types.h" +#include "java_utils.h" +#include "lambda_synthesis.h" +#include "pattern.h" + #include #include @@ -302,7 +304,7 @@ void java_bytecode_convert_method_lazy( symbolt &class_symbol, const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt &m, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { symbolt method_symbol; diff --git a/jbmc/src/java_bytecode/java_bytecode_convert_method.h b/jbmc/src/java_bytecode/java_bytecode_convert_method.h index 1d0feb899f9..e9a0fe01742 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method.h @@ -12,13 +12,8 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_METHOD_H #define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_METHOD_H -#include "ci_lazy_methods_needed.h" #include "java_bytecode_convert_method_class.h" #include "java_bytecode_parse_tree.h" -#include "java_string_library_preprocess.h" - -#include -#include class class_hierarchyt; class prefix_filtert; @@ -56,7 +51,7 @@ void java_bytecode_convert_method_lazy( symbolt &class_symbol, const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt &, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &); typedef expanding_vectort> 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 c605e22c0b8..a75714f9669 100644 --- a/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h +++ b/jbmc/src/java_bytecode/java_bytecode_convert_method_class.h @@ -12,23 +12,24 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_METHOD_CLASS_H #define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_METHOD_CLASS_H -#include "ci_lazy_methods_needed.h" -#include "java_bytecode_parse_tree.h" #include "java_bytecode_convert_class.h" #include #include +#include #include #include #include -#include +#include "ci_lazy_methods_needed.h" +#include "java_bytecode_parse_tree.h" + #include +#include class class_hierarchyt; class prefix_filtert; -class symbol_tablet; class symbolt; class java_bytecode_convert_methodt diff --git a/jbmc/src/java_bytecode/java_bytecode_instrument.cpp b/jbmc/src/java_bytecode/java_bytecode_instrument.cpp index 2672a762146..b0e82a9af3b 100644 --- a/jbmc/src/java_bytecode/java_bytecode_instrument.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_instrument.cpp @@ -10,12 +10,12 @@ Date: June 2017 #include "java_bytecode_instrument.h" -#include - #include #include #include -#include +#include + +#include #include "java_expr.h" #include "java_types.h" @@ -591,7 +591,7 @@ void java_bytecode_instrument_uncaught_exceptions( /// this flag is set to true. /// \param message_handler: stream to report status and warnings void java_bytecode_instrument( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const bool throw_runtime_exceptions, message_handlert &message_handler) { diff --git a/jbmc/src/java_bytecode/java_bytecode_instrument.h b/jbmc/src/java_bytecode/java_bytecode_instrument.h index 14403c40326..e3341f4b406 100644 --- a/jbmc/src/java_bytecode/java_bytecode_instrument.h +++ b/jbmc/src/java_bytecode/java_bytecode_instrument.h @@ -17,7 +17,6 @@ Date: June 2017 class code_blockt; class message_handlert; class symbol_table_baset; -class symbol_tablet; class symbolt; class source_locationt; @@ -28,7 +27,7 @@ void java_bytecode_instrument_symbol( message_handlert &_message_handler); void java_bytecode_instrument( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const bool throw_runtime_exceptions, message_handlert &_message_handler); diff --git a/jbmc/src/java_bytecode/java_bytecode_internal_additions.cpp b/jbmc/src/java_bytecode/java_bytecode_internal_additions.cpp index c30152ea932..a617e12e2a6 100644 --- a/jbmc/src/java_bytecode/java_bytecode_internal_additions.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_internal_additions.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "remove_exceptions.h" #include -#include #include #include #include diff --git a/jbmc/src/java_bytecode/java_bytecode_language.cpp b/jbmc/src/java_bytecode/java_bytecode_language.cpp index 537782872e2..a87fe77ac83 100644 --- a/jbmc/src/java_bytecode/java_bytecode_language.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_language.cpp @@ -21,7 +21,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include @@ -125,7 +124,7 @@ prefix_filtert get_context(const optionst &options) } std::unordered_multimap & -lazy_class_to_declared_symbols_mapt::get(const symbol_tablet &symbol_table) +lazy_class_to_declared_symbols_mapt::get(const symbol_table_baset &symbol_table) { if(!initialized) { @@ -456,7 +455,7 @@ bool java_bytecode_languaget::parse( /// \param symbol_table: global symbol table static void infer_opaque_type_fields( const java_bytecode_parse_treet &parse_tree, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { namespacet ns(symbol_table); for(const auto &method : parse_tree.parsed_class.methods) @@ -520,7 +519,8 @@ 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, symbol_tablet &symbol_table) + const irep_idt &class_id, + symbol_table_baset &symbol_table) { struct_tag_typet java_lang_Class("java::java.lang.Class"); symbol_exprt symbol_expr( @@ -563,7 +563,7 @@ static symbol_exprt get_or_create_class_literal_symbol( /// \return ldc result static exprt get_ldc_result( const exprt &ldc_arg0, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, bool string_refinement_enabled) { if(ldc_arg0.id() == ID_type) @@ -600,7 +600,7 @@ static exprt get_ldc_result( /// which changes how string literals are structured. static void generate_constant_global_variables( java_bytecode_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, bool string_refinement_enabled) { for(auto &method : parse_tree.parsed_class.methods) @@ -690,7 +690,7 @@ static void create_stub_global_symbol( /// including start_class_id itself. static irep_idt get_any_incomplete_ancestor_for_stub_static_field( const irep_idt &start_class_id, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const class_hierarchyt &class_hierarchy) { // Depth-first search: return the first stub ancestor, or irep_idt() if none @@ -806,7 +806,7 @@ static void create_stub_global_symbols( } bool java_bytecode_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &) { PRECONDITION(language_options.has_value()); @@ -1055,7 +1055,7 @@ bool java_bytecode_languaget::typecheck( } bool java_bytecode_languaget::generate_support_functions( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { PRECONDITION(language_options.has_value()); @@ -1115,7 +1115,7 @@ bool java_bytecode_languaget::generate_support_functions( /// from the main entry point (usually provided with the --function command- /// line option) (side-effect on the symbol_table). Returns false on success. bool java_bytecode_languaget::do_ci_lazy_method_conversion( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { symbol_table_buildert symbol_table_builder = symbol_table_buildert::wrap(symbol_table); diff --git a/jbmc/src/java_bytecode/java_bytecode_language.h b/jbmc/src/java_bytecode/java_bytecode_language.h index 2c9587e4ce7..486a3447c88 100644 --- a/jbmc/src/java_bytecode/java_bytecode_language.h +++ b/jbmc/src/java_bytecode/java_bytecode_language.h @@ -10,8 +10,16 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_LANGUAGE_H #define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_LANGUAGE_H +#include +#include +#include +#include // IWYU pragma: keep + +#include + #include "ci_lazy_methods.h" #include "ci_lazy_methods_needed.h" +#include "code_with_references.h" // IWYU pragma: keep #include "java_class_loader.h" #include "java_object_factory_parameters.h" #include "java_static_initializers.h" @@ -21,12 +29,6 @@ Author: Daniel Kroening, kroening@kroening.com #include -#include -#include -#include - -#include - // clang-format off #define JAVA_BYTECODE_LANGUAGE_OPTIONS /*NOLINT*/ \ "(disable-uncaught-exception-check)" \ @@ -179,8 +181,6 @@ Author: Daniel Kroening, kroening@kroening.com " (checked in this order).\n" // clang-format on -class symbolt; - enum lazy_methods_modet { LAZY_METHODS_MODE_EAGER, @@ -204,7 +204,7 @@ class lazy_class_to_declared_symbols_mapt lazy_class_to_declared_symbols_mapt() = default; std::unordered_multimap & - get(const symbol_tablet &symbol_table); + get(const symbol_table_baset &symbol_table); void reinitialize(); @@ -293,12 +293,10 @@ class java_bytecode_languaget:public languaget std::istream &instream, const std::string &path) override; - bool generate_support_functions( - symbol_tablet &symbol_table) override; + bool generate_support_functions(symbol_table_baset &symbol_table) override; - bool typecheck( - symbol_tablet &context, - const std::string &module) override; + bool + typecheck(symbol_table_baset &context, const std::string &module) override; virtual bool final(symbol_table_baset &context) override; @@ -371,7 +369,7 @@ class java_bytecode_languaget:public languaget optionalt needed_lazy_methods, lazy_class_to_declared_symbols_mapt &class_to_declared_symbols); - bool do_ci_lazy_method_conversion(symbol_tablet &); + bool do_ci_lazy_method_conversion(symbol_table_baset &); const select_pointer_typet &get_pointer_type_selector() const; optionalt language_options; diff --git a/jbmc/src/java_bytecode/java_bytecode_parser.cpp b/jbmc/src/java_bytecode/java_bytecode_parser.cpp index dbb04f04732..aea33b4c275 100644 --- a/jbmc/src/java_bytecode/java_bytecode_parser.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_parser.cpp @@ -18,7 +18,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include "bytecode_info.h" #include "java_bytecode_parse_tree.h" diff --git a/jbmc/src/java_bytecode/java_bytecode_typecheck_expr.cpp b/jbmc/src/java_bytecode/java_bytecode_typecheck_expr.cpp index 0a502d20260..682ec957091 100644 --- a/jbmc/src/java_bytecode/java_bytecode_typecheck_expr.cpp +++ b/jbmc/src/java_bytecode/java_bytecode_typecheck_expr.cpp @@ -11,9 +11,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "java_bytecode_typecheck.h" -#include #include -#include #include #include "java_pointer_casts.h" diff --git a/jbmc/src/java_bytecode/java_entry_point.cpp b/jbmc/src/java_bytecode/java_entry_point.cpp index 05e37b1c535..27628afeabd 100644 --- a/jbmc/src/java_bytecode/java_entry_point.cpp +++ b/jbmc/src/java_bytecode/java_entry_point.cpp @@ -649,7 +649,7 @@ bool generate_java_start_function( // build call to initialization function { - symbol_tablet::symbolst::const_iterator init_it= + symbol_table_baset::symbolst::const_iterator init_it = symbol_table.symbols.find(INITIALIZE_FUNCTION); if(init_it==symbol_table.symbols.end()) diff --git a/jbmc/src/java_bytecode/java_entry_point.h b/jbmc/src/java_bytecode/java_entry_point.h index 93b6b099f55..077a0438db0 100644 --- a/jbmc/src/java_bytecode/java_entry_point.h +++ b/jbmc/src/java_bytecode/java_entry_point.h @@ -13,7 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -class code_blockt; +class code_blockt; // IWYU pragma: keep class select_pointer_typet; class symbol_table_baset; struct java_object_factory_parameterst; diff --git a/jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.cpp b/jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.cpp index 4661929b391..bd89b07e2a6 100644 --- a/jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.cpp +++ b/jbmc/src/java_bytecode/java_enum_static_init_unwind_handler.cpp @@ -10,14 +10,15 @@ Author: Chris Smowton, chris.smowton@diffblue.com /// Unwind loops in static initializers #include "java_enum_static_init_unwind_handler.h" -#include "java_utils.h" #include -#include +#include // IWYU pragma: keep #include #include +#include "java_utils.h" + /// Check if we may be in a function that loops over the cases of an /// enumeration (note we return a candidate function that matches a pattern; /// our caller must verify it really belongs to an enumeration). diff --git a/jbmc/src/java_bytecode/java_local_variable_table.cpp b/jbmc/src/java_bytecode/java_local_variable_table.cpp index 2a2f3d5d128..9ac430d1b05 100644 --- a/jbmc/src/java_bytecode/java_local_variable_table.cpp +++ b/jbmc/src/java_bytecode/java_local_variable_table.cpp @@ -11,12 +11,12 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include "java_bytecode_convert_method_class.h" -#include "java_types.h" - #include #include #include -#include +#include + +#include "java_types.h" #include 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 74071b22098..6bd53817086 100644 --- a/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp +++ b/jbmc/src/java_bytecode/java_multi_path_symex_checker.cpp @@ -4,13 +4,11 @@ Module: Goto Checker using Bounded Model Checking for Java Author: Jeannie Moulton - \*******************************************************************/ +\*******************************************************************/ #include "java_multi_path_symex_checker.h" #include "java_trace_validation.h" -#include - goto_tracet java_multi_path_symex_checkert::build_full_trace() const { goto_tracet goto_trace = multi_path_symex_checkert::build_full_trace(); 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 3800831167a..99f63aa050a 100644 --- a/jbmc/src/java_bytecode/java_multi_path_symex_checker.h +++ b/jbmc/src/java_bytecode/java_multi_path_symex_checker.h @@ -4,7 +4,7 @@ Module: Goto Checker using Bounded Model Checking for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Goto Checker using Bounded Model Checking for Java diff --git a/jbmc/src/java_bytecode/java_multi_path_symex_only_checker.h b/jbmc/src/java_bytecode/java_multi_path_symex_only_checker.h index 203abb82643..77c78458b96 100644 --- a/jbmc/src/java_bytecode/java_multi_path_symex_only_checker.h +++ b/jbmc/src/java_bytecode/java_multi_path_symex_only_checker.h @@ -4,7 +4,7 @@ Module: Goto Checker using Bounded Model Checking for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Goto Checker using Bounded Model Checking for Java diff --git a/jbmc/src/java_bytecode/java_object_factory.cpp b/jbmc/src/java_bytecode/java_object_factory.cpp index 30105d33668..87faebded0e 100644 --- a/jbmc/src/java_bytecode/java_object_factory.cpp +++ b/jbmc/src/java_bytecode/java_object_factory.cpp @@ -12,13 +12,14 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #include #include #include +#include #include #include -#include #include "generic_parameter_specialization_map_keys.h" #include "java_object_factory_parameters.h" @@ -1336,7 +1337,7 @@ static void array_loop_init_code( const source_locationt &location, const array_element_generatort &element_generator, const allocate_local_symbolt &allocate_local_symbol, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { const symbol_exprt &array_init_symexpr = allocate_local_symbol(init_array_expr.type(), "array_data_init"); @@ -1378,7 +1379,7 @@ code_blockt gen_nondet_array_init( const source_locationt &location, const array_element_generatort &element_generator, const allocate_local_symbolt &allocate_local_symbol, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const size_t max_nondet_array_length) { PRECONDITION(expr.type().id() == ID_pointer); @@ -1657,7 +1658,7 @@ exprt object_factory( const typet &type, const irep_idt base_name, code_blockt &init_code, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const java_object_factory_parameterst &object_factory_parameters, lifetimet lifetime, const source_locationt &location, diff --git a/jbmc/src/java_bytecode/java_object_factory.h b/jbmc/src/java_bytecode/java_object_factory.h index 7f2e0edcd2d..f55c5e31c09 100644 --- a/jbmc/src/java_bytecode/java_object_factory.h +++ b/jbmc/src/java_bytecode/java_object_factory.h @@ -79,7 +79,7 @@ Author: Daniel Kroening, kroening@kroening.com class message_handlert; class select_pointer_typet; -class symbol_tablet; +class symbol_table_baset; struct java_object_factory_parameterst; exprt object_factory( @@ -97,7 +97,7 @@ exprt object_factory( const typet &type, const irep_idt base_name, code_blockt &init_code, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const java_object_factory_parameterst &object_factory_parameters, lifetimet lifetime, const source_locationt &location, @@ -164,7 +164,7 @@ code_blockt gen_nondet_array_init( const source_locationt &location, const array_element_generatort &element_generator, const allocate_local_symbolt &allocate_local_symbol, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, size_t max_nondet_array_length); #endif // CPROVER_JAVA_BYTECODE_JAVA_OBJECT_FACTORY_H diff --git a/jbmc/src/java_bytecode/java_root_class.h b/jbmc/src/java_bytecode/java_root_class.h index 4ae8b566fb0..086c461347e 100644 --- a/jbmc/src/java_bytecode/java_root_class.h +++ b/jbmc/src/java_bytecode/java_root_class.h @@ -14,7 +14,6 @@ Author: Daniel Kroening, kroening@kroening.com class struct_exprt; class struct_typet; -class symbolt; // adds expected members for a root class, // which is usually java.lang.Object 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 85494235f93..d361ebb56cb 100644 --- a/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp +++ b/jbmc/src/java_bytecode/java_single_path_symex_checker.cpp @@ -4,13 +4,11 @@ Module: Goto Checker using Single Path Symbolic Execution for Java Author: Jeannie Moulton - \*******************************************************************/ +\*******************************************************************/ #include "java_single_path_symex_checker.h" #include "java_trace_validation.h" -#include - goto_tracet java_single_path_symex_checkert::build_full_trace() const { goto_tracet goto_trace = single_path_symex_checkert::build_full_trace(); 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 c92d1ee24db..de0862194d1 100644 --- a/jbmc/src/java_bytecode/java_single_path_symex_checker.h +++ b/jbmc/src/java_bytecode/java_single_path_symex_checker.h @@ -4,7 +4,7 @@ Module: Goto Checker using Single Path Symbolic Execution for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Goto Checker using Single Path Symbolic Execution for Java diff --git a/jbmc/src/java_bytecode/java_single_path_symex_only_checker.h b/jbmc/src/java_bytecode/java_single_path_symex_only_checker.h index 84d494c4ed7..ce16b79fe18 100644 --- a/jbmc/src/java_bytecode/java_single_path_symex_only_checker.h +++ b/jbmc/src/java_bytecode/java_single_path_symex_only_checker.h @@ -4,7 +4,7 @@ Module: Goto Checker using Single Path Symbolic Execution for Java Author: Daniel Kroening, Peter Schrammel - \*******************************************************************/ +\*******************************************************************/ /// \file /// Goto Checker using Single Path Symbolic Execution for Java diff --git a/jbmc/src/java_bytecode/java_static_initializers.cpp b/jbmc/src/java_bytecode/java_static_initializers.cpp index b424b33df89..6634523c15a 100644 --- a/jbmc/src/java_bytecode/java_static_initializers.cpp +++ b/jbmc/src/java_bytecode/java_static_initializers.cpp @@ -13,13 +13,13 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include #include #include -#include +#include #include #include #include "assignments_from_json.h" -#include "ci_lazy_methods_needed.h" +#include "ci_lazy_methods_needed.h" // IWYU pragma: keep #include "java_object_factory.h" #include "java_object_factory_parameters.h" #include "java_types.h" @@ -307,7 +307,8 @@ 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, const symbol_tablet &symbol_table) + const irep_idt &class_name, + const symbol_table_baset &symbol_table) { if(symbol_table.has_symbol(clinit_function_name(class_name))) return true; @@ -332,7 +333,7 @@ static void create_function_symbol( const irep_idt &function_name, const irep_idt &function_base_name, const synthetic_method_typet &synthetic_method_type, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) { symbolt function_symbol; @@ -359,7 +360,7 @@ static void create_function_symbol( // Create symbol for the "clinit_wrapper" static void create_clinit_wrapper_function_symbol( const irep_idt &class_name, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) { create_function_symbol( @@ -374,7 +375,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, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods) { create_function_symbol( @@ -398,7 +399,7 @@ static void create_user_specified_clinit_function_symbol( /// clinit_wrapper thread safe will be created. static void create_clinit_wrapper_symbols( const irep_idt &class_name, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, const bool thread_safe) { @@ -780,7 +781,7 @@ code_ifthenelset get_clinit_wrapper_body( /// \return map associating classes to the symbols they declare std::unordered_multimap -class_to_declared_symbols(const symbol_tablet &symbol_table) +class_to_declared_symbols(const symbol_table_baset &symbol_table) { std::unordered_multimap result; for(const auto &symbol_pair : symbol_table) @@ -876,7 +877,7 @@ code_blockt get_user_specified_clinit_body( /// synthetic user_specified_clinit function should be created. This is true /// if a file was given with the --static-values option and false otherwise. void create_static_initializer_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, const bool thread_safe, const bool is_user_clinit_needed) @@ -927,7 +928,7 @@ static itertype advance_to_next_key(itertype in, itertype end) /// static initialiser such that we get a callback to provide its body as and /// when it is required. void stub_global_initializer_factoryt::create_stub_global_initializer_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::unordered_set &stub_globals_set, synthetic_methods_mapt &synthetic_methods) { diff --git a/jbmc/src/java_bytecode/java_static_initializers.h b/jbmc/src/java_bytecode/java_static_initializers.h index 7ef9aa072d4..1f0dba5c955 100644 --- a/jbmc/src/java_bytecode/java_static_initializers.h +++ b/jbmc/src/java_bytecode/java_static_initializers.h @@ -14,17 +14,15 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include #include -#include - -#include "code_with_references.h" class ci_lazy_methods_neededt; class json_objectt; class message_handlert; class select_pointer_typet; class symbol_table_baset; -class symbol_tablet; +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); @@ -34,7 +32,7 @@ bool is_clinit_function(const irep_idt &function_id); bool is_user_specified_clinit_function(const irep_idt &function_id); void create_static_initializer_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, const bool thread_safe, const bool is_user_clinit_needed); @@ -59,7 +57,7 @@ code_ifthenelset get_clinit_wrapper_body( /// \return map associating classes to the symbols they declare std::unordered_multimap -class_to_declared_symbols(const symbol_tablet &symbol_table); +class_to_declared_symbols(const symbol_table_baset &symbol_table); /// Create the body of a user_specified_clinit function for a given class, which /// includes assignments for all static fields of the class to values read from @@ -102,7 +100,7 @@ class stub_global_initializer_factoryt public: void create_stub_global_initializer_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::unordered_set &stub_globals_set, synthetic_methods_mapt &synthetic_methods); @@ -115,7 +113,7 @@ class stub_global_initializer_factoryt }; void create_stub_global_initializers( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::unordered_set &stub_globals_set, 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 a8ab53b4ea6..e5ea1b6a645 100644 --- a/jbmc/src/java_bytecode/java_string_library_preprocess.cpp +++ b/jbmc/src/java_bytecode/java_string_library_preprocess.cpp @@ -16,23 +16,25 @@ Date: April 2017 /// java standard library. In particular methods from java.lang.String, /// java.lang.StringBuilder, java.lang.StringBuffer. -#include -#include +#include "java_string_library_preprocess.h" #include #include #include #include #include +#include #include #include #include +#include + +#include +#include #include "java_types.h" #include "java_utils.h" -#include "java_string_library_preprocess.h" - /// \return tag of a struct prefixed by "java::" or symbolic tag /// empty string if not symbol or struct static irep_idt get_tag(const typet &type) @@ -215,7 +217,8 @@ 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, symbol_tablet &symbol_table) + const irep_idt &class_name, + symbol_table_baset &symbol_table) { irep_idt class_symbol_name = "java::" + id2string(class_name); symbolt tmp_string_symbol; @@ -364,7 +367,7 @@ exprt::operandst java_string_library_preprocesst::process_operands( /// \param symbol_table: symbol table /// \return type of the "data" component static const typet & -get_data_type(const typet &type, const symbol_tablet &symbol_table) +get_data_type(const typet &type, const symbol_table_baset &symbol_table) { PRECONDITION(type.id() == ID_struct || type.id() == ID_struct_tag); if(type.id() == ID_struct_tag) @@ -384,7 +387,7 @@ get_data_type(const typet &type, const symbol_tablet &symbol_table) /// \param symbol_table: symbol table /// \return type of the "length" component static const typet & -get_length_type(const typet &type, const symbol_tablet &symbol_table) +get_length_type(const typet &type, const symbol_table_baset &symbol_table) { PRECONDITION(type.id() == ID_struct || type.id() == ID_struct_tag); if(type.id() == ID_struct_tag) @@ -403,7 +406,8 @@ get_length_type(const typet &type, const symbol_tablet &symbol_table) /// \param expr: an expression of structured type with length component /// \param symbol_table: symbol table /// \return expression representing the "length" member -static exprt get_length(const exprt &expr, const symbol_tablet &symbol_table) +static exprt +get_length(const exprt &expr, const symbol_table_baset &symbol_table) { return member_exprt( expr, "length", get_length_type(expr.type(), symbol_table)); @@ -413,7 +417,7 @@ static exprt get_length(const exprt &expr, const symbol_tablet &symbol_table) /// \param expr: an expression of structured type with data component /// \param symbol_table: symbol table /// \return expression representing the "data" member -static exprt get_data(const exprt &expr, const symbol_tablet &symbol_table) +static exprt get_data(const exprt &expr, const symbol_table_baset &symbol_table) { return member_exprt(expr, "data", get_data_type(expr.type(), symbol_table)); } diff --git a/jbmc/src/java_bytecode/java_string_library_preprocess.h b/jbmc/src/java_bytecode/java_string_library_preprocess.h index ec121581fed..7fc1f014ff9 100644 --- a/jbmc/src/java_bytecode/java_string_library_preprocess.h +++ b/jbmc/src/java_bytecode/java_string_library_preprocess.h @@ -14,21 +14,22 @@ Date: March 2017 #ifndef CPROVER_JAVA_BYTECODE_JAVA_STRING_LIBRARY_PREPROCESS_H #define CPROVER_JAVA_BYTECODE_JAVA_STRING_LIBRARY_PREPROCESS_H -#include -#include #include +#include #include -#include // should get rid of this -#include +#include -#include -#include -#include #include "character_refine_preprocess.h" #include "java_types.h" +#include +#include +#include + class message_handlert; +class symbol_table_baset; +class symbolt; // Arbitrary limit of 10 arguments for the number of arguments to String.format #define MAX_FORMAT_ARGS 10 @@ -60,7 +61,8 @@ class java_string_library_preprocesst } std::vector get_string_type_base_classes( const irep_idt &class_name); - void add_string_type(const irep_idt &class_name, symbol_tablet &symbol_table); + void + add_string_type(const 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) @@ -198,7 +200,7 @@ class java_string_library_preprocesst const exprt &deref, const source_locationt &loc, const irep_idt &function_id, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &init_code); refined_string_exprt convert_exprt_to_string_exprt( diff --git a/jbmc/src/java_bytecode/java_string_literals.cpp b/jbmc/src/java_bytecode/java_string_literals.cpp index 4394e935b43..f153e692e20 100644 --- a/jbmc/src/java_bytecode/java_string_literals.cpp +++ b/jbmc/src/java_bytecode/java_string_literals.cpp @@ -20,8 +20,6 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include #include -#include - /// Convert UCS-2 or UTF-16 to an array expression. /// \param in: wide string to convert /// \return Returns a Java char array containing the same wchars. diff --git a/jbmc/src/java_bytecode/java_utils.cpp b/jbmc/src/java_bytecode/java_utils.cpp index f4d15127ec5..be1c4d09ba2 100644 --- a/jbmc/src/java_bytecode/java_utils.cpp +++ b/jbmc/src/java_bytecode/java_utils.cpp @@ -6,10 +6,7 @@ Author: Daniel Kroening, kroening@kroening.com \*******************************************************************/ -#include "java_utils.h" - #include "java_root_class.h" -#include "java_string_library_preprocess.h" #include #include @@ -19,6 +16,10 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include + +#include "java_string_library_preprocess.h" +#include "java_utils.h" #include #include @@ -451,7 +452,7 @@ optionalt get_inherited_component( const irep_idt &component_class_id, const irep_idt &component_name, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, bool include_interfaces) { resolve_inherited_componentt component_resolver{symbol_table}; diff --git a/jbmc/src/java_bytecode/java_utils.h b/jbmc/src/java_bytecode/java_utils.h index 372dfdb14a7..148406dd204 100644 --- a/jbmc/src/java_bytecode/java_utils.h +++ b/jbmc/src/java_bytecode/java_utils.h @@ -158,7 +158,7 @@ optionalt get_inherited_component( const irep_idt &component_class_id, const irep_idt &component_name, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, bool include_interfaces); bool is_non_null_library_global(const irep_idt &); diff --git a/jbmc/src/java_bytecode/lambda_synthesis.cpp b/jbmc/src/java_bytecode/lambda_synthesis.cpp index 9d900444019..fbc45700e25 100644 --- a/jbmc/src/java_bytecode/lambda_synthesis.cpp +++ b/jbmc/src/java_bytecode/lambda_synthesis.cpp @@ -11,7 +11,10 @@ Author: Diffblue Ltd. #include "lambda_synthesis.h" -#include "jar_file.h" +#include +#include +#include + #include "java_bytecode_convert_method.h" #include "java_bytecode_parse_tree.h" #include "java_static_initializers.h" @@ -19,10 +22,6 @@ Author: Diffblue Ltd. #include "java_utils.h" #include "synthetic_methods_map.h" -#include -#include -#include - #include static std::string escape_symbol_special_chars(std::string input) @@ -76,7 +75,7 @@ get_lambda_method_handle( static optionalt lambda_method_handle( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const irep_idt &method_identifier, const java_method_typet &dynamic_method_type) { @@ -203,7 +202,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_tablet &symbol_table, + const symbol_table_baset &symbol_table, const struct_tag_typet &functional_interface_tag, const irep_idt &method_identifier, const int instruction_address, @@ -403,7 +402,7 @@ static symbolt implemented_method_symbol( void create_invokedynamic_synthetic_classes( const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt::instructionst &instructions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, message_handlert &message_handler) { @@ -629,7 +628,7 @@ get_unboxing_method(const pointer_typet &maybe_boxed_type) /// (i.e., if it is non-static and its 'this' parameter is a non-final type) exprt make_function_expr( const symbolt &function_symbol, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { const auto &method_type = to_java_method_type(function_symbol.type); if(!method_type.has_this()) diff --git a/jbmc/src/java_bytecode/lambda_synthesis.h b/jbmc/src/java_bytecode/lambda_synthesis.h index af7da646fb5..df8d9d61c35 100644 --- a/jbmc/src/java_bytecode/lambda_synthesis.h +++ b/jbmc/src/java_bytecode/lambda_synthesis.h @@ -19,7 +19,6 @@ Author: Diffblue Ltd. class message_handlert; class codet; class symbol_table_baset; -class symbol_tablet; irep_idt lambda_synthetic_class_name( const irep_idt &method_identifier, @@ -28,7 +27,7 @@ irep_idt lambda_synthetic_class_name( void create_invokedynamic_synthetic_classes( const irep_idt &method_identifier, const java_bytecode_parse_treet::methodt::instructionst &instructions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, synthetic_methods_mapt &synthetic_methods, message_handlert &message_handler); diff --git a/jbmc/src/java_bytecode/lazy_goto_model.cpp b/jbmc/src/java_bytecode/lazy_goto_model.cpp index dd379d9cbbd..0cf1f26b9d2 100644 --- a/jbmc/src/java_bytecode/lazy_goto_model.cpp +++ b/jbmc/src/java_bytecode/lazy_goto_model.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -23,8 +22,6 @@ #include -#include - //! @cond Doxygen_suppress_Lambda_in_initializer_list lazy_goto_modelt::lazy_goto_modelt( post_process_functiont post_process_function, diff --git a/jbmc/src/java_bytecode/lazy_goto_model.h b/jbmc/src/java_bytecode/lazy_goto_model.h index dc36f9c8fb1..55cc4c0c584 100644 --- a/jbmc/src/java_bytecode/lazy_goto_model.h +++ b/jbmc/src/java_bytecode/lazy_goto_model.h @@ -9,7 +9,6 @@ #include #include -#include #include #include "lazy_goto_functions_map.h" diff --git a/jbmc/src/java_bytecode/lift_clinit_calls.h b/jbmc/src/java_bytecode/lift_clinit_calls.h index 9c5714148f0..05cf3f4d2d3 100644 --- a/jbmc/src/java_bytecode/lift_clinit_calls.h +++ b/jbmc/src/java_bytecode/lift_clinit_calls.h @@ -11,7 +11,7 @@ Author: Diffblue Ltd. #ifndef CPROVER_JAVA_BYTECODE_LIFT_CLINIT_CALLS_H #define CPROVER_JAVA_BYTECODE_LIFT_CLINIT_CALLS_H -#include +#include codet lift_clinit_calls(codet input); diff --git a/jbmc/src/java_bytecode/load_method_by_regex.cpp b/jbmc/src/java_bytecode/load_method_by_regex.cpp index 65e02e9459b..1ef1662eeb8 100644 --- a/jbmc/src/java_bytecode/load_method_by_regex.cpp +++ b/jbmc/src/java_bytecode/load_method_by_regex.cpp @@ -9,10 +9,10 @@ Author: Diffblue Ltd. #include "load_method_by_regex.h" -#include - #include -#include +#include + +#include /// For a given user provided pattern, return a regex, having dealt with the /// cases where the user has not prefixed with java:: or suffixed with the @@ -54,12 +54,12 @@ bool does_pattern_miss_descriptor(const std::string &pattern) /// If the pattern doesn't include the java:: prefix, prefix that /// \param pattern: The user provided pattern /// \return The lambda to execute. -std::function(const symbol_tablet &symbol_table)> +std::function(const symbol_table_baset &symbol_table)> build_load_method_by_regex(const std::string &pattern) { std::regex regex = build_regex_from_pattern(pattern); - return [=](const symbol_tablet &symbol_table) { + return [=](const symbol_table_baset &symbol_table) { std::vector matched_methods; for(const auto &symbol : symbol_table.symbols) { diff --git a/jbmc/src/java_bytecode/load_method_by_regex.h b/jbmc/src/java_bytecode/load_method_by_regex.h index 68b611c33b6..80fbd42a329 100644 --- a/jbmc/src/java_bytecode/load_method_by_regex.h +++ b/jbmc/src/java_bytecode/load_method_by_regex.h @@ -18,9 +18,9 @@ Author: Diffblue Ltd. #include #include -class symbol_tablet; +class symbol_table_baset; -std::function(const symbol_tablet &symbol_table)> +std::function(const symbol_table_baset &symbol_table)> build_load_method_by_regex(const std::string &pattern); bool does_pattern_miss_descriptor(const std::string &pattern); diff --git a/jbmc/src/java_bytecode/mz_zip_archive.cpp b/jbmc/src/java_bytecode/mz_zip_archive.cpp index 52334e478e0..dfa70f9659b 100644 --- a/jbmc/src/java_bytecode/mz_zip_archive.cpp +++ b/jbmc/src/java_bytecode/mz_zip_archive.cpp @@ -9,7 +9,6 @@ Author: Diffblue Ltd #include "mz_zip_archive.h" #include #include -#include #define _LARGEFILE64_SOURCE 1 #include diff --git a/jbmc/src/java_bytecode/remove_exceptions.cpp b/jbmc/src/java_bytecode/remove_exceptions.cpp index 357a352da4e..a83328fba8b 100644 --- a/jbmc/src/java_bytecode/remove_exceptions.cpp +++ b/jbmc/src/java_bytecode/remove_exceptions.cpp @@ -18,12 +18,9 @@ Date: December 2016 #include #endif -#include - #include #include #include -#include #include #include diff --git a/jbmc/src/java_bytecode/remove_instanceof.h b/jbmc/src/java_bytecode/remove_instanceof.h index 99b5418e056..245d67db4fb 100644 --- a/jbmc/src/java_bytecode/remove_instanceof.h +++ b/jbmc/src/java_bytecode/remove_instanceof.h @@ -84,6 +84,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com class class_hierarchyt; class goto_modelt; class message_handlert; +class symbol_table_baset; void remove_instanceof( const irep_idt &function_identifier, diff --git a/jbmc/src/java_bytecode/remove_java_new.cpp b/jbmc/src/java_bytecode/remove_java_new.cpp index 5da09322801..09bb31e5c47 100644 --- a/jbmc/src/java_bytecode/remove_java_new.cpp +++ b/jbmc/src/java_bytecode/remove_java_new.cpp @@ -11,6 +11,13 @@ Author: Peter Schrammel #include "remove_java_new.h" +#include +#include +#include +#include +#include +#include + #include #include #include @@ -18,12 +25,6 @@ Author: Peter Schrammel #include "java_types.h" #include "java_utils.h" -#include -#include -#include -#include -#include - class remove_java_newt { public: diff --git a/jbmc/src/java_bytecode/remove_java_new.h b/jbmc/src/java_bytecode/remove_java_new.h index 4506b0408cb..4ed497a92c0 100644 --- a/jbmc/src/java_bytecode/remove_java_new.h +++ b/jbmc/src/java_bytecode/remove_java_new.h @@ -16,6 +16,7 @@ Author: Peter Schrammel class goto_modelt; class message_handlert; +class symbol_table_baset; void remove_java_new( const irep_idt &function_identifier, diff --git a/jbmc/src/miniz/miniz.h b/jbmc/src/miniz/miniz.h index 77a96d1550e..a6eca43a7b9 100644 --- a/jbmc/src/miniz/miniz.h +++ b/jbmc/src/miniz/miniz.h @@ -1,3 +1,4 @@ +// NOLINT(legal/copyright) /* miniz.c v1.16 beta r1 - public domain deflate/inflate, zlib-subset, ZIP reading/writing/appending, PNG writing See "unlicense" statement at the end of this file. Rich Geldreich , last updated Oct. 13, 2013 @@ -176,7 +177,7 @@ #ifdef _MSC_VER #include #pragma warning(disable:4668) - // using #if/#elif on undefined macro +// using #if/#elif on undefined macro #endif @@ -528,7 +529,6 @@ typedef void *const voidpc; #include #include #include -#include /* ------------------- Types and macros */ typedef uint8_t mz_uint8; diff --git a/jbmc/unit/java-testing-utils/require_goto_statements.cpp b/jbmc/unit/java-testing-utils/require_goto_statements.cpp index a9e5512d774..fbae94a8d81 100644 --- a/jbmc/unit/java-testing-utils/require_goto_statements.cpp +++ b/jbmc/unit/java-testing-utils/require_goto_statements.cpp @@ -8,18 +8,18 @@ Author: Diffblue Ltd. #include "require_goto_statements.h" -#include - -#include - -#include - #include #include +#include #include #include #include -#include +#include + +#include + +#include +#include /// Expand value of a function to include all child codets /// \param function_value: The value of the function (e.g. got by looking up @@ -46,7 +46,7 @@ require_goto_statements::get_all_statements(const exprt &function_value) /// \return All codet statements of the __CPROVER_start function const std::vector require_goto_statements::require_entry_point_statements( - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { // Retrieve __CPROVER_start const symbolt *entry_point_function = @@ -73,7 +73,7 @@ require_goto_statements::find_struct_component_assignments( const irep_idt &structure_name, const optionalt &superclass_name, const irep_idt &component_name, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { pointer_assignment_locationt locations{}; @@ -388,7 +388,7 @@ const irep_idt &require_goto_statements::require_struct_component_assignment( const irep_idt &component_type_name, const optionalt &typecast_name, const std::vector &entry_point_instructions, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { namespacet ns(symbol_table); @@ -449,7 +449,7 @@ require_goto_statements::require_struct_array_component_assignment( const irep_idt &array_component_name, const irep_idt &array_type_name, const std::vector &entry_point_instructions, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { // First we need to find the assignments to the component belonging to // the structure_name object diff --git a/jbmc/unit/java-testing-utils/require_goto_statements.h b/jbmc/unit/java-testing-utils/require_goto_statements.h index 14e6796576b..33f3dd744a7 100644 --- a/jbmc/unit/java-testing-utils/require_goto_statements.h +++ b/jbmc/unit/java-testing-utils/require_goto_statements.h @@ -11,11 +11,9 @@ Author: Diffblue Ltd. #include -#include - #include -class symbol_tablet; +class symbol_table_baset; #ifndef CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H #define CPROVER_JAVA_TESTING_UTILS_REQUIRE_GOTO_STATEMENTS_H @@ -51,7 +49,7 @@ pointer_assignment_locationt find_struct_component_assignments( const irep_idt &structure_name, const optionalt &superclass_name, const irep_idt &component_name, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); pointer_assignment_locationt find_this_component_assignment( const std::vector &statements, @@ -60,7 +58,7 @@ pointer_assignment_locationt find_this_component_assignment( std::vector get_all_statements(const exprt &function_value); const std::vector -require_entry_point_statements(const symbol_tablet &symbol_table); +require_entry_point_statements(const symbol_table_baset &symbol_table); pointer_assignment_locationt find_pointer_assignments( const irep_idt &pointer_name, @@ -81,7 +79,7 @@ const irep_idt &require_struct_component_assignment( const irep_idt &component_type_name, const optionalt &typecast_name, const std::vector &entry_point_instructions, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); const irep_idt &require_struct_array_component_assignment( const irep_idt &structure_name, @@ -89,7 +87,7 @@ const irep_idt &require_struct_array_component_assignment( const irep_idt &array_component_name, const irep_idt &array_type_name, const std::vector &entry_point_instructions, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); const irep_idt &require_entry_point_argument_assignment( const irep_idt &argument_name, diff --git a/jbmc/unit/java-testing-utils/require_type.h b/jbmc/unit/java-testing-utils/require_type.h index d24b1274e42..d9e5135bc13 100644 --- a/jbmc/unit/java-testing-utils/require_type.h +++ b/jbmc/unit/java-testing-utils/require_type.h @@ -15,7 +15,6 @@ Author: Diffblue Ltd. #ifndef CPROVER_JAVA_TESTING_UTILS_REQUIRE_TYPE_H #define CPROVER_JAVA_TESTING_UTILS_REQUIRE_TYPE_H -#include #include #include diff --git a/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_initalizers.cpp b/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_initalizers.cpp index 88a18fd0ba1..d001fcc97e2 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_initalizers.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_convert_method/convert_initalizers.cpp @@ -8,12 +8,8 @@ Author: Diffblue Limited. #include -#include - #include -#include - #include #include 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 4ce1b8e7a37..cd97726bb07 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 @@ -6,21 +6,21 @@ Author: Diffblue Limited. \*******************************************************************/ -#include -#include +#include +#include +#include #include -#include - -#include -#include #include +#include #include -#include +#include #include +#include #include +#include SCENARIO( "java_bytecode_convert_bridge_method", diff --git a/jbmc/unit/java_bytecode/java_bytecode_language/context_excluded.cpp b/jbmc/unit/java_bytecode/java_bytecode_language/context_excluded.cpp index 0756006a2ce..f8a2cd8d6ef 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_language/context_excluded.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_language/context_excluded.cpp @@ -8,8 +8,6 @@ Author: Diffblue Limited. #include -#include - #include #include diff --git a/jbmc/unit/java_bytecode/java_bytecode_language/language.cpp b/jbmc/unit/java_bytecode/java_bytecode_language/language.cpp index bb6d2c6894d..229405787ba 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_language/language.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_language/language.cpp @@ -8,8 +8,6 @@ Author: Diffblue Limited. #include -#include - #include #include #include diff --git a/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_convert_class_lambda_method_handles.cpp b/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_convert_class_lambda_method_handles.cpp index 0c63e4c4010..8f55fc02b28 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_convert_class_lambda_method_handles.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_convert_class_lambda_method_handles.cpp @@ -6,8 +6,6 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include #include diff --git a/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_parse_lambda_method_table.cpp b/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_parse_lambda_method_table.cpp index 090ec08998e..41e422dea17 100644 --- a/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_parse_lambda_method_table.cpp +++ b/jbmc/unit/java_bytecode/java_bytecode_parse_lambdas/java_bytecode_parse_lambda_method_table.cpp @@ -6,8 +6,6 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include diff --git a/jbmc/unit/java_bytecode/java_object_factory/gen_nondet_string_init.cpp b/jbmc/unit/java_bytecode/java_object_factory/gen_nondet_string_init.cpp index 5f269cf6976..8acdeca6b3a 100644 --- a/jbmc/unit/java_bytecode/java_object_factory/gen_nondet_string_init.cpp +++ b/jbmc/unit/java_bytecode/java_object_factory/gen_nondet_string_init.cpp @@ -7,16 +7,18 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include +#include + +#include +#include +#include + #include #include -#include #include #include #include #include -#include -#include #include diff --git a/jbmc/unit/java_bytecode/java_static_initializers/java_static_initializers.cpp b/jbmc/unit/java_bytecode/java_static_initializers/java_static_initializers.cpp index c5a28ae1db1..4f58f4c5c5b 100644 --- a/jbmc/unit/java_bytecode/java_static_initializers/java_static_initializers.cpp +++ b/jbmc/unit/java_bytecode/java_static_initializers/java_static_initializers.cpp @@ -6,21 +6,20 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include +#include +#include +#include + +#include #include +#include // IWYU pragma: keep +#include #include #include - #include #include -#include - -#include -#include -#include - SCENARIO("is_clinit_function", "[core][java_static_initializers]") { GIVEN("A function id that represents a clinit") 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 039e15b1600..389564dd7a1 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 @@ -7,14 +7,16 @@ Author: Diffblue Ltd. \*******************************************************************/ +#include +#include +#include +#include + #include #include #include #include #include -#include -#include -#include #include @@ -23,7 +25,7 @@ refined_string_exprt convert_exprt_to_string_exprt_unit_test( const exprt &deref, const source_locationt &loc, const irep_idt &function_id, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &init_code) { return preprocess.convert_exprt_to_string_exprt( diff --git a/jbmc/unit/java_bytecode/java_trace_validation/java_trace_validation.cpp b/jbmc/unit/java_bytecode/java_trace_validation/java_trace_validation.cpp index b368d4dfac4..5e550105d77 100644 --- a/jbmc/unit/java_bytecode/java_trace_validation/java_trace_validation.cpp +++ b/jbmc/unit/java_bytecode/java_trace_validation/java_trace_validation.cpp @@ -7,6 +7,7 @@ Author: Diffblue Ltd. \*******************************************************************/ #include +#include #include #include diff --git a/jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp b/jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp index 269534c3e36..34bcecc285f 100644 --- a/jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp +++ b/jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp @@ -6,26 +6,24 @@ Author: Jesse Sigal, jesse.sigal@diffblue.com \*******************************************************************/ -#include -#include +#include +#include +#include +#include +#include +#include #include #include - #include - #include #include #include #include #include #include - -#include -#include -#include -#include -#include +#include +#include #include diff --git a/jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp b/jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp index f8ed35bb897..40b9ffef565 100644 --- a/jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp +++ b/jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp @@ -19,8 +19,6 @@ Author: Diffblue Ltd. #ifdef DEBUG #include #include -#include -#include #endif typet length_type() @@ -97,8 +95,6 @@ SCENARIO("dependency_graph", "[core][solvers][refinement][string_refinement]") #ifdef DEBUG // useful output for visualizing the graph { register_language(new_java_bytecode_language); - symbol_tablet symbol_table; - namespacet ns(symbol_table); dependencies.output_dot(std::cerr); } #endif diff --git a/src/analyses/ai.cpp b/src/analyses/ai.cpp index bb62a16a659..3fd897c0d14 100644 --- a/src/analyses/ai.cpp +++ b/src/analyses/ai.cpp @@ -16,7 +16,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include void ai_baset::output( const namespacet &ns, diff --git a/src/analyses/constant_propagator.cpp b/src/analyses/constant_propagator.cpp index a75935cc4b5..27e5f3f4841 100644 --- a/src/analyses/constant_propagator.cpp +++ b/src/analyses/constant_propagator.cpp @@ -29,7 +29,6 @@ Author: Peter Schrammel #include -#include #include /// Assign value `rhs` to `lhs`, recording any newly-known constants in diff --git a/src/analyses/does_remove_const.cpp b/src/analyses/does_remove_const.cpp index 69c988d7149..8e88299fe3f 100644 --- a/src/analyses/does_remove_const.cpp +++ b/src/analyses/does_remove_const.cpp @@ -14,7 +14,6 @@ Author: Diffblue Ltd. #include #include -#include /// A naive analysis to look for casts that remove const-ness from pointers. /// \param goto_program: the goto program to check diff --git a/src/analyses/goto_rw.cpp b/src/analyses/goto_rw.cpp index a231c2ff8ee..ed2f427930f 100644 --- a/src/analyses/goto_rw.cpp +++ b/src/analyses/goto_rw.cpp @@ -10,25 +10,24 @@ Date: April 2010 #include "goto_rw.h" -#include - #include #include #include #include #include #include +#include #include #include #include -#include - -#include #include +#include #include +#include + range_domain_baset::~range_domain_baset() { } diff --git a/src/analyses/guard_bdd.cpp b/src/analyses/guard_bdd.cpp index ca01c51616d..1e69cb65a1a 100644 --- a/src/analyses/guard_bdd.cpp +++ b/src/analyses/guard_bdd.cpp @@ -11,8 +11,6 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #include "guard_bdd.h" -#include - #include #include #include diff --git a/src/analyses/guard_bdd.h b/src/analyses/guard_bdd.h index dd1cb56b888..2829bc0e7d2 100644 --- a/src/analyses/guard_bdd.h +++ b/src/analyses/guard_bdd.h @@ -13,7 +13,7 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #ifndef CPROVER_ANALYSES_GUARD_BDD_H #define CPROVER_ANALYSES_GUARD_BDD_H -#include +#include // IWYU pragma: keep class bdd_exprt; class exprt; diff --git a/src/analyses/guard_expr.cpp b/src/analyses/guard_expr.cpp index b290e214fff..2f8a66b4f2f 100644 --- a/src/analyses/guard_expr.cpp +++ b/src/analyses/guard_expr.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include #include exprt guard_exprt::guard_expr(exprt expr) const diff --git a/src/analyses/invariant_set.cpp b/src/analyses/invariant_set.cpp index fb09ee75604..44a45f5a1bc 100644 --- a/src/analyses/invariant_set.cpp +++ b/src/analyses/invariant_set.cpp @@ -11,18 +11,18 @@ Author: Daniel Kroening, kroening@kroening.com #include "invariant_set.h" -#include - #include #include #include #include #include #include -#include +#include #include +#include + void inv_object_storet::output(std::ostream &out) const { for(std::size_t i=0; i - +#include #include #include -#include +#include + +#include void local_bitvector_analysist::flagst::print(std::ostream &out) const { diff --git a/src/analyses/local_safe_pointers.cpp b/src/analyses/local_safe_pointers.cpp index 3eaf1265cef..a7fe27f985f 100644 --- a/src/analyses/local_safe_pointers.cpp +++ b/src/analyses/local_safe_pointers.cpp @@ -14,7 +14,6 @@ Author: Diffblue Ltd #include #include #include -#include /// Return structure for `get_null_checked_expr` and /// `get_conditional_checked_expr` diff --git a/src/analyses/reaching_definitions.cpp b/src/analyses/reaching_definitions.cpp index 2dea301e912..eae78353388 100644 --- a/src/analyses/reaching_definitions.cpp +++ b/src/analyses/reaching_definitions.cpp @@ -15,16 +15,16 @@ Date: February 2013 #include "reaching_definitions.h" -#include - -#include +#include // IWYU pragma: keep #include #include #include -#include "is_threaded.h" #include "dirty.h" +#include "is_threaded.h" + +#include /// This ensures that all domains are constructed with the appropriate pointer /// back to the analysis engine itself. Using a factory is a tad verbose diff --git a/src/analyses/sese_regions.h b/src/analyses/sese_regions.h index f725c5f406c..563bd0add05 100644 --- a/src/analyses/sese_regions.h +++ b/src/analyses/sese_regions.h @@ -12,8 +12,6 @@ Author: Diffblue Ltd. #ifndef CPROVER_ANALYSES_SESE_REGIONS_H #define CPROVER_ANALYSES_SESE_REGIONS_H -#include -#include #include class sese_region_analysist diff --git a/src/analyses/static_analysis.cpp b/src/analyses/static_analysis.cpp index 3809c6eab70..727cf0ca28a 100644 --- a/src/analyses/static_analysis.cpp +++ b/src/analyses/static_analysis.cpp @@ -16,7 +16,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include #include "is_threaded.h" diff --git a/src/analyses/uncaught_exceptions_analysis.cpp b/src/analyses/uncaught_exceptions_analysis.cpp index c8eb3185241..f328438a03b 100644 --- a/src/analyses/uncaught_exceptions_analysis.cpp +++ b/src/analyses/uncaught_exceptions_analysis.cpp @@ -16,7 +16,6 @@ Author: Cristina David #include #include -#include #include diff --git a/src/analyses/variable-sensitivity/abstract_aggregate_object.h b/src/analyses/variable-sensitivity/abstract_aggregate_object.h index 36817ee3dc4..725af53d692 100644 --- a/src/analyses/variable-sensitivity/abstract_aggregate_object.h +++ b/src/analyses/variable-sensitivity/abstract_aggregate_object.h @@ -12,12 +12,15 @@ #ifndef CBMC_ABSTRACT_AGGREGATE_OBJECT_H #define CBMC_ABSTRACT_AGGREGATE_OBJECT_H +#include + #include #include -#include #include "abstract_object_statistics.h" +#include + class abstract_aggregate_tag { }; diff --git a/src/analyses/variable-sensitivity/abstract_environment.cpp b/src/analyses/variable-sensitivity/abstract_environment.cpp index 4a89216ea2f..0ab6849cab7 100644 --- a/src/analyses/variable-sensitivity/abstract_environment.cpp +++ b/src/analyses/variable-sensitivity/abstract_environment.cpp @@ -6,16 +6,15 @@ \*******************************************************************/ -#include -#include -#include - #include +#include #include -#include #include #include +#include +#include + #include #include #include @@ -25,6 +24,10 @@ # include #endif +#include "abstract_object_statistics.h" +#include "context_abstract_object.h" +#include "interval_abstract_value.h" + typedef exprt ( *assume_function)(abstract_environmentt &, const exprt &, const namespacet &); diff --git a/src/analyses/variable-sensitivity/abstract_environment.h b/src/analyses/variable-sensitivity/abstract_environment.h index ec3bdd0add9..f1785e917df 100644 --- a/src/analyses/variable-sensitivity/abstract_environment.h +++ b/src/analyses/variable-sensitivity/abstract_environment.h @@ -17,9 +17,7 @@ #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_ABSTRACT_ENVIROMENT_H -#include - -#include +#include "abstract_object.h" exprt simplify_vsd_expr(exprt src, const namespacet &ns); bool is_ptr_diff(const exprt &expr); diff --git a/src/analyses/variable-sensitivity/abstract_value_object.cpp b/src/analyses/variable-sensitivity/abstract_value_object.cpp index b55244d288e..b21130cdebf 100644 --- a/src/analyses/variable-sensitivity/abstract_value_object.cpp +++ b/src/analyses/variable-sensitivity/abstract_value_object.cpp @@ -6,20 +6,21 @@ \*******************************************************************/ +#include +#include +#include +#include +#include + +#include + #include #include #include -#include #include #include -#include - -#include -#include -#include -#include -#include +#include "context_abstract_object.h" // IWYU pragma: keep #include diff --git a/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp b/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp index 290c71b6574..b38485b74d7 100644 --- a/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp +++ b/src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp @@ -8,16 +8,18 @@ #include "constant_pointer_abstract_object.h" -#include #include #include +#include #include #include -#include +#include #include "abstract_object_statistics.h" +#include + constant_pointer_abstract_objectt::constant_pointer_abstract_objectt( const typet &type) : abstract_pointer_objectt(type) diff --git a/src/analyses/variable-sensitivity/value_set_abstract_object.cpp b/src/analyses/variable-sensitivity/value_set_abstract_object.cpp index dff9753b837..f3b50bbaa23 100644 --- a/src/analyses/variable-sensitivity/value_set_abstract_object.cpp +++ b/src/analyses/variable-sensitivity/value_set_abstract_object.cpp @@ -9,16 +9,17 @@ /// \file /// Value Set Abstract Object +#include +#include +#include + #include #include -#include #include #include #include -#include -#include -#include +#include "context_abstract_object.h" // IWYU pragma: keep #include diff --git a/src/analyses/variable-sensitivity/value_set_pointer_abstract_object.cpp b/src/analyses/variable-sensitivity/value_set_pointer_abstract_object.cpp index d280fd145c0..b19f120c992 100644 --- a/src/analyses/variable-sensitivity/value_set_pointer_abstract_object.cpp +++ b/src/analyses/variable-sensitivity/value_set_pointer_abstract_object.cpp @@ -9,14 +9,16 @@ /// \file /// Value Set of Pointer Abstract Object -#include -#include -#include -#include #include #include +#include +#include + #include "abstract_environment.h" +#include "context_abstract_object.h" // IWYU pragma: keep + +#include static abstract_object_sett unwrap_and_extract_values(const abstract_object_sett &values); diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_configuration.cpp b/src/analyses/variable-sensitivity/variable_sensitivity_configuration.cpp index 888dc038780..d4554e85882 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_configuration.cpp +++ b/src/analyses/variable-sensitivity/variable_sensitivity_configuration.cpp @@ -10,9 +10,11 @@ /// domain abstractions are used, flow sensitivity, etc #include "variable_sensitivity_configuration.h" -#include +#include #include +#include + static void check_one_of_options( const optionst &options, const std::vector &names); diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_configuration.h b/src/analyses/variable-sensitivity/variable_sensitivity_configuration.h index d3b21795207..9da7e5aeaa7 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_configuration.h +++ b/src/analyses/variable-sensitivity/variable_sensitivity_configuration.h @@ -12,8 +12,7 @@ #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_VARIABLE_SENSITIVITY_CONFIGURATION_H #include - -#include +#include class optionst; diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp b/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp index f2d3ac4a74d..34d78c1d8b9 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp +++ b/src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp @@ -11,8 +11,9 @@ Date: April 2016 #include "variable_sensitivity_domain.h" #include +#include #include -#include +#include #include diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp b/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp index 6e8e1bd084e..c9d5681a21b 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp +++ b/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp @@ -5,9 +5,23 @@ Author: Owen Jones, owen.jones@diffblue.com \*******************************************************************/ + #include "variable_sensitivity_object_factory.h" + +#include + +#include "constant_abstract_value.h" +#include "constant_pointer_abstract_object.h" +#include "data_dependency_context.h" #include "full_array_abstract_object.h" +#include "full_struct_abstract_object.h" +#include "interval_abstract_value.h" #include "liveness_context.h" +#include "two_value_array_abstract_object.h" +#include "two_value_pointer_abstract_object.h" +#include "two_value_struct_abstract_object.h" +#include "two_value_union_abstract_object.h" +#include "value_set_abstract_object.h" #include "value_set_pointer_abstract_object.h" template diff --git a/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h b/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h index 8a9f0701eca..480e749d84b 100644 --- a/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h +++ b/src/analyses/variable-sensitivity/variable_sensitivity_object_factory.h @@ -15,20 +15,8 @@ #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_VARIABLE_SENSITIVITY_OBJECT_FACTORY_H #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_VARIABLE_SENSITIVITY_OBJECT_FACTORY_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "abstract_object.h" +#include "variable_sensitivity_configuration.h" class variable_sensitivity_object_factoryt; using variable_sensitivity_object_factory_ptrt = diff --git a/src/analyses/variable-sensitivity/write_stack.cpp b/src/analyses/variable-sensitivity/write_stack.cpp index e87265dfce6..9eb2e525c67 100644 --- a/src/analyses/variable-sensitivity/write_stack.cpp +++ b/src/analyses/variable-sensitivity/write_stack.cpp @@ -12,14 +12,15 @@ #include "write_stack.h" -#include - #include #include #include #include #include "abstract_environment.h" +#include "write_stack_entry.h" + +#include /// Build a topstack write_stackt::write_stackt() : stack(), top_stack(true) diff --git a/src/analyses/variable-sensitivity/write_stack.h b/src/analyses/variable-sensitivity/write_stack.h index 102beb33f73..de94d09fa65 100644 --- a/src/analyses/variable-sensitivity/write_stack.h +++ b/src/analyses/variable-sensitivity/write_stack.h @@ -13,7 +13,14 @@ #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_WRITE_STACK_H #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_WRITE_STACK_H -#include +#include +#include + +class abstract_environmentt; +class exprt; +class index_exprt; +class namespacet; +class write_stack_entryt; class write_stackt { diff --git a/src/ansi-c/ansi_c_convert_type.cpp b/src/ansi-c/ansi_c_convert_type.cpp index 270daf1da2a..014f1050cf6 100644 --- a/src/ansi-c/ansi_c_convert_type.cpp +++ b/src/ansi-c/ansi_c_convert_type.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include #include #include diff --git a/src/ansi-c/ansi_c_entry_point.cpp b/src/ansi-c/ansi_c_entry_point.cpp index 9e1fd973bec..904f8ffa881 100644 --- a/src/ansi-c/ansi_c_entry_point.cpp +++ b/src/ansi-c/ansi_c_entry_point.cpp @@ -14,7 +14,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include +#include #include @@ -26,7 +26,7 @@ Author: Daniel Kroening, kroening@kroening.com exprt::operandst build_function_environment( const code_typet::parameterst ¶meters, code_blockt &init_code, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const c_object_factory_parameterst &object_factory_parameters) { exprt::operandst main_arguments; @@ -56,7 +56,7 @@ exprt::operandst build_function_environment( void record_function_outputs( const symbolt &function, code_blockt &init_code, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { bool has_return_value = to_code_type(function.type).return_type() != void_type(); @@ -104,7 +104,7 @@ void record_function_outputs( } bool ansi_c_entry_point( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters) { @@ -124,7 +124,7 @@ bool ansi_c_entry_point( equal_range(symbol_table.symbol_base_map, config.main.value())) { // look it up - symbol_tablet::symbolst::const_iterator s_it = + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(symbol_name_entry.second); if(s_it==symbol_table.symbols.end()) @@ -156,7 +156,7 @@ bool ansi_c_entry_point( main_symbol=ID_main; // look it up - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(main_symbol); if(s_it==symbol_table.symbols.end()) @@ -190,7 +190,7 @@ bool ansi_c_entry_point( /// \return Returns false if the _start method was generated correctly bool generate_ansi_c_start_function( const symbolt &symbol, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters) { @@ -203,7 +203,7 @@ bool generate_ansi_c_start_function( // build call to initialization function { - symbol_tablet::symbolst::const_iterator init_it= + symbol_table_baset::symbolst::const_iterator init_it = symbol_table.symbols.find(INITIALIZE_FUNCTION); if(init_it==symbol_table.symbols.end()) diff --git a/src/ansi-c/ansi_c_entry_point.h b/src/ansi-c/ansi_c_entry_point.h index c7e6140b518..38190658737 100644 --- a/src/ansi-c/ansi_c_entry_point.h +++ b/src/ansi-c/ansi_c_entry_point.h @@ -11,18 +11,18 @@ Author: Daniel Kroening, kroening@kroening.com #define CPROVER_ANSI_C_ANSI_C_ENTRY_POINT_H class message_handlert; -class symbol_tablet; +class symbol_table_baset; class symbolt; struct c_object_factory_parameterst; bool ansi_c_entry_point( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters); bool generate_ansi_c_start_function( const symbolt &symbol, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters); diff --git a/src/ansi-c/ansi_c_internal_additions.cpp b/src/ansi-c/ansi_c_internal_additions.cpp index 7ede86031cc..02e098b6ed7 100644 --- a/src/ansi-c/ansi_c_internal_additions.cpp +++ b/src/ansi-c/ansi_c_internal_additions.cpp @@ -17,92 +17,92 @@ Author: Daniel Kroening, kroening@kroening.com const char gcc_builtin_headers_types[] = "#line 1 \"gcc_builtin_headers_types.h\"\n" -#include "gcc_builtin_headers_types.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_types.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_generic[] = "#line 1 \"gcc_builtin_headers_generic.h\"\n" -#include "gcc_builtin_headers_generic.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_generic.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_math[] = "#line 1 \"gcc_builtin_headers_math.h\"\n" -#include "gcc_builtin_headers_math.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_math.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_mem_string[] = "#line 1 \"gcc_builtin_headers_mem_string.h\"\n" -#include "gcc_builtin_headers_mem_string.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_mem_string.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_omp[] = "#line 1 \"gcc_builtin_headers_omp.h\"\n" -#include "gcc_builtin_headers_omp.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_omp.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_tm[] = "#line 1 \"gcc_builtin_headers_tm.h\"\n" -#include "gcc_builtin_headers_tm.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_tm.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_ubsan[] = "#line 1 \"gcc_builtin_headers_ubsan.h\"\n" -#include "gcc_builtin_headers_ubsan.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_ubsan.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_ia32[] = "#line 1 \"gcc_builtin_headers_ia32.h\"\n" -#include "gcc_builtin_headers_ia32.inc" - ; // NOLINT(whitespace/semicolon) -const char gcc_builtin_headers_ia32_2[]= -#include "gcc_builtin_headers_ia32-2.inc" -; // NOLINT(whitespace/semicolon) -const char gcc_builtin_headers_ia32_3[]= -#include "gcc_builtin_headers_ia32-3.inc" -; // NOLINT(whitespace/semicolon) -const char gcc_builtin_headers_ia32_4[]= -#include "gcc_builtin_headers_ia32-4.inc" -; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_ia32.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) +const char gcc_builtin_headers_ia32_2[] = +#include "gcc_builtin_headers_ia32-2.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) +const char gcc_builtin_headers_ia32_3[] = +#include "gcc_builtin_headers_ia32-3.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) +const char gcc_builtin_headers_ia32_4[] = +#include "gcc_builtin_headers_ia32-4.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_ia32_5[] = -#include "gcc_builtin_headers_ia32-5.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_ia32-5.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_alpha[] = "#line 1 \"gcc_builtin_headers_alpha.h\"\n" -#include "gcc_builtin_headers_alpha.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_alpha.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_arm[] = "#line 1 \"gcc_builtin_headers_arm.h\"\n" -#include "gcc_builtin_headers_arm.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_arm.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_mips[] = "#line 1 \"gcc_builtin_headers_mips.h\"\n" -#include "gcc_builtin_headers_mips.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_mips.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char gcc_builtin_headers_power[] = "#line 1 \"gcc_builtin_headers_power.h\"\n" -#include "gcc_builtin_headers_power.inc" - ; // NOLINT(whitespace/semicolon) +#include "gcc_builtin_headers_power.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char arm_builtin_headers[] = "#line 1 \"arm_builtin_headers.h\"\n" -#include "arm_builtin_headers.inc" - ; // NOLINT(whitespace/semicolon) +#include "arm_builtin_headers.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char cw_builtin_headers[] = "#line 1 \"cw_builtin_headers.h\"\n" -#include "cw_builtin_headers.inc" - ; // NOLINT(whitespace/semicolon) +#include "cw_builtin_headers.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char clang_builtin_headers[] = "#line 1 \"clang_builtin_headers.h\"\n" -#include "clang_builtin_headers.inc" - ; // NOLINT(whitespace/semicolon) +#include "clang_builtin_headers.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char cprover_builtin_headers[] = "#line 1 \"cprover_builtin_headers.h\"\n" -#include "cprover_builtin_headers.inc" - ; // NOLINT(whitespace/semicolon) +#include "cprover_builtin_headers.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) const char windows_builtin_headers[] = "#line 1 \"windows_builtin_headers.h\"\n" -#include "windows_builtin_headers.inc" - ; // NOLINT(whitespace/semicolon) +#include "windows_builtin_headers.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) static std::string architecture_string(const std::string &value, const char *s) { diff --git a/src/ansi-c/ansi_c_language.cpp b/src/ansi-c/ansi_c_language.cpp index 27c818895f5..50d512e0392 100644 --- a/src/ansi-c/ansi_c_language.cpp +++ b/src/ansi-c/ansi_c_language.cpp @@ -8,22 +8,23 @@ Author: Daniel Kroening, kroening@kroening.com #include "ansi_c_language.h" -#include - #include #include +#include #include #include #include "ansi_c_entry_point.h" -#include "ansi_c_typecheck.h" +#include "ansi_c_internal_additions.h" #include "ansi_c_parser.h" -#include "expr2c.h" +#include "ansi_c_typecheck.h" #include "c_preprocess.h" -#include "ansi_c_internal_additions.h" +#include "expr2c.h" #include "type2name.h" +#include + std::set ansi_c_languaget::extensions() const { return { "c", "i" }; @@ -101,7 +102,7 @@ bool ansi_c_languaget::parse( } bool ansi_c_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) { @@ -109,7 +110,7 @@ bool ansi_c_languaget::typecheck( } bool ansi_c_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local, const std::set &keep) @@ -135,7 +136,7 @@ bool ansi_c_languaget::typecheck( } bool ansi_c_languaget::generate_support_functions( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { // This creates __CPROVER_start and __CPROVER_initialize: return ansi_c_entry_point( diff --git a/src/ansi-c/ansi_c_language.h b/src/ansi-c/ansi_c_language.h index cee460beb2e..0fd1ccefb8a 100644 --- a/src/ansi-c/ansi_c_language.h +++ b/src/ansi-c/ansi_c_language.h @@ -48,16 +48,15 @@ class ansi_c_languaget:public languaget std::istream &instream, const std::string &path) override; - bool generate_support_functions( - symbol_tablet &symbol_table) override; + bool generate_support_functions(symbol_table_baset &symbol_table) override; bool typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) override; bool typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local, const std::set &keep); @@ -67,8 +66,8 @@ class ansi_c_languaget:public languaget return true; } - bool - typecheck(symbol_tablet &symbol_table, const std::string &module) override + bool typecheck(symbol_table_baset &symbol_table, const std::string &module) + override { return typecheck(symbol_table, module, true); } diff --git a/src/ansi-c/ansi_c_typecheck.cpp b/src/ansi-c/ansi_c_typecheck.cpp index 60c72e4ef7f..50b156e2ca1 100644 --- a/src/ansi-c/ansi_c_typecheck.cpp +++ b/src/ansi-c/ansi_c_typecheck.cpp @@ -11,6 +11,8 @@ Author: Daniel Kroening, kroening@kroening.com #include "ansi_c_typecheck.h" +#include + #include "ansi_c_parse_tree.h" void ansi_c_typecheckt::typecheck() @@ -23,7 +25,7 @@ void ansi_c_typecheckt::typecheck() bool ansi_c_typecheck( ansi_c_parse_treet &ansi_c_parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) { diff --git a/src/ansi-c/ansi_c_typecheck.h b/src/ansi-c/ansi_c_typecheck.h index 54a86ee94bb..7e0dd33aa6a 100644 --- a/src/ansi-c/ansi_c_typecheck.h +++ b/src/ansi-c/ansi_c_typecheck.h @@ -18,7 +18,7 @@ class ansi_c_parse_treet; bool ansi_c_typecheck( ansi_c_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler); @@ -32,23 +32,26 @@ class ansi_c_typecheckt:public c_typecheck_baset public: ansi_c_typecheckt( ansi_c_parse_treet &_parse_tree, - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, const std::string &_module, - message_handlert &_message_handler): - c_typecheck_baset(_symbol_table, _module, _message_handler), - parse_tree(_parse_tree) + message_handlert &_message_handler) + : c_typecheck_baset(_symbol_table, _module, _message_handler), + parse_tree(_parse_tree) { } ansi_c_typecheckt( ansi_c_parse_treet &_parse_tree, - symbol_tablet &_symbol_table1, - const symbol_tablet &_symbol_table2, + symbol_table_baset &_symbol_table1, + const symbol_table_baset &_symbol_table2, const std::string &_module, - message_handlert &_message_handler): - c_typecheck_baset(_symbol_table1, _symbol_table2, - _module, _message_handler), - parse_tree(_parse_tree) + message_handlert &_message_handler) + : c_typecheck_baset( + _symbol_table1, + _symbol_table2, + _module, + _message_handler), + parse_tree(_parse_tree) { } diff --git a/src/ansi-c/builtin_factory.cpp b/src/ansi-c/builtin_factory.cpp index 778a497a861..be3b25c7d40 100644 --- a/src/ansi-c/builtin_factory.cpp +++ b/src/ansi-c/builtin_factory.cpp @@ -7,14 +7,15 @@ Author: Daniel Kroening, kroening@kroening.com \*******************************************************************/ #include "builtin_factory.h" -#include "ansi_c_internal_additions.h" - -#include "ansi_c_parser.h" -#include "ansi_c_typecheck.h" #include #include #include +#include + +#include "ansi_c_internal_additions.h" +#include "ansi_c_parser.h" +#include "ansi_c_typecheck.h" #include @@ -41,7 +42,7 @@ static bool find_pattern( static bool convert( const irep_idt &identifier, const std::ostringstream &s, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { std::istringstream in(s.str()); @@ -96,7 +97,7 @@ static bool convert( //! \return 'true' on error bool builtin_factory( const irep_idt &identifier, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &mh) { // we search for "space" "identifier" "(" diff --git a/src/ansi-c/builtin_factory.h b/src/ansi-c/builtin_factory.h index e3bb0c5de93..8a012894c3f 100644 --- a/src/ansi-c/builtin_factory.h +++ b/src/ansi-c/builtin_factory.h @@ -12,12 +12,12 @@ Author: Daniel Kroening, kroening@kroening.com #include class message_handlert; -class symbol_tablet; +class symbol_table_baset; //! \return 'true' in case of error bool builtin_factory( const irep_idt &identifier, - symbol_tablet &, + symbol_table_baset &, message_handlert &); #endif // CPROVER_ANSI_C_BUILTIN_FACTORY_H diff --git a/src/ansi-c/c_nondet_symbol_factory.cpp b/src/ansi-c/c_nondet_symbol_factory.cpp index a7d7fcd4078..1fa34258e76 100644 --- a/src/ansi-c/c_nondet_symbol_factory.cpp +++ b/src/ansi-c/c_nondet_symbol_factory.cpp @@ -11,8 +11,6 @@ Author: Diffblue Ltd. #include "c_nondet_symbol_factory.h" -#include - #include #include #include @@ -20,10 +18,13 @@ Author: Diffblue Ltd. #include #include #include +#include #include #include +#include + /// Creates a nondet for expr, including calling itself recursively to make /// appropriate symbols to point to if expr is a pointer. /// \param assignments: The code block to add code to @@ -201,7 +202,7 @@ void symbol_factoryt::gen_nondet_array_init( /// \return Returns the symbol_exprt for the symbol created symbol_exprt c_nondet_symbol_factory( code_blockt &init_code, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt base_name, const typet &type, const source_locationt &loc, diff --git a/src/ansi-c/c_nondet_symbol_factory.h b/src/ansi-c/c_nondet_symbol_factory.h index 9eff87d29b5..ebca599694c 100644 --- a/src/ansi-c/c_nondet_symbol_factory.h +++ b/src/ansi-c/c_nondet_symbol_factory.h @@ -16,13 +16,11 @@ Author: Diffblue Ltd. #include -#include - struct c_object_factory_parameterst; class symbol_factoryt { - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; const source_locationt &loc; namespacet ns; const c_object_factory_parameterst &object_factory_params; @@ -35,7 +33,7 @@ class symbol_factoryt typedef std::set recursion_sett; symbol_factoryt( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, const source_locationt &loc, const irep_idt &name_prefix, const c_object_factory_parameterst &object_factory_params, @@ -87,7 +85,7 @@ class symbol_factoryt symbol_exprt c_nondet_symbol_factory( code_blockt &init_code, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt base_name, const typet &type, const source_locationt &, diff --git a/src/ansi-c/c_typecheck_base.cpp b/src/ansi-c/c_typecheck_base.cpp index 6ef3bfb6451..4870c033487 100644 --- a/src/ansi-c/c_typecheck_base.cpp +++ b/src/ansi-c/c_typecheck_base.cpp @@ -13,9 +13,11 @@ Author: Daniel Kroening, kroening@kroening.com #include #include +#include #include #include #include +#include #include "ansi_c_declaration.h" #include "c_storage_spec.h" @@ -111,7 +113,7 @@ void c_typecheck_baset::typecheck_symbol(symbolt &symbol) } // see if we have it already - symbol_tablet::symbolst::const_iterator old_it= + symbol_table_baset::symbolst::const_iterator old_it = symbol_table.symbols.find(symbol.name); if(old_it==symbol_table.symbols.end()) @@ -414,7 +416,7 @@ void c_typecheck_baset::typecheck_redefinition_non_type( { const irep_idt &identifier = old_parameter.get_identifier(); - symbol_tablet::symbolst::const_iterator p_s_it= + symbol_table_baset::symbolst::const_iterator p_s_it = symbol_table.symbols.find(identifier); if(p_s_it!=symbol_table.symbols.end()) symbol_table.erase(p_s_it); diff --git a/src/ansi-c/c_typecheck_base.h b/src/ansi-c/c_typecheck_base.h index 17369bdc287..0666537b398 100644 --- a/src/ansi-c/c_typecheck_base.h +++ b/src/ansi-c/c_typecheck_base.h @@ -14,11 +14,13 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include +#include #include #include "designator.h" +#include + class ansi_c_declarationt; class c_bit_field_typet; class shift_exprt; @@ -29,33 +31,33 @@ class c_typecheck_baset: { public: c_typecheck_baset( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, const std::string &_module, - message_handlert &_message_handler): - typecheckt(_message_handler), - namespacet(_symbol_table), - symbol_table(_symbol_table), - module(_module), - mode(ID_C), - break_is_allowed(false), - continue_is_allowed(false), - case_is_allowed(false) + message_handlert &_message_handler) + : typecheckt(_message_handler), + namespacet(_symbol_table), + symbol_table(_symbol_table), + module(_module), + mode(ID_C), + break_is_allowed(false), + continue_is_allowed(false), + case_is_allowed(false) { } c_typecheck_baset( - symbol_tablet &_symbol_table1, - const symbol_tablet &_symbol_table2, + symbol_table_baset &_symbol_table1, + const symbol_table_baset &_symbol_table2, const std::string &_module, - message_handlert &_message_handler): - typecheckt(_message_handler), - namespacet(_symbol_table1, _symbol_table2), - symbol_table(_symbol_table1), - module(_module), - mode(ID_C), - break_is_allowed(false), - continue_is_allowed(false), - case_is_allowed(false) + message_handlert &_message_handler) + : typecheckt(_message_handler), + namespacet(_symbol_table1, _symbol_table2), + symbol_table(_symbol_table1), + module(_module), + mode(ID_C), + break_is_allowed(false), + continue_is_allowed(false), + case_is_allowed(false) { } @@ -65,7 +67,7 @@ class c_typecheck_baset: virtual void typecheck_expr(exprt &expr); protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; const irep_idt module; const irep_idt mode; symbolt current_symbol; diff --git a/src/ansi-c/c_typecheck_code.cpp b/src/ansi-c/c_typecheck_code.cpp index 434c83395eb..80f095b4a79 100644 --- a/src/ansi-c/c_typecheck_code.cpp +++ b/src/ansi-c/c_typecheck_code.cpp @@ -9,17 +9,17 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// C Language Type Checking -#include "c_typecheck_base.h" - -#include #include #include +#include #include #include #include +#include #include "ansi_c_declaration.h" #include "c_expr.h" +#include "c_typecheck_base.h" void c_typecheck_baset::start_typecheck_code() { @@ -284,7 +284,7 @@ void c_typecheck_baset::typecheck_decl(codet &code) irep_idt identifier = d.get_name(); // look it up - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it==symbol_table.symbols.end()) diff --git a/src/ansi-c/c_typecheck_expr.cpp b/src/ansi-c/c_typecheck_expr.cpp index 28e03bd5c21..cd41c414c86 100644 --- a/src/ansi-c/c_typecheck_expr.cpp +++ b/src/ansi-c/c_typecheck_expr.cpp @@ -9,10 +9,6 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// ANSI-C Language Type Checking -#include "c_typecheck_base.h" - -#include - #include #include #include @@ -31,6 +27,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #include @@ -39,10 +36,13 @@ Author: Daniel Kroening, kroening@kroening.com #include "builtin_factory.h" #include "c_expr.h" #include "c_qualifiers.h" +#include "c_typecheck_base.h" #include "expr2c.h" #include "padding.h" #include "type2name.h" +#include + void c_typecheck_baset::typecheck_expr(exprt &expr) { if(expr.id()==ID_already_typechecked) @@ -771,7 +771,7 @@ void c_typecheck_baset::typecheck_expr_operands(exprt &expr) irep_idt identifier = declaration.declarators().front().get_name(); // look it up - symbol_tablet::symbolst::const_iterator s_it = + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it == symbol_table.symbols.end()) diff --git a/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp b/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp index c6a5ded5613..2cbc4f0c7e7 100644 --- a/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp +++ b/src/ansi-c/c_typecheck_gcc_polymorphic_builtins.cpp @@ -9,20 +9,20 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// ANSI-C Language Type Checking -#include "c_typecheck_base.h" - #include #include #include #include #include #include +#include #include -#include - #include "c_expr.h" +#include "c_typecheck_base.h" + +#include static symbol_exprt typecheck_sync_with_pointer_parameter( const irep_idt &identifier, @@ -610,7 +610,7 @@ static symbolt result_symbol( const irep_idt &identifier, const typet &type, const source_locationt &source_location, - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { symbolt symbol; symbol.name = id2string(identifier) + "::1::result"; @@ -633,7 +633,7 @@ static void instantiate_atomic_fetch_op( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __sync_fetch_and_OP(type *ptr, type value, ...) @@ -695,7 +695,7 @@ static void instantiate_atomic_op_fetch( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __sync_OP_and_fetch(type *ptr, type value, ...) @@ -808,7 +808,7 @@ static void instantiate_sync_val_compare_and_swap( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __sync_val_compare_and_swap(type *ptr, type old, type new, ...) @@ -858,7 +858,7 @@ static void instantiate_sync_lock_test_and_set( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __sync_lock_test_and_set (type *ptr, type value, ...) @@ -987,7 +987,7 @@ static void instantiate_atomic_load_n( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __atomic_load_n (type *ptr, int memorder) @@ -1102,7 +1102,7 @@ static void instantiate_atomic_exchange_n( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // type __atomic_exchange_n (type *ptr, type val, int memorder) @@ -1132,7 +1132,7 @@ static void instantiate_atomic_compare_exchange( const code_typet &code_type, const source_locationt &source_location, const std::vector ¶meter_exprs, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, code_blockt &block) { // bool __atomic_compare_exchange (type *ptr, type *expected, type *desired, diff --git a/src/ansi-c/c_typecheck_initializer.cpp b/src/ansi-c/c_typecheck_initializer.cpp index 511522d4122..9204f3ff5cc 100644 --- a/src/ansi-c/c_typecheck_initializer.cpp +++ b/src/ansi-c/c_typecheck_initializer.cpp @@ -18,6 +18,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #include "anonymous_member.h" #include "c_typecheck_base.h" diff --git a/src/ansi-c/c_typecheck_type.cpp b/src/ansi-c/c_typecheck_type.cpp index bde69b633b7..ca17a7746ea 100644 --- a/src/ansi-c/c_typecheck_type.cpp +++ b/src/ansi-c/c_typecheck_type.cpp @@ -9,29 +9,28 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// C++ Language Type Checking -#include "c_typecheck_base.h" - -#include - -#include - #include #include #include +#include #include #include #include #include #include +#include #include "ansi_c_convert_type.h" #include "ansi_c_declaration.h" #include "c_qualifiers.h" +#include "c_typecheck_base.h" #include "gcc_types.h" #include "padding.h" #include "type2name.h" #include "typedef_type.h" +#include + void c_typecheck_baset::typecheck_type(typet &type) { // we first convert, and then check @@ -812,7 +811,7 @@ void c_typecheck_baset::typecheck_compound_type(struct_union_typet &type) identifier=type.find(ID_tag).get(ID_identifier); // does it exist already? - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it==symbol_table.symbols.end()) @@ -1387,7 +1386,7 @@ void c_typecheck_baset::typecheck_c_enum_type(typet &type) enum_tag_symbol.type.add_subtype() = underlying_type; // is it in the symbol table already? - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it!=symbol_table.symbols.end()) @@ -1457,7 +1456,7 @@ void c_typecheck_baset::typecheck_c_enum_tag_type(c_enum_tag_typet &type) irep_idt identifier=tag.get(ID_identifier); // is it in the symbol table? - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it!=symbol_table.symbols.end()) @@ -1617,7 +1616,7 @@ void c_typecheck_baset::typecheck_typedef_type(typet &type) { const irep_idt &identifier = to_typedef_type(type).get_identifier(); - symbol_tablet::symbolst::const_iterator s_it = + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it == symbol_table.symbols.end()) diff --git a/src/ansi-c/cprover_library.cpp b/src/ansi-c/cprover_library.cpp index 6e51f93f9d9..6582a491b1e 100644 --- a/src/ansi-c/cprover_library.cpp +++ b/src/ansi-c/cprover_library.cpp @@ -8,16 +8,17 @@ Author: Daniel Kroening, kroening@kroening.com #include "cprover_library.h" -#include - #include -#include +#include +#include #include "ansi_c_language.h" +#include + static std::string get_cprover_library_text( const std::set &functions, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const bool force_load) { std::ostringstream library_text; @@ -48,8 +49,8 @@ static std::string get_cprover_library_text( // make Doxygen skip this part /// \cond const struct cprover_library_entryt cprover_library[] = -#include "cprover_library.inc" - ; // NOLINT(whitespace/semicolon) +#include "cprover_library.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) /// \endcond return get_cprover_library_text( @@ -58,7 +59,7 @@ static std::string get_cprover_library_text( std::string get_cprover_library_text( const std::set &functions, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const struct cprover_library_entryt cprover_library[], const std::string &prologue, const bool force_load) @@ -76,7 +77,7 @@ std::string get_cprover_library_text( if(functions.find(id)!=functions.end()) { - symbol_tablet::symbolst::const_iterator old= + symbol_table_baset::symbolst::const_iterator old = symbol_table.symbols.find(id); if( @@ -97,7 +98,7 @@ std::string get_cprover_library_text( void cprover_c_library_factory( const std::set &functions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { if(config.ansi_c.lib==configt::ansi_ct::libt::LIB_NONE) @@ -111,7 +112,7 @@ void cprover_c_library_factory( void add_library( const std::string &src, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler, const std::set &keep) { @@ -129,7 +130,7 @@ void add_library( void cprover_c_library_factory_force_load( const std::set &functions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { std::string library_text = diff --git a/src/ansi-c/cprover_library.h b/src/ansi-c/cprover_library.h index cfdf5bfec05..80bbfea2608 100644 --- a/src/ansi-c/cprover_library.h +++ b/src/ansi-c/cprover_library.h @@ -15,7 +15,7 @@ Author: Daniel Kroening, kroening@kroening.com #include class message_handlert; -class symbol_tablet; +class symbol_table_baset; struct cprover_library_entryt { @@ -25,7 +25,7 @@ struct cprover_library_entryt std::string get_cprover_library_text( const std::set &functions, - const symbol_tablet &, + const symbol_table_baset &, const struct cprover_library_entryt[], const std::string &prologue, const bool force_load = false); @@ -35,13 +35,13 @@ std::string get_cprover_library_text( /// the symbol table cleanup pass and be found in the symbol_table. void add_library( const std::string &src, - symbol_tablet &, + symbol_table_baset &, message_handlert &, const std::set &keep = {}); void cprover_c_library_factory( const std::set &functions, - symbol_tablet &, + symbol_table_baset &, message_handlert &); /// Load the requested function symbols from the cprover library @@ -49,6 +49,6 @@ void cprover_c_library_factory( /// the library config flags and usage. void cprover_c_library_factory_force_load( const std::set &functions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler); #endif // CPROVER_ANSI_C_CPROVER_LIBRARY_H diff --git a/src/ansi-c/file_converter.cpp b/src/ansi-c/file_converter.cpp index 081def1828c..3268530abf6 100644 --- a/src/ansi-c/file_converter.cpp +++ b/src/ansi-c/file_converter.cpp @@ -9,7 +9,7 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// Convert file contents to C strings -#include +#include // IWYU pragma: keep #include #include diff --git a/src/ansi-c/goto_check_c.cpp b/src/ansi-c/goto_check_c.cpp index 354d5203f87..87f320863e6 100644 --- a/src/ansi-c/goto_check_c.cpp +++ b/src/ansi-c/goto_check_c.cpp @@ -42,7 +42,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include class goto_check_ct { diff --git a/src/ansi-c/library/converter.cpp b/src/ansi-c/library/converter.cpp index e666ebfaffd..81e792c8ad8 100644 --- a/src/ansi-c/library/converter.cpp +++ b/src/ansi-c/library/converter.cpp @@ -6,7 +6,7 @@ Author: Daniel Kroening, kroening@kroening.com \*******************************************************************/ -#include +#include // IWYU pragma: keep #include #include diff --git a/src/ansi-c/scanner.l b/src/ansi-c/scanner.l index 05faae82d62..8e99bfd9d82 100644 --- a/src/ansi-c/scanner.l +++ b/src/ansi-c/scanner.l @@ -176,9 +176,9 @@ int cpp_operator(int token) } } -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep /*** macros for easier rule definition **********************************/ %} diff --git a/src/assembler/scanner.l b/src/assembler/scanner.l index a050bd048ab..d975de73315 100755 --- a/src/assembler/scanner.l +++ b/src/assembler/scanner.l @@ -20,9 +20,9 @@ #include "assembler_parser.h" -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep /*** macros for easier rule definition **********************************/ %} diff --git a/src/big-int/bigint.cc b/src/big-int/bigint.cc index 8034bb69a61..978c63e2ad0 100644 --- a/src/big-int/bigint.cc +++ b/src/big-int/bigint.cc @@ -6,7 +6,8 @@ // You may however use and modify this without restriction. #include "bigint.hh" -#include "allocainc.h" + +#include "allocainc.h" // IWYU pragma: keep #include #include diff --git a/src/cbmc/c_test_input_generator.cpp b/src/cbmc/c_test_input_generator.cpp index 0b506a754c3..101721264b4 100644 --- a/src/cbmc/c_test_input_generator.cpp +++ b/src/cbmc/c_test_input_generator.cpp @@ -11,12 +11,9 @@ Author: Daniel Kroening, Peter Schrammel #include "c_test_input_generator.h" -#include - -#include - #include #include +#include #include #include #include @@ -28,6 +25,9 @@ Author: Daniel Kroening, Peter Schrammel #include #include +#include +#include + c_test_input_generatort::c_test_input_generatort( ui_message_handlert &ui_message_handler, const optionst &options) diff --git a/src/cbmc/cbmc_parse_options.cpp b/src/cbmc/cbmc_parse_options.cpp index a05f909e2de..cad16ca9b96 100644 --- a/src/cbmc/cbmc_parse_options.cpp +++ b/src/cbmc/cbmc_parse_options.cpp @@ -11,17 +11,17 @@ Author: Daniel Kroening, kroening@kroening.com #include "cbmc_parse_options.h" -#include // exit() -#include -#include -#include - #include #include #include #include #include +#include // exit() +#include // IWYU pragma: keep +#include +#include + #ifdef _MSC_VER # include #endif diff --git a/src/cpp/cpp_declarator_converter.cpp b/src/cpp/cpp_declarator_converter.cpp index ff2531ea3ed..bba2ded6409 100644 --- a/src/cpp/cpp_declarator_converter.cpp +++ b/src/cpp/cpp_declarator_converter.cpp @@ -15,6 +15,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include #include #include +#include #include "cpp_type2name.h" #include "cpp_typecheck.h" @@ -414,8 +415,8 @@ void cpp_declarator_convertert::get_final_identifier() { // Is there already an `extern "C"' function with the same name // and the same signature? - symbol_tablet::symbolst::const_iterator - c_it=cpp_typecheck.symbol_table.symbols.find(identifier); + symbol_table_baset::symbolst::const_iterator c_it = + cpp_typecheck.symbol_table.symbols.find(identifier); if(c_it!=cpp_typecheck.symbol_table.symbols.end() && c_it->second.type.id()==ID_code && diff --git a/src/cpp/cpp_instantiate_template.cpp b/src/cpp/cpp_instantiate_template.cpp index d133283b1c0..b9cbc7646b7 100644 --- a/src/cpp/cpp_instantiate_template.cpp +++ b/src/cpp/cpp_instantiate_template.cpp @@ -16,7 +16,8 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #endif #include -#include +#include // IWYU pragma: keep +#include #include "cpp_type2name.h" @@ -175,7 +176,7 @@ const symbolt &cpp_typecheckt::class_template_symbol( id2string(suffix); // already there? - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it!=symbol_table.symbols.end()) return s_it->second; diff --git a/src/cpp/cpp_language.cpp b/src/cpp/cpp_language.cpp index 93513163b96..74aa2d16001 100644 --- a/src/cpp/cpp_language.cpp +++ b/src/cpp/cpp_language.cpp @@ -11,23 +11,23 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_language.h" -#include -#include - #include #include - -#include -#include +#include #include #include +#include +#include #include "cpp_internal_additions.h" -#include "expr2cpp.h" #include "cpp_parser.h" -#include "cpp_typecheck.h" #include "cpp_type2name.h" +#include "cpp_typecheck.h" +#include "expr2cpp.h" + +#include +#include std::set cpp_languaget::extensions() const { @@ -119,7 +119,7 @@ bool cpp_languaget::parse( } bool cpp_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module) { if(module.empty()) @@ -136,8 +136,7 @@ bool cpp_languaget::typecheck( return linking(symbol_table, new_symbol_table, get_message_handler()); } -bool cpp_languaget::generate_support_functions( - symbol_tablet &symbol_table) +bool cpp_languaget::generate_support_functions(symbol_table_baset &symbol_table) { return ansi_c_entry_point( symbol_table, get_message_handler(), object_factory_params); diff --git a/src/cpp/cpp_language.h b/src/cpp/cpp_language.h index f72784f7420..a2133f9cf95 100644 --- a/src/cpp/cpp_language.h +++ b/src/cpp/cpp_language.h @@ -39,15 +39,14 @@ class cpp_languaget:public languaget std::istream &instream, const std::string &path) override; - bool generate_support_functions( - symbol_tablet &symbol_table) override; + bool generate_support_functions(symbol_table_baset &symbol_table) override; - bool - typecheck(symbol_tablet &symbol_table, const std::string &module) override; + bool typecheck(symbol_table_baset &symbol_table, const std::string &module) + override; bool merge_symbol_table( - symbol_tablet &dest, - symbol_tablet &src, + symbol_table_baset &dest, + symbol_table_baset &src, const std::string &module, class replace_symbolt &replace_symbol) const; diff --git a/src/cpp/cpp_name.cpp b/src/cpp/cpp_name.cpp index 5dc09d2f2b6..899b7433ed7 100644 --- a/src/cpp/cpp_name.cpp +++ b/src/cpp/cpp_name.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_name.h" -#include - irep_idt cpp_namet::get_base_name() const { const subt &sub=get_sub(); diff --git a/src/cpp/cpp_typecheck.cpp b/src/cpp/cpp_typecheck.cpp index f822d59940c..aa03044204e 100644 --- a/src/cpp/cpp_typecheck.cpp +++ b/src/cpp/cpp_typecheck.cpp @@ -11,11 +11,9 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_typecheck.h" -#include - #include #include -#include +#include #include @@ -86,7 +84,7 @@ std::string cpp_typecheckt::to_string(const typet &type) bool cpp_typecheck( cpp_parse_treet &cpp_parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) { @@ -271,11 +269,12 @@ void cpp_typecheckt::do_not_typechecked() void cpp_typecheckt::clean_up() { - symbol_tablet::symbolst::const_iterator it=symbol_table.symbols.begin(); + symbol_table_baset::symbolst::const_iterator it = + symbol_table.symbols.begin(); while(it!=symbol_table.symbols.end()) { - symbol_tablet::symbolst::const_iterator cur_it = it; + symbol_table_baset::symbolst::const_iterator cur_it = it; it++; const symbolt &symbol=cur_it->second; diff --git a/src/cpp/cpp_typecheck.h b/src/cpp/cpp_typecheck.h index 6b6c11770fb..7c625f4ba6d 100644 --- a/src/cpp/cpp_typecheck.h +++ b/src/cpp/cpp_typecheck.h @@ -12,11 +12,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #ifndef CPROVER_CPP_CPP_TYPECHECK_H #define CPROVER_CPP_CPP_TYPECHECK_H -#include -#include -#include - -#include +#include #include @@ -25,9 +21,13 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_typecheck_resolve.h" #include "template_map.h" +#include +#include +#include + bool cpp_typecheck( cpp_parse_treet &cpp_parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler); @@ -41,29 +41,32 @@ class cpp_typecheckt:public c_typecheck_baset public: cpp_typecheckt( cpp_parse_treet &_cpp_parse_tree, - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, const std::string &_module, - message_handlert &message_handler): - c_typecheck_baset(_symbol_table, _module, message_handler), - cpp_parse_tree(_cpp_parse_tree), - template_counter(0), - anon_counter(0), - disable_access_control(false) + message_handlert &message_handler) + : c_typecheck_baset(_symbol_table, _module, message_handler), + cpp_parse_tree(_cpp_parse_tree), + template_counter(0), + anon_counter(0), + disable_access_control(false) { } cpp_typecheckt( cpp_parse_treet &_cpp_parse_tree, - symbol_tablet &_symbol_table1, - const symbol_tablet &_symbol_table2, + symbol_table_baset &_symbol_table1, + const symbol_table_baset &_symbol_table2, const std::string &_module, - message_handlert &message_handler): - c_typecheck_baset(_symbol_table1, _symbol_table2, - _module, message_handler), - cpp_parse_tree(_cpp_parse_tree), - template_counter(0), - anon_counter(0), - disable_access_control(false) + message_handlert &message_handler) + : c_typecheck_baset( + _symbol_table1, + _symbol_table2, + _module, + message_handler), + cpp_parse_tree(_cpp_parse_tree), + template_counter(0), + anon_counter(0), + disable_access_control(false) { } diff --git a/src/cpp/cpp_typecheck_compound_type.cpp b/src/cpp/cpp_typecheck_compound_type.cpp index 7de63ed395b..5f09a33edb8 100644 --- a/src/cpp/cpp_typecheck_compound_type.cpp +++ b/src/cpp/cpp_typecheck_compound_type.cpp @@ -15,11 +15,10 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include #endif -#include - #include -#include #include +#include +#include #include @@ -28,6 +27,8 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_type2name.h" #include "cpp_util.h" +#include + bool cpp_typecheckt::has_const(const typet &type) { if(type.id()==ID_const) diff --git a/src/cpp/cpp_typecheck_declaration.cpp b/src/cpp/cpp_typecheck_declaration.cpp index c1e0043b679..72a1666231c 100644 --- a/src/cpp/cpp_typecheck_declaration.cpp +++ b/src/cpp/cpp_typecheck_declaration.cpp @@ -9,12 +9,11 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - -#include "cpp_declarator_converter.h" - #include +#include +#include "cpp_declarator_converter.h" +#include "cpp_typecheck.h" #include "cpp_util.h" void cpp_typecheckt::convert(cpp_declarationt &declaration) diff --git a/src/cpp/cpp_typecheck_destructor.cpp b/src/cpp/cpp_typecheck_destructor.cpp index 90393460a0a..18de2413708 100644 --- a/src/cpp/cpp_typecheck_destructor.cpp +++ b/src/cpp/cpp_typecheck_destructor.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_typecheck.h" -#include - #include bool cpp_typecheckt::find_dtor(const symbolt &symbol) const diff --git a/src/cpp/cpp_typecheck_enum_type.cpp b/src/cpp/cpp_typecheck_enum_type.cpp index 4e2f54fe76c..72f53e159e1 100644 --- a/src/cpp/cpp_typecheck_enum_type.cpp +++ b/src/cpp/cpp_typecheck_enum_type.cpp @@ -9,15 +9,15 @@ Author: Daniel Kroening, kroening@kroening.com /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - #include #include #include +#include #include #include "cpp_enum_type.h" +#include "cpp_typecheck.h" void cpp_typecheckt::typecheck_enum_body(symbolt &enum_symbol) { @@ -123,7 +123,7 @@ void cpp_typecheckt::typecheck_enum_type(typet &type) // check if we have it - symbol_tablet::symbolst::const_iterator previous_symbol= + symbol_table_baset::symbolst::const_iterator previous_symbol = symbol_table.symbols.find(symbol_name); if(previous_symbol!=symbol_table.symbols.end()) diff --git a/src/cpp/cpp_typecheck_expr.cpp b/src/cpp/cpp_typecheck_expr.cpp index fe1062f9798..c725d8bfb16 100644 --- a/src/cpp/cpp_typecheck_expr.cpp +++ b/src/cpp/cpp_typecheck_expr.cpp @@ -22,6 +22,7 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include #include #include +#include #include @@ -1228,7 +1229,7 @@ void cpp_typecheckt::typecheck_expr_member( if(expr.type().id()==ID_code) { // Check if the function body has to be typechecked - symbol_tablet::symbolst::const_iterator it= + symbol_table_baset::symbolst::const_iterator it = symbol_table.symbols.find(component_name); assert(it!=symbol_table.symbols.end()); @@ -2248,7 +2249,7 @@ void cpp_typecheckt::typecheck_expr_function_identifier(exprt &expr) if(expr.id()==ID_symbol) { // Check if the function body has to be typechecked - symbol_tablet::symbolst::const_iterator it= + symbol_table_baset::symbolst::const_iterator it = symbol_table.symbols.find(expr.get(ID_identifier)); assert(it != symbol_table.symbols.end()); diff --git a/src/cpp/cpp_typecheck_function.cpp b/src/cpp/cpp_typecheck_function.cpp index 6d1b9e131d5..47a311faf22 100644 --- a/src/cpp/cpp_typecheck_function.cpp +++ b/src/cpp/cpp_typecheck_function.cpp @@ -9,12 +9,12 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - #include +#include #include "cpp_template_type.h" #include "cpp_type2name.h" +#include "cpp_typecheck.h" void cpp_typecheckt::convert_parameter( const irep_idt ¤t_mode, diff --git a/src/cpp/cpp_typecheck_initializer.cpp b/src/cpp/cpp_typecheck_initializer.cpp index e2685095254..5fab61517aa 100644 --- a/src/cpp/cpp_typecheck_initializer.cpp +++ b/src/cpp/cpp_typecheck_initializer.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "cpp_typecheck.h" -#include - #include #include #include diff --git a/src/cpp/cpp_typecheck_namespace.cpp b/src/cpp/cpp_typecheck_namespace.cpp index 10e8dcfd93a..618ab1ef4de 100644 --- a/src/cpp/cpp_typecheck_namespace.cpp +++ b/src/cpp/cpp_typecheck_namespace.cpp @@ -9,9 +9,10 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - #include +#include + +#include "cpp_typecheck.h" void cpp_typecheckt::convert(cpp_namespace_spect &namespace_spec) { @@ -33,7 +34,7 @@ void cpp_typecheckt::convert(cpp_namespace_spect &namespace_spec) std::string identifier= cpp_scopes.current_scope().prefix+id2string(final_name); - symbol_tablet::symbolst::const_iterator it= + symbol_table_baset::symbolst::const_iterator it = symbol_table.symbols.find(identifier); if(it!=symbol_table.symbols.end()) diff --git a/src/cpp/cpp_typecheck_template.cpp b/src/cpp/cpp_typecheck_template.cpp index c454a649920..fe42ae549a7 100644 --- a/src/cpp/cpp_typecheck_template.cpp +++ b/src/cpp/cpp_typecheck_template.cpp @@ -9,16 +9,16 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - -#include +#include // IWYU pragma: keep #include +#include -#include "cpp_type2name.h" -#include "cpp_declarator_converter.h" -#include "cpp_template_type.h" #include "cpp_convert_type.h" +#include "cpp_declarator_converter.h" #include "cpp_template_args.h" +#include "cpp_template_type.h" +#include "cpp_type2name.h" +#include "cpp_typecheck.h" void cpp_typecheckt::salvage_default_arguments( const template_typet &old_type, @@ -244,7 +244,7 @@ void cpp_typecheckt::typecheck_function_template( // check if we have it already - symbol_tablet::symbolst::const_iterator previous_symbol= + symbol_table_baset::symbolst::const_iterator previous_symbol = symbol_table.symbols.find(symbol_name); if(previous_symbol!=symbol_table.symbols.end()) @@ -570,7 +570,7 @@ void cpp_typecheckt::convert_class_template_specialization( throw 0; } - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find((*id_set.begin())->identifier); assert(s_it!=symbol_table.symbols.end()); diff --git a/src/cpp/cpp_typecheck_virtual_table.cpp b/src/cpp/cpp_typecheck_virtual_table.cpp index 85409731cbe..58c5f79056e 100644 --- a/src/cpp/cpp_typecheck_virtual_table.cpp +++ b/src/cpp/cpp_typecheck_virtual_table.cpp @@ -9,11 +9,12 @@ Author: Daniel Kroening, kroening@cs.cmu.edu /// \file /// C++ Language Type Checking -#include "cpp_typecheck.h" - #include #include #include +#include + +#include "cpp_typecheck.h" void cpp_typecheckt::do_virtual_table(const symbolt &symbol) { diff --git a/src/cpp/cprover_library.cpp b/src/cpp/cprover_library.cpp index fae330e1063..e906808b4ec 100644 --- a/src/cpp/cprover_library.cpp +++ b/src/cpp/cprover_library.cpp @@ -16,7 +16,7 @@ Author: Michael Tautschnig static std::string get_cprover_library_text( const std::set &functions, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { std::ostringstream library_text; @@ -27,8 +27,8 @@ static std::string get_cprover_library_text( // make Doxygen skip this part /// \cond const struct cprover_library_entryt cprover_library[] = -#include "cprover_library.inc" - ; // NOLINT(whitespace/semicolon) +#include "cprover_library.inc" // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) /// \endcond return get_cprover_library_text( @@ -37,7 +37,7 @@ static std::string get_cprover_library_text( void cprover_cpp_library_factory( const std::set &functions, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { if(config.ansi_c.lib == configt::ansi_ct::libt::LIB_NONE) diff --git a/src/cpp/cprover_library.h b/src/cpp/cprover_library.h index 9f08436a2fe..54a5661aec5 100644 --- a/src/cpp/cprover_library.h +++ b/src/cpp/cprover_library.h @@ -14,11 +14,11 @@ Author: Michael Tautschnig #include class message_handlert; -class symbol_tablet; +class symbol_table_baset; void cprover_cpp_library_factory( const std::set &functions, - symbol_tablet &, + symbol_table_baset &, message_handlert &); #endif // CPROVER_CPP_CPROVER_LIBRARY_H diff --git a/src/cpp/template_map.cpp b/src/cpp/template_map.cpp index 82152a749ac..566db7156eb 100644 --- a/src/cpp/template_map.cpp +++ b/src/cpp/template_map.cpp @@ -11,8 +11,8 @@ Author: Daniel Kroening, kroening@cs.cmu.edu #include "template_map.h" -#include #include +#include #include #include "cpp_template_parameter.h" diff --git a/src/cprover/address_taken.h b/src/cprover/address_taken.h index f6f24d7a2e9..fbd51693d6c 100644 --- a/src/cprover/address_taken.h +++ b/src/cprover/address_taken.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_ADDRESS_TAKEN_H #define CPROVER_CPROVER_ADDRESS_TAKEN_H -#include +#include // IWYU pragma: keep #include diff --git a/src/cprover/axioms.cpp b/src/cprover/axioms.cpp index 474e4756030..ee3bdc7e3dd 100644 --- a/src/cprover/axioms.cpp +++ b/src/cprover/axioms.cpp @@ -12,17 +12,17 @@ Author: Daniel Kroening, dkr@amazon.com #include "axioms.h" #include -#include #include #include #include #include #include #include -#include #include #include +#include + #include "simplify_state_expr.h" #include diff --git a/src/cprover/axioms.h b/src/cprover/axioms.h index d3f804cd7dc..99bf225560d 100644 --- a/src/cprover/axioms.h +++ b/src/cprover/axioms.h @@ -12,9 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_AXIOMS_H #define CPROVER_CPROVER_AXIOMS_H -#include - -#include +#include // IWYU pragma: keep #include "sentinel_dll.h" #include "state.h" @@ -25,6 +23,8 @@ Author: Daniel Kroening, dkr@amazon.com #include #include +class decision_proceduret; + class axiomst { public: diff --git a/src/cprover/c_safety_checks.cpp b/src/cprover/c_safety_checks.cpp index fbc6ee5084a..7288d7fa594 100644 --- a/src/cprover/c_safety_checks.cpp +++ b/src/cprover/c_safety_checks.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, dkr@amazon.com #include #include -#include #include #include #include diff --git a/src/cprover/counterexample_found.cpp b/src/cprover/counterexample_found.cpp index fdf622056a4..ff488f82f6a 100644 --- a/src/cprover/counterexample_found.cpp +++ b/src/cprover/counterexample_found.cpp @@ -12,7 +12,6 @@ Author: Daniel Kroening, dkr@amazon.com #include "counterexample_found.h" #include -#include #include #include @@ -22,8 +21,6 @@ Author: Daniel Kroening, dkr@amazon.com #include "simplify_state_expr.h" #include "state.h" -#include - void show_assignment(const bv_pointers_widet &solver) { #if 0 diff --git a/src/cprover/cprover_main.cpp b/src/cprover/cprover_main.cpp index 3265987a7b2..89a2fe4c7a2 100644 --- a/src/cprover/cprover_main.cpp +++ b/src/cprover/cprover_main.cpp @@ -9,11 +9,11 @@ Author: Daniel Kroening, dkr@amazon.com /// \file /// cprover Main Module -#include - #include "cprover_parse_options.h" #ifdef _MSC_VER +# include + # include #endif diff --git a/src/cprover/cprover_parse_options.cpp b/src/cprover/cprover_parse_options.cpp index 70272772e23..feb0b811033 100644 --- a/src/cprover/cprover_parse_options.cpp +++ b/src/cprover/cprover_parse_options.cpp @@ -16,18 +16,21 @@ Author: Daniel Kroening, dkr@amazon.com #include #include #include +#include #include #include -#include #include +#ifdef _WIN32 +# include +#endif + #include #include #include #include #include #include -#include #include #include @@ -40,7 +43,7 @@ Author: Daniel Kroening, dkr@amazon.com #include "instrument_given_invariants.h" #include "state_encoding.h" -#include +#include // IWYU pragma: keep #include static void show_goto_functions(const goto_modelt &goto_model) diff --git a/src/cprover/cprover_parse_options.h b/src/cprover/cprover_parse_options.h index 0627241a952..3204b20ef6b 100644 --- a/src/cprover/cprover_parse_options.h +++ b/src/cprover/cprover_parse_options.h @@ -12,8 +12,6 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_CPROVER_PARSE_OPTIONS_H #define CPROVER_CPROVER_CPROVER_PARSE_OPTIONS_H -#include - #define CPROVER_OPTIONS \ "(help)?h(version)" \ "(smt2)(text)(outfile):" \ diff --git a/src/cprover/equality_propagation.h b/src/cprover/equality_propagation.h index 641cb097299..91c0aeffd12 100644 --- a/src/cprover/equality_propagation.h +++ b/src/cprover/equality_propagation.h @@ -12,7 +12,9 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_EQUALITY_PROPAGATION_H #define CPROVER_CPROVER_EQUALITY_PROPAGATION_H -#include +#include + +class exprt; void equality_propagation(std::vector &); diff --git a/src/cprover/find_variables.cpp b/src/cprover/find_variables.cpp index aa983983523..aa6d2540b00 100644 --- a/src/cprover/find_variables.cpp +++ b/src/cprover/find_variables.cpp @@ -13,8 +13,6 @@ Author: Daniel Kroening, dkr@amazon.com #include -#include "state.h" - static void find_variables_rec( const exprt &src, std::unordered_set &result) diff --git a/src/cprover/find_variables.h b/src/cprover/find_variables.h index b81c3ba5bc6..ec7f94903fa 100644 --- a/src/cprover/find_variables.h +++ b/src/cprover/find_variables.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_FIND_VARIABLES_H #define CPROVER_CPROVER_FIND_VARIABLES_H -#include +#include // IWYU pragma: keep #include diff --git a/src/cprover/flatten_ok_expr.cpp b/src/cprover/flatten_ok_expr.cpp index 9ae4673549a..187c2e27109 100644 --- a/src/cprover/flatten_ok_expr.cpp +++ b/src/cprover/flatten_ok_expr.cpp @@ -10,6 +10,8 @@ Author: Daniel Kroening, dkr@amazon.com #include +#include "state.h" + exprt flatten(const state_ok_exprt &ok_expr) { const auto &state = ok_expr.state(); diff --git a/src/cprover/flatten_ok_expr.h b/src/cprover/flatten_ok_expr.h index 258e47aa2e3..5a4432a1885 100644 --- a/src/cprover/flatten_ok_expr.h +++ b/src/cprover/flatten_ok_expr.h @@ -9,7 +9,8 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_FLATTEN_OK_EXPR_H #define CPROVER_CPROVER_FLATTEN_OK_EXPR_H -#include "state.h" +class exprt; +class state_ok_exprt; // X_ok(p, s) <--> // live_object(p) diff --git a/src/cprover/free_symbols.cpp b/src/cprover/free_symbols.cpp index b20d0a75092..bba22370427 100644 --- a/src/cprover/free_symbols.cpp +++ b/src/cprover/free_symbols.cpp @@ -11,6 +11,8 @@ Author: Daniel Kroening, dkr@amazon.com #include "free_symbols.h" +#include + #include static void free_symbols_rec( diff --git a/src/cprover/free_symbols.h b/src/cprover/free_symbols.h index b33f76a1d75..f8d421b6120 100644 --- a/src/cprover/free_symbols.h +++ b/src/cprover/free_symbols.h @@ -12,10 +12,11 @@ Author: Daniel Kroening, dkr@amazon.com /// \file /// Free Symbols -#include - #include +class exprt; +class symbol_exprt; + void free_symbols( const exprt &, const std::function &); diff --git a/src/cprover/generalization.h b/src/cprover/generalization.h index 57434421350..bab28e6d073 100644 --- a/src/cprover/generalization.h +++ b/src/cprover/generalization.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_GENERALIZATION_H #define CPROVER_CPROVER_GENERALIZATION_H -#include "solver_types.h" +#include "solver_types.h" // IWYU pragma: keep class solver_optionst; diff --git a/src/cprover/inductiveness.cpp b/src/cprover/inductiveness.cpp index 42424eb5b1d..b7975765127 100644 --- a/src/cprover/inductiveness.cpp +++ b/src/cprover/inductiveness.cpp @@ -11,11 +11,9 @@ Author: Daniel Kroening, dkr@amazon.com #include "inductiveness.h" -#include #include #include #include -#include #include diff --git a/src/cprover/instrument_contracts.cpp b/src/cprover/instrument_contracts.cpp index 1c546e31d65..1c09c7b4d80 100644 --- a/src/cprover/instrument_contracts.cpp +++ b/src/cprover/instrument_contracts.cpp @@ -12,7 +12,6 @@ Author: Daniel Kroening, dkr@amazon.com #include "instrument_contracts.h" #include -#include #include #include #include @@ -23,8 +22,6 @@ Author: Daniel Kroening, dkr@amazon.com #include -#include - #define MAX_TEXT 20 optionalt diff --git a/src/cprover/may_alias.cpp b/src/cprover/may_alias.cpp index 9dc02a0621e..2dd005535f8 100644 --- a/src/cprover/may_alias.cpp +++ b/src/cprover/may_alias.cpp @@ -12,16 +12,12 @@ Author: Daniel Kroening, dkr@amazon.com #include "may_alias.h" #include -#include -#include #include #include #include #include #include -#include - bool permitted_by_strict_aliasing(const typet &a, const typet &b) { // C99; ISO/IEC 9899:1999 6.5/7 diff --git a/src/cprover/may_alias.h b/src/cprover/may_alias.h index 7c42bb01f55..feeee1c89c0 100644 --- a/src/cprover/may_alias.h +++ b/src/cprover/may_alias.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_MAY_ALIAS_H #define CPROVER_CPROVER_MAY_ALIAS_H -#include +#include // IWYU pragma: keep #include diff --git a/src/cprover/may_be_same_object.h b/src/cprover/may_be_same_object.h index 54e6c8d4bd8..dde2ad513de 100644 --- a/src/cprover/may_be_same_object.h +++ b/src/cprover/may_be_same_object.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_MAY_BE_SAME_OBJECT_H #define CPROVER_CPROVER_MAY_BE_SAME_OBJECT_H -#include +#include // IWYU pragma: keep #include diff --git a/src/cprover/report_properties.cpp b/src/cprover/report_properties.cpp index 5fc8070bab1..e91855aeea1 100644 --- a/src/cprover/report_properties.cpp +++ b/src/cprover/report_properties.cpp @@ -12,9 +12,6 @@ Author: Daniel Kroening, dkr@amazon.com #include "report_properties.h" #include -#include - -#include void report_properties(const std::vector &properties) { diff --git a/src/cprover/report_properties.h b/src/cprover/report_properties.h index 8cf7d3abe54..9ccf596f8b6 100644 --- a/src/cprover/report_properties.h +++ b/src/cprover/report_properties.h @@ -13,7 +13,7 @@ Author: Daniel Kroening, dkr@amazon.com #define CPROVER_CPROVER_REPORT_PROPERTIES_H #include "solver.h" -#include "solver_types.h" +#include "solver_types.h" // IWYU pragma: keep void report_properties(const std::vector &); diff --git a/src/cprover/report_traces.cpp b/src/cprover/report_traces.cpp index f474156e505..9a96fd648dc 100644 --- a/src/cprover/report_traces.cpp +++ b/src/cprover/report_traces.cpp @@ -13,8 +13,7 @@ Author: Daniel Kroening, dkr@amazon.com #include #include - -#include "state.h" +#include #include diff --git a/src/cprover/report_traces.h b/src/cprover/report_traces.h index 163422273bb..81d4245ae7c 100644 --- a/src/cprover/report_traces.h +++ b/src/cprover/report_traces.h @@ -12,7 +12,7 @@ Author: Daniel Kroening #ifndef CPROVER_CPROVER_REPORT_TRACES_H #define CPROVER_CPROVER_REPORT_TRACES_H -#include "solver_types.h" +#include "solver_types.h" // IWYU pragma: keep void report_traces( const std::vector &frames, diff --git a/src/cprover/simplify_state_expr.cpp b/src/cprover/simplify_state_expr.cpp index dac7612ecf7..83087501dba 100644 --- a/src/cprover/simplify_state_expr.cpp +++ b/src/cprover/simplify_state_expr.cpp @@ -12,12 +12,8 @@ Author: Daniel Kroening, dkr@amazon.com #include "simplify_state_expr.h" #include -#include #include #include -#include -#include -#include #include #include #include @@ -31,8 +27,6 @@ Author: Daniel Kroening, dkr@amazon.com #include "sentinel_dll.h" #include "state.h" -#include - std::size_t allocate_counter = 0; exprt simplify_state_expr_node( diff --git a/src/cprover/simplify_state_expr.h b/src/cprover/simplify_state_expr.h index e1071ce53e1..9dd6629bd46 100644 --- a/src/cprover/simplify_state_expr.h +++ b/src/cprover/simplify_state_expr.h @@ -12,11 +12,12 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_SIMPLIFY_STATE_EXPR_H #define CPROVER_CPROVER_SIMPLIFY_STATE_EXPR_H -#include -#include +#include // IWYU pragma: keep #include +class namespacet; + exprt simplify_state_expr( exprt, const std::unordered_set &address_taken, diff --git a/src/cprover/solver.cpp b/src/cprover/solver.cpp index 30939658f9a..1237443e3d2 100644 --- a/src/cprover/solver.cpp +++ b/src/cprover/solver.cpp @@ -11,26 +11,17 @@ Author: Daniel Kroening, dkr@amazon.com #include "solver.h" -#include -#include #include -#include #include "address_taken.h" -#include "counterexample_found.h" #include "generalization.h" #include "inductiveness.h" -#include "propagate.h" #include "report_properties.h" #include "report_traces.h" #include "solver_progress.h" #include "solver_types.h" -#include "state.h" -#include #include -#include -#include class take_time_resourcet { diff --git a/src/cprover/solver.h b/src/cprover/solver.h index 707987aa288..7d6f6460512 100644 --- a/src/cprover/solver.h +++ b/src/cprover/solver.h @@ -12,7 +12,10 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_SOLVER_H #define CPROVER_CPROVER_SOLVER_H -#include +#include + +class exprt; +class namespacet; enum class solver_resultt { diff --git a/src/cprover/solver_progress.h b/src/cprover/solver_progress.h index 859349b0c32..c5438a70b69 100644 --- a/src/cprover/solver_progress.h +++ b/src/cprover/solver_progress.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_SOLVER_PROGRESS_H #define CPROVER_CPROVER_SOLVER_PROGRESS_H -#include "solver_types.h" +#include class solver_progresst { diff --git a/src/cprover/state.cpp b/src/cprover/state.cpp index b1690af04c3..386bbaad7f2 100644 --- a/src/cprover/state.cpp +++ b/src/cprover/state.cpp @@ -7,5 +7,3 @@ Author: Daniel Kroening, dkr@amazon.com \*******************************************************************/ #include "state.h" - -#include diff --git a/src/cprover/state.h b/src/cprover/state.h index 81bb693a7ff..ffddf35b2df 100644 --- a/src/cprover/state.h +++ b/src/cprover/state.h @@ -9,7 +9,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_STATE_H #define CPROVER_CPROVER_STATE_H -#include +#include #include class state_typet : public typet diff --git a/src/cprover/state_encoding.cpp b/src/cprover/state_encoding.cpp index 32ba13c5f41..667a43c2f0b 100644 --- a/src/cprover/state_encoding.cpp +++ b/src/cprover/state_encoding.cpp @@ -10,7 +10,6 @@ Author: Daniel Kroening, dkr@amazon.com #include #include -#include #include #include #include diff --git a/src/cprover/state_encoding.h b/src/cprover/state_encoding.h index 89b082f1201..96ce2ba0742 100644 --- a/src/cprover/state_encoding.h +++ b/src/cprover/state_encoding.h @@ -12,6 +12,9 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_STATE_ENCODING_H #define CPROVER_CPROVER_STATE_ENCODING_H +#include +#include + #include "solver.h" #include diff --git a/src/cprover/variable_encoding.h b/src/cprover/variable_encoding.h index 9e7d7ba14d4..5a32728032a 100644 --- a/src/cprover/variable_encoding.h +++ b/src/cprover/variable_encoding.h @@ -12,7 +12,9 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CPROVER_VARIABLE_ENCODING_H #define CPROVER_CPROVER_VARIABLE_ENCODING_H -#include +#include + +class exprt; void variable_encoding(std::vector &); diff --git a/src/crangler/c_wrangler.cpp b/src/crangler/c_wrangler.cpp index 8109611bb8d..7d716b745a4 100644 --- a/src/crangler/c_wrangler.cpp +++ b/src/crangler/c_wrangler.cpp @@ -11,27 +11,21 @@ Author: Daniel Kroening, dkr@amazon.com #include "c_wrangler.h" -#include "c_defines.h" -#include "ctokenit.h" -#include "mini_c_parser.h" - #include #include -#include #include -#include -#include #include #include -#include -#include -#include +#include "c_defines.h" +#include "ctokenit.h" +#include "mini_c_parser.h" + +#include // IWYU pragma: keep #include #include #include #include -#include struct c_wranglert { diff --git a/src/crangler/ctokenit.h b/src/crangler/ctokenit.h index 9eaab0d72f0..a82335f25db 100644 --- a/src/crangler/ctokenit.h +++ b/src/crangler/ctokenit.h @@ -12,7 +12,9 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CRANGLER_CTOKENIT_H #define CPROVER_CRANGLER_CTOKENIT_H -#include "cscanner.h" +#include "ctoken.h" + +#include class ctokenitt { diff --git a/src/crangler/mini_c_parser.h b/src/crangler/mini_c_parser.h index d543fabd0c8..ab3930aae33 100644 --- a/src/crangler/mini_c_parser.h +++ b/src/crangler/mini_c_parser.h @@ -12,13 +12,13 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_CRANGLER_MINI_C_PARSER_H #define CPROVER_CRANGLER_MINI_C_PARSER_H -#include "cscanner.h" +#include + +#include "ctoken.h" #include #include -#include - struct c_declarationt { // could be C++20 std::span to avoid copying diff --git a/src/crangler/scanner.l b/src/crangler/scanner.l index 19e4f377b4d..a8613c9f9e8 100644 --- a/src/crangler/scanner.l +++ b/src/crangler/scanner.l @@ -62,13 +62,11 @@ static int isatty(int) { return 0; } #pragma warning(disable:4005) #endif -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep -#include #include -#include #include "cscanner.h" diff --git a/src/goto-analyzer/build_analyzer.cpp b/src/goto-analyzer/build_analyzer.cpp index 194a91eeed5..9d9e44e318a 100644 --- a/src/goto-analyzer/build_analyzer.cpp +++ b/src/goto-analyzer/build_analyzer.cpp @@ -22,7 +22,6 @@ Author: Martin Brain, martin.brain@cs.ox.ac.uk #include -#include #include /// Ideally this should be a pure function of options. diff --git a/src/goto-analyzer/goto_analyzer_parse_options.cpp b/src/goto-analyzer/goto_analyzer_parse_options.cpp index 9d76e8b93dd..b4535bc2366 100644 --- a/src/goto-analyzer/goto_analyzer_parse_options.cpp +++ b/src/goto-analyzer/goto_analyzer_parse_options.cpp @@ -20,7 +20,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include #include @@ -41,7 +40,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "unreachable_instructions.h" #include // exit() -#include +#include // IWYU pragma: keep #include #include diff --git a/src/goto-analyzer/taint_analysis.cpp b/src/goto-analyzer/taint_analysis.cpp index f09c2f8891e..45dd7b243df 100644 --- a/src/goto-analyzer/taint_analysis.cpp +++ b/src/goto-analyzer/taint_analysis.cpp @@ -11,9 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "taint_analysis.h" -#include -#include - #include #include #include @@ -29,6 +26,9 @@ Author: Daniel Kroening, kroening@kroening.com #include "taint_parser.h" +#include // IWYU pragma: keep +#include + class taint_analysist { public: diff --git a/src/goto-cc/armcc_cmdline.cpp b/src/goto-cc/armcc_cmdline.cpp index 9f70e3d8fda..b5c2cae696a 100644 --- a/src/goto-cc/armcc_cmdline.cpp +++ b/src/goto-cc/armcc_cmdline.cpp @@ -11,7 +11,6 @@ Author: Daniel Kroening #include "armcc_cmdline.h" -#include #include #include diff --git a/src/goto-cc/as_mode.cpp b/src/goto-cc/as_mode.cpp index 4087309e4ed..d42bab7d35f 100644 --- a/src/goto-cc/as_mode.cpp +++ b/src/goto-cc/as_mode.cpp @@ -19,9 +19,6 @@ Author: Michael Tautschnig #include #endif -#include -#include - #include #include #include @@ -34,6 +31,9 @@ Author: Michael Tautschnig #include "goto_cc_cmdline.h" #include "hybrid_binary.h" +#include // IWYU pragma: keep +#include + static std::string assembler_name( const cmdlinet &cmdline, const std::string &base_name) diff --git a/src/goto-cc/gcc_cmdline.cpp b/src/goto-cc/gcc_cmdline.cpp index ded3c6f03b3..ffe2b3ad961 100644 --- a/src/goto-cc/gcc_cmdline.cpp +++ b/src/goto-cc/gcc_cmdline.cpp @@ -11,12 +11,12 @@ Author: CM Wintersteiger, 2006 #include "gcc_cmdline.h" +#include + #include -#include +#include // IWYU pragma: keep #include -#include - -#include +#include // IWYU pragma: keep // clang-format off // non-gcc options diff --git a/src/goto-cc/gcc_message_handler.cpp b/src/goto-cc/gcc_message_handler.cpp index 53e7a4e00e4..3009f2d55c3 100644 --- a/src/goto-cc/gcc_message_handler.cpp +++ b/src/goto-cc/gcc_message_handler.cpp @@ -12,7 +12,7 @@ Author: Daniel Kroening, kroening@kroening.com # include #endif -#include +#include // IWYU pragma: keep #include void gcc_message_handlert::print( diff --git a/src/goto-cc/gcc_mode.cpp b/src/goto-cc/gcc_mode.cpp index cfeefb9ba9a..55c3d973504 100644 --- a/src/goto-cc/gcc_mode.cpp +++ b/src/goto-cc/gcc_mode.cpp @@ -19,10 +19,6 @@ Author: CM Wintersteiger, 2006 #include #endif -#include -#include -#include - #include #include #include @@ -39,6 +35,10 @@ Author: CM Wintersteiger, 2006 #include "hybrid_binary.h" #include "linker_script_merge.h" +#include // IWYU pragma: keep +#include +#include + static std::string compiler_name( const cmdlinet &cmdline, const std::string &base_name) diff --git a/src/goto-cc/linker_script_merge.cpp b/src/goto-cc/linker_script_merge.cpp index ea1b9dcf29c..102ce688d3c 100644 --- a/src/goto-cc/linker_script_merge.cpp +++ b/src/goto-cc/linker_script_merge.cpp @@ -8,10 +8,6 @@ Author: Kareem Khazem , 2017 #include "linker_script_merge.h" -#include -#include -#include - #include #include #include @@ -21,16 +17,19 @@ Author: Kareem Khazem , 2017 #include #include -#include - -#include - #include #include #include +#include +#include + #include "compile.h" +#include +#include // IWYU pragma: keep +#include + int linker_script_merget::add_linker_script_definitions() { if(!cmdline.isset('T')) diff --git a/src/goto-cc/linker_script_merge.h b/src/goto-cc/linker_script_merge.h index 4ff7fb99e7a..b6fcd26ae74 100644 --- a/src/goto-cc/linker_script_merge.h +++ b/src/goto-cc/linker_script_merge.h @@ -11,10 +11,9 @@ #include class cmdlinet; -class exprt; +class exprt; // IWYU pragma: keep class goto_modelt; -class goto_programt; -class symbol_exprt; +class symbol_exprt; // IWYU pragma: keep class symbol_tablet; /// \brief Patterns of expressions that should be replaced diff --git a/src/goto-cc/ms_cl_cmdline.cpp b/src/goto-cc/ms_cl_cmdline.cpp index 82d44ab4453..fd43edccb85 100644 --- a/src/goto-cc/ms_cl_cmdline.cpp +++ b/src/goto-cc/ms_cl_cmdline.cpp @@ -11,13 +11,13 @@ Author: Daniel Kroening #include "ms_cl_cmdline.h" +#include + #include #include -#include +#include // IWYU pragma: keep #include -#include - /// parses the command line options into a cmdlinet /// \par parameters: argument count, argument strings /// \return none diff --git a/src/goto-cc/ms_link_cmdline.cpp b/src/goto-cc/ms_link_cmdline.cpp index 39c07b57f25..5e63c9b13d1 100644 --- a/src/goto-cc/ms_link_cmdline.cpp +++ b/src/goto-cc/ms_link_cmdline.cpp @@ -11,11 +11,11 @@ Author: Daniel Kroening #include "ms_link_cmdline.h" -#include -#include - #include +#include // IWYU pragma: keep +#include + /// parses the command line options into a cmdlinet /// \par parameters: argument count, argument strings /// \return none diff --git a/src/goto-checker/goto_symex_property_decider.cpp b/src/goto-checker/goto_symex_property_decider.cpp index 7fc4fb40542..72546be3e74 100644 --- a/src/goto-checker/goto_symex_property_decider.cpp +++ b/src/goto-checker/goto_symex_property_decider.cpp @@ -13,7 +13,7 @@ Author: Daniel Kroening, Peter Schrammel #include -#include +#include // IWYU pragma: keep goto_symex_property_decidert::goto_symex_property_decidert( const optionst &options, diff --git a/src/goto-checker/module_dependencies.txt b/src/goto-checker/module_dependencies.txt index 0bf6e908cda..7353beb62f8 100644 --- a/src/goto-checker/module_dependencies.txt +++ b/src/goto-checker/module_dependencies.txt @@ -3,6 +3,7 @@ goto-checker goto-instrument goto-programs goto-symex +langapi linking solvers util diff --git a/src/goto-checker/solver_factory.h b/src/goto-checker/solver_factory.h index 0e1a1b73259..5fac3013cad 100644 --- a/src/goto-checker/solver_factory.h +++ b/src/goto-checker/solver_factory.h @@ -12,16 +12,15 @@ Author: Daniel Kroening, Peter Schrammel #ifndef CPROVER_GOTO_CHECKER_SOLVER_FACTORY_H #define CPROVER_GOTO_CHECKER_SOLVER_FACTORY_H -#include - +#include #include +#include + class cmdlinet; class message_handlert; class namespacet; class optionst; -class propt; -class decision_proceduret; class stack_decision_proceduret; class solver_factoryt final diff --git a/src/goto-checker/symex_coverage.cpp b/src/goto-checker/symex_coverage.cpp index 4dd4acdf68e..cd6f3552b95 100644 --- a/src/goto-checker/symex_coverage.cpp +++ b/src/goto-checker/symex_coverage.cpp @@ -13,21 +13,21 @@ Date: March 2016 #include "symex_coverage.h" -#include -#include -#include -#include - +#include #include #include #include -#include - #include +#include #include +#include +#include +#include // IWYU pragma: keep +#include + class coverage_recordt { public: diff --git a/src/goto-diff/goto_diff_parse_options.cpp b/src/goto-diff/goto_diff_parse_options.cpp index 3dcc59b7eaa..52c3f984f2f 100644 --- a/src/goto-diff/goto_diff_parse_options.cpp +++ b/src/goto-diff/goto_diff_parse_options.cpp @@ -35,7 +35,7 @@ Author: Peter Schrammel #include "unified_diff.h" #include // exit() -#include +#include // IWYU pragma: keep #include goto_diff_parse_optionst::goto_diff_parse_optionst(int argc, const char **argv) diff --git a/src/goto-harness/goto_harness_generator_factory.h b/src/goto-harness/goto_harness_generator_factory.h index ec78cb023fa..1b048c3f49c 100644 --- a/src/goto-harness/goto_harness_generator_factory.h +++ b/src/goto-harness/goto_harness_generator_factory.h @@ -15,7 +15,7 @@ Author: Diffblue Ltd. #include #include -class goto_harness_generatort; +class goto_harness_generatort; // IWYU pragma: keep class goto_modelt; #define GOTO_HARNESS_GENERATOR_TYPE_OPT "harness-type" diff --git a/src/goto-harness/memory_snapshot_harness_generator.cpp b/src/goto-harness/memory_snapshot_harness_generator.cpp index fe55bfc5c27..3c7105eca09 100644 --- a/src/goto-harness/memory_snapshot_harness_generator.cpp +++ b/src/goto-harness/memory_snapshot_harness_generator.cpp @@ -6,16 +6,7 @@ Author: Daniel Poetzl \******************************************************************/ -#include - #include "memory_snapshot_harness_generator.h" -#include "memory_snapshot_harness_generator_options.h" - -#include - -#include - -#include #include #include @@ -25,6 +16,16 @@ Author: Daniel Poetzl #include #include +#include +#include + +#include +#include + +#include "memory_snapshot_harness_generator_options.h" + +#include + void memory_snapshot_harness_generatort::handle_option( const std::string &option, const std::list &values) @@ -134,7 +135,7 @@ void memory_snapshot_harness_generatort::validate_options( goto_model.goto_functions); } - const symbol_tablet &symbol_table = goto_model.symbol_table; + const symbol_table_baset &symbol_table = goto_model.symbol_table; const symbolt *called_function_symbol = symbol_table.lookup(entry_location.function_name); @@ -181,7 +182,7 @@ void memory_snapshot_harness_generatort::add_init_section( const symbolt &memory_snapshot_harness_generatort::fresh_symbol_copy( const symbolt &snapshot_symbol, - symbol_tablet &symbol_table) const + symbol_table_baset &symbol_table) const { symbolt &tmp_symbol = get_fresh_aux_symbol( snapshot_symbol.type, @@ -205,7 +206,7 @@ size_t memory_snapshot_harness_generatort::pointer_depth(const typet &t) const } code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals( - const symbol_tablet &snapshot, + const symbol_table_baset &snapshot, goto_modelt &goto_model) const { recursive_initializationt recursive_initialization{ @@ -254,7 +255,7 @@ code_blockt memory_snapshot_harness_generatort::add_assignments_to_globals( for(const auto &pair : ordered_snapshot_symbols) { const symbolt &snapshot_symbol = pair.second; - symbol_tablet &symbol_table = goto_model.symbol_table; + symbol_table_baset &symbol_table = goto_model.symbol_table; auto should_get_fresh = [&symbol_table](const symbolt &symbol) { return symbol_table.lookup(symbol.base_name) == nullptr && @@ -325,7 +326,7 @@ void memory_snapshot_harness_generatort:: void memory_snapshot_harness_generatort::get_memory_snapshot( const std::string &file, - symbol_tablet &snapshot) const + symbol_table_baset &snapshot) const { jsont json; diff --git a/src/goto-harness/memory_snapshot_harness_generator.h b/src/goto-harness/memory_snapshot_harness_generator.h index 3d5c9cf5075..ccfd3d7abf2 100644 --- a/src/goto-harness/memory_snapshot_harness_generator.h +++ b/src/goto-harness/memory_snapshot_harness_generator.h @@ -9,16 +9,19 @@ Author: Daniel Poetzl #ifndef CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_H #define CPROVER_GOTO_HARNESS_MEMORY_SNAPSHOT_HARNESS_GENERATOR_H -#include -#include +#include + +#include #include "goto_harness_generator.h" #include "recursive_initialization.h" -#include +#include +#include -#include -#include +class goto_functionst; +class message_handlert; +class symbol_table_baset; /// Generates a harness which first assigns global variables with values from /// a given memory snapshot and then calls a specified function. The called @@ -193,8 +196,9 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort /// Parse the snapshot JSON file and initialise the symbol table /// \param file: the snapshot JSON file /// \param snapshot: the resulting symbol table built from the snapshot - void - get_memory_snapshot(const std::string &file, symbol_tablet &snapshot) const; + void get_memory_snapshot( + const std::string &file, + symbol_table_baset &snapshot) const; /// Modify the entry-point function to start from the user-specified initial /// location. @@ -237,7 +241,7 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort /// \return the new symbol const symbolt &fresh_symbol_copy( const symbolt &snapshot_symbol, - symbol_tablet &symbol_table) const; + symbol_table_baset &symbol_table) const; /// For each global symbol in the \p snapshot symbol table either: /// 1) add \ref code_assignt assigning a value from the \p snapshot to the @@ -251,7 +255,7 @@ class memory_snapshot_harness_generatort : public goto_harness_generatort /// \param goto_model: model to initialise the havoc-ing /// \return the block of code where the assignments are added code_blockt add_assignments_to_globals( - const symbol_tablet &snapshot, + const symbol_table_baset &snapshot, goto_modelt &goto_model) const; /// Create as many non-deterministic arguments as there are arguments of the diff --git a/src/goto-instrument/accelerate/acceleration_utils.cpp b/src/goto-instrument/accelerate/acceleration_utils.cpp index 0cba44da764..4e259682646 100644 --- a/src/goto-instrument/accelerate/acceleration_utils.cpp +++ b/src/goto-instrument/accelerate/acceleration_utils.cpp @@ -15,13 +15,11 @@ Author: Matt Lewis #include #include #include -#include #include #include -#include #include #include #include diff --git a/src/goto-instrument/accelerate/acceleration_utils.h b/src/goto-instrument/accelerate/acceleration_utils.h index 3ff11d41baf..f20a1017e09 100644 --- a/src/goto-instrument/accelerate/acceleration_utils.h +++ b/src/goto-instrument/accelerate/acceleration_utils.h @@ -16,8 +16,6 @@ Author: Matt Lewis #include #include -#include - #include #include @@ -40,7 +38,7 @@ class acceleration_utilst public: acceleration_utilst( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, message_handlert &message_handler, const goto_functionst &_goto_functions, exprt &_loop_counter) @@ -53,7 +51,7 @@ class acceleration_utilst } acceleration_utilst( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, message_handlert &message_handler, const goto_functionst &_goto_functions) : message_handler(message_handler), @@ -154,7 +152,7 @@ class acceleration_utilst symbolt fresh_symbol(std::string base, typet type); - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; namespacet ns; const goto_functionst &goto_functions; exprt &loop_counter; diff --git a/src/goto-instrument/accelerate/cone_of_influence.h b/src/goto-instrument/accelerate/cone_of_influence.h index 2c39e2fbe19..e8b5edd0acb 100644 --- a/src/goto-instrument/accelerate/cone_of_influence.h +++ b/src/goto-instrument/accelerate/cone_of_influence.h @@ -12,9 +12,9 @@ Author: Matt Lewis #ifndef CPROVER_GOTO_INSTRUMENT_ACCELERATE_CONE_OF_INFLUENCE_H #define CPROVER_GOTO_INSTRUMENT_ACCELERATE_CONE_OF_INFLUENCE_H -#include +#include -#include +#include #include @@ -26,23 +26,25 @@ void cone_of_influence(goto_programt &program, class cone_of_influencet { - public: - cone_of_influencet(const goto_programt &_program, - const symbol_tablet &symbol_table) : - program(_program), - ns(symbol_table) +public: + cone_of_influencet( + const goto_programt &_program, + const symbol_table_baset &symbol_table) + : program(_program), ns(symbol_table) { } void cone_of_influence(const expr_sett &targets, expr_sett &cone); void cone_of_influence(const exprt &target, expr_sett &cone); - protected: - void cone_of_influence(const goto_programt::instructiont &i, - const expr_sett &curr, - expr_sett &next); - void get_succs(goto_programt::instructionst::const_reverse_iterator rit, - expr_sett &targets); +protected: + void cone_of_influence( + const goto_programt::instructiont &i, + const expr_sett &curr, + expr_sett &next); + void get_succs( + goto_programt::instructionst::const_reverse_iterator rit, + expr_sett &targets); void gather_rvalues(const exprt &expr, expr_sett &rvals); typedef std::unordered_map cone_mapt; diff --git a/src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.h b/src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.h index 80d99616bed..56290a09b6a 100644 --- a/src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.h +++ b/src/goto-instrument/accelerate/disjunctive_polynomial_acceleration.h @@ -15,8 +15,6 @@ Author: Matt Lewis #include #include -#include - #include #include @@ -32,7 +30,7 @@ class disjunctive_polynomial_accelerationt public: disjunctive_polynomial_accelerationt( message_handlert &message_handler, - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, goto_functionst &_goto_functions, goto_programt &_goto_program, natural_loops_mutablet::natural_loopt &_loop, @@ -84,7 +82,7 @@ class disjunctive_polynomial_accelerationt bool depends_on_array(const exprt &e, exprt &array); - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; namespacet ns; goto_functionst &goto_functions; goto_programt &goto_program; diff --git a/src/goto-instrument/accelerate/overflow_instrumenter.cpp b/src/goto-instrument/accelerate/overflow_instrumenter.cpp index 4598b91698a..6a4d1a9c4cc 100644 --- a/src/goto-instrument/accelerate/overflow_instrumenter.cpp +++ b/src/goto-instrument/accelerate/overflow_instrumenter.cpp @@ -11,11 +11,8 @@ Author: Matt Lewis #include "overflow_instrumenter.h" -#include - #include #include -#include #include diff --git a/src/goto-instrument/accelerate/overflow_instrumenter.h b/src/goto-instrument/accelerate/overflow_instrumenter.h index cc31127bc17..44c069b2cb7 100644 --- a/src/goto-instrument/accelerate/overflow_instrumenter.h +++ b/src/goto-instrument/accelerate/overflow_instrumenter.h @@ -12,7 +12,6 @@ Author: Matt Lewis #ifndef CPROVER_GOTO_INSTRUMENT_ACCELERATE_OVERFLOW_INSTRUMENTER_H #define CPROVER_GOTO_INSTRUMENT_ACCELERATE_OVERFLOW_INSTRUMENTER_H -#include #include #include @@ -23,37 +22,41 @@ Author: Matt Lewis class overflow_instrumentert { - public: - overflow_instrumentert(goto_programt &_program, - const exprt &_overflow_var, - symbol_tablet &_symbol_table) : - program(_program), - symbol_table(_symbol_table), - overflow_var(_overflow_var), - ns(symbol_table) +public: + overflow_instrumentert( + goto_programt &_program, + const exprt &_overflow_var, + symbol_table_baset &_symbol_table) + : program(_program), + symbol_table(_symbol_table), + overflow_var(_overflow_var), + ns(symbol_table) { } void add_overflow_checks(); void add_overflow_checks(goto_programt::targett t); - void add_overflow_checks( - goto_programt::targett t, - goto_programt::targetst &added); + void + add_overflow_checks(goto_programt::targett t, goto_programt::targetst &added); void overflow_expr(const exprt &expr, expr_sett &cases); void overflow_expr(const exprt &expr, exprt &overflow); - protected: - void add_overflow_checks(goto_programt::targett t, const exprt &expr, - goto_programt::targetst &added); +protected: + void add_overflow_checks( + goto_programt::targett t, + const exprt &expr, + goto_programt::targetst &added); - void accumulate_overflow(goto_programt::targett t, const exprt &expr, - goto_programt::targetst &added); + void accumulate_overflow( + goto_programt::targett t, + const exprt &expr, + goto_programt::targetst &added); void fix_types(binary_exprt &overflow); goto_programt &program; - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; const exprt &overflow_var; namespacet ns; diff --git a/src/goto-instrument/accelerate/polynomial_accelerator.cpp b/src/goto-instrument/accelerate/polynomial_accelerator.cpp index 23edafb48bb..8cc41a0d014 100644 --- a/src/goto-instrument/accelerate/polynomial_accelerator.cpp +++ b/src/goto-instrument/accelerate/polynomial_accelerator.cpp @@ -21,9 +21,7 @@ Author: Matt Lewis #include #include -#include #include -#include #include #include #include diff --git a/src/goto-instrument/accelerate/polynomial_accelerator.h b/src/goto-instrument/accelerate/polynomial_accelerator.h index 763b397aa6c..68c239c1e97 100644 --- a/src/goto-instrument/accelerate/polynomial_accelerator.h +++ b/src/goto-instrument/accelerate/polynomial_accelerator.h @@ -15,8 +15,6 @@ Author: Matt Lewis #include #include -#include - #include #include "polynomial.h" @@ -32,11 +30,11 @@ class polynomial_acceleratort public: polynomial_acceleratort( message_handlert &message_handler, - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goto_functionst &_goto_functions, guard_managert &guard_manager) : message_handler(message_handler), - symbol_table(const_cast(_symbol_table)), + symbol_table(const_cast(_symbol_table)), ns(symbol_table), goto_functions(_goto_functions), guard_manager(guard_manager), @@ -47,12 +45,12 @@ class polynomial_acceleratort polynomial_acceleratort( message_handlert &message_handler, - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goto_functionst &_goto_functions, exprt &_loop_counter, guard_managert &guard_manager) : message_handler(message_handler), - symbol_table(const_cast(_symbol_table)), + symbol_table(const_cast(_symbol_table)), ns(symbol_table), goto_functions(_goto_functions), guard_manager(guard_manager), @@ -149,7 +147,7 @@ class polynomial_acceleratort void ensure_no_overflows(goto_programt &program); - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; const namespacet ns; const goto_functionst &goto_functions; guard_managert &guard_manager; diff --git a/src/goto-instrument/accelerate/sat_path_enumerator.cpp b/src/goto-instrument/accelerate/sat_path_enumerator.cpp index 2af0f685264..d5fca111024 100644 --- a/src/goto-instrument/accelerate/sat_path_enumerator.cpp +++ b/src/goto-instrument/accelerate/sat_path_enumerator.cpp @@ -18,8 +18,6 @@ Author: Matt Lewis #include #include -#include - #include "scratch_program.h" bool sat_path_enumeratort::next(patht &path) diff --git a/src/goto-instrument/accelerate/sat_path_enumerator.h b/src/goto-instrument/accelerate/sat_path_enumerator.h index 99568f61f6d..8aa11ed79cb 100644 --- a/src/goto-instrument/accelerate/sat_path_enumerator.h +++ b/src/goto-instrument/accelerate/sat_path_enumerator.h @@ -14,8 +14,6 @@ Author: Matt Lewis #include -#include - #include #include @@ -30,7 +28,7 @@ class sat_path_enumeratort:public path_enumeratort public: sat_path_enumeratort( message_handlert &message_handler, - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, goto_functionst &_goto_functions, goto_programt &_goto_program, natural_loops_mutablet::natural_loopt &_loop, @@ -61,7 +59,7 @@ class sat_path_enumeratort:public path_enumeratort void record_path(scratch_programt &scratch_program); - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; namespacet ns; goto_functionst &goto_functions; goto_programt &goto_program; diff --git a/src/goto-instrument/accelerate/scratch_program.h b/src/goto-instrument/accelerate/scratch_program.h index 0165b34e9a7..cdc37eca0ef 100644 --- a/src/goto-instrument/accelerate/scratch_program.h +++ b/src/goto-instrument/accelerate/scratch_program.h @@ -36,7 +36,7 @@ struct scratch_program_symext : public goto_symext { scratch_program_symext( message_handlert &mh, - const symbol_tablet &outer_symbol_table, + const symbol_table_baset &outer_symbol_table, symex_target_equationt &_target, const optionst &options, path_storaget &path_storage, @@ -62,7 +62,7 @@ class scratch_programt:public goto_programt { public: scratch_programt( - symbol_tablet &_symbol_table, + symbol_table_baset &_symbol_table, message_handlert &mh, guard_managert &guard_manager) : constant_propagation(true), @@ -104,7 +104,7 @@ class scratch_programt:public goto_programt protected: std::unique_ptr symex_state; goto_functionst functions; - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; symbol_tablet symex_symbol_table; namespacet ns; symex_target_equationt equation; diff --git a/src/goto-instrument/alignment_checks.cpp b/src/goto-instrument/alignment_checks.cpp index 26e84d39fa1..0d5e1a5468d 100644 --- a/src/goto-instrument/alignment_checks.cpp +++ b/src/goto-instrument/alignment_checks.cpp @@ -15,12 +15,12 @@ Module: Alignment Checks #include #include #include -#include +#include #include void print_struct_alignment_problems( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, std::ostream &out) { for(const auto &symbol_pair : symbol_table.symbols) diff --git a/src/goto-instrument/alignment_checks.h b/src/goto-instrument/alignment_checks.h index 4d5f5505548..04d489504d1 100644 --- a/src/goto-instrument/alignment_checks.h +++ b/src/goto-instrument/alignment_checks.h @@ -14,10 +14,10 @@ Module: Alignment Checks #include -class symbol_tablet; +class symbol_table_baset; void print_struct_alignment_problems( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, std::ostream &out); #endif // CPROVER_GOTO_INSTRUMENT_ALIGNMENT_CHECKS_H diff --git a/src/goto-instrument/concurrency.cpp b/src/goto-instrument/concurrency.cpp index f7e25e6ac1f..877b49b3651 100644 --- a/src/goto-instrument/concurrency.cpp +++ b/src/goto-instrument/concurrency.cpp @@ -15,7 +15,6 @@ Date: October 2012 #include #include -#include #include #include diff --git a/src/goto-instrument/contracts/contracts.cpp b/src/goto-instrument/contracts/contracts.cpp index 0f25bfe7b85..5db3567eb3b 100644 --- a/src/goto-instrument/contracts/contracts.cpp +++ b/src/goto-instrument/contracts/contracts.cpp @@ -21,17 +21,13 @@ Date: February 2016 #include #include #include -#include #include -#include -#include #include #include #include #include -#include #include #include #include diff --git a/src/goto-instrument/contracts/contracts.h b/src/goto-instrument/contracts/contracts.h index 2c8f7ddf63d..7372f1600ee 100644 --- a/src/goto-instrument/contracts/contracts.h +++ b/src/goto-instrument/contracts/contracts.h @@ -18,16 +18,12 @@ Date: February 2016 #include #include -#include -#include #include #include -#include #include -#include #include #include #include @@ -48,8 +44,6 @@ Date: February 2016 " --enforce-contract wrap fun with an assertion of its contract\n" class local_may_aliast; -class instrument_spec_assignst; -class cfg_infot; class function_pointer_obeys_contract_exprt; class code_contractst diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_freeable.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_freeable.cpp index 54a3458add5..099935ab0f7 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_freeable.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_freeable.cpp @@ -8,6 +8,7 @@ Date: August 2022 \*******************************************************************/ #include "dfcc_is_freeable.h" +#include #include #include diff --git a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_fresh.cpp b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_fresh.cpp index cabf39696e8..9ce1b7d69df 100644 --- a/src/goto-instrument/contracts/dynamic-frames/dfcc_is_fresh.cpp +++ b/src/goto-instrument/contracts/dynamic-frames/dfcc_is_fresh.cpp @@ -9,6 +9,7 @@ Date: August 2022 #include "dfcc_is_fresh.h" +#include #include #include diff --git a/src/goto-instrument/contracts/havoc_assigns_clause_targets.cpp b/src/goto-instrument/contracts/havoc_assigns_clause_targets.cpp index 1404a6b728b..346fbe6e78f 100644 --- a/src/goto-instrument/contracts/havoc_assigns_clause_targets.cpp +++ b/src/goto-instrument/contracts/havoc_assigns_clause_targets.cpp @@ -12,22 +12,13 @@ Author: Remi Delmas, delmasrd@amazon.com #include "havoc_assigns_clause_targets.h" #include -#include -#include #include #include -#include -#include #include -#include -#include - #include "instrument_spec_assigns.h" #include "utils.h" -#include - void havoc_assigns_clause_targetst::get_instructions(goto_programt &dest) { // snapshotting instructions and well-definedness checks diff --git a/src/goto-instrument/contracts/havoc_assigns_clause_targets.h b/src/goto-instrument/contracts/havoc_assigns_clause_targets.h index 5028b3c315b..dc25bfecda8 100644 --- a/src/goto-instrument/contracts/havoc_assigns_clause_targets.h +++ b/src/goto-instrument/contracts/havoc_assigns_clause_targets.h @@ -13,10 +13,8 @@ Author: Remi Delmas, delmasrd@amazon.com #define CPROVER_GOTO_INSTRUMENT_CONTRACTS_HAVOC_ASSIGNS_CLAUSE_TARGETS_H #include "instrument_spec_assigns.h" -#include -class namespacet; -class symbol_tablet; +class symbol_table_baset; class goto_programt; class goto_functionst; class message_handlert; @@ -59,7 +57,7 @@ class havoc_assigns_clause_targetst : public instrument_spec_assignst const goto_functionst &_functions, cfg_infot &_cfg_info, const source_locationt &_source_location, - symbol_tablet &_st, + symbol_table_baset &_st, message_handlert &_message_handler) : instrument_spec_assignst( _function_id, diff --git a/src/goto-instrument/contracts/inlining_decorator.h b/src/goto-instrument/contracts/inlining_decorator.h index 098e0331b29..932b1240b3d 100644 --- a/src/goto-instrument/contracts/inlining_decorator.h +++ b/src/goto-instrument/contracts/inlining_decorator.h @@ -16,7 +16,6 @@ Date: August 2022 #include #include -#include /// Decorator for a \ref message_handlert used during function inlining that /// collect names of GOTO functions creating warnings and allows to turn diff --git a/src/goto-instrument/contracts/instrument_spec_assigns.cpp b/src/goto-instrument/contracts/instrument_spec_assigns.cpp index 2fc087e3a59..876ec81719b 100644 --- a/src/goto-instrument/contracts/instrument_spec_assigns.cpp +++ b/src/goto-instrument/contracts/instrument_spec_assigns.cpp @@ -13,7 +13,6 @@ Date: January 2022 #include "instrument_spec_assigns.h" -#include #include #include #include @@ -21,6 +20,7 @@ Date: January 2022 #include #include +#include #include #include "cfg_info.h" diff --git a/src/goto-instrument/contracts/instrument_spec_assigns.h b/src/goto-instrument/contracts/instrument_spec_assigns.h index ea91cd0ce99..55ad8cdb368 100644 --- a/src/goto-instrument/contracts/instrument_spec_assigns.h +++ b/src/goto-instrument/contracts/instrument_spec_assigns.h @@ -14,24 +14,20 @@ Date: January 2022 #ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_INSTRUMENT_SPEC_ASSIGNS_H #define CPROVER_GOTO_INSTRUMENT_CONTRACTS_INSTRUMENT_SPEC_ASSIGNS_H +#include #include +#include +#include #include -#include - -#include "utils.h" - -#include #include #include // forward declarations class conditional_target_group_exprt; -class namespacet; -class symbol_tablet; -class symbolt; class cfg_infot; +class goto_functionst; /// Class that represents a single conditional target. class conditional_target_exprt : public exprt @@ -200,7 +196,7 @@ class instrument_spec_assignst const irep_idt &_function_id, const goto_functionst &_functions, cfg_infot &_cfg_info, - symbol_tablet &_st, + symbol_table_baset &_st, message_handlert &_message_handler) : function_id(_function_id), functions(_functions), @@ -483,7 +479,7 @@ class instrument_spec_assignst cfg_infot &cfg_info; /// Program symbol table - symbol_tablet &st; + symbol_table_baset &st; /// Program namespace const namespacet ns; diff --git a/src/goto-instrument/contracts/memory_predicates.cpp b/src/goto-instrument/contracts/memory_predicates.cpp index d8f6c006e44..48bc998d902 100644 --- a/src/goto-instrument/contracts/memory_predicates.cpp +++ b/src/goto-instrument/contracts/memory_predicates.cpp @@ -16,15 +16,14 @@ Date: July 2021 #include #include #include -#include #include #include #include -#include #include +#include "contracts.h" #include "instrument_spec_assigns.h" #include "utils.h" diff --git a/src/goto-instrument/contracts/memory_predicates.h b/src/goto-instrument/contracts/memory_predicates.h index 439ef5470a3..4953f0fb5a3 100644 --- a/src/goto-instrument/contracts/memory_predicates.h +++ b/src/goto-instrument/contracts/memory_predicates.h @@ -14,7 +14,13 @@ Date: July 2021 #ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_MEMORY_PREDICATES_H #define CPROVER_GOTO_INSTRUMENT_CONTRACTS_MEMORY_PREDICATES_H -#include "contracts.h" +#include +#include + +#include + +class code_contractst; +class goto_functionst; class is_fresh_baset { diff --git a/src/goto-instrument/contracts/utils.cpp b/src/goto-instrument/contracts/utils.cpp index 4ab7c80df88..5570a62a194 100644 --- a/src/goto-instrument/contracts/utils.cpp +++ b/src/goto-instrument/contracts/utils.cpp @@ -18,6 +18,7 @@ Date: September 2021 #include #include #include +#include #include @@ -273,7 +274,7 @@ void widen_assigns(assignst &assigns) } void add_quantified_variable( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &expression, const irep_idt &mode) { @@ -345,7 +346,7 @@ void add_quantified_variable( } void replace_history_parameter( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &expr, std::map ¶meter2history, source_locationt location, @@ -422,7 +423,7 @@ void replace_history_parameter( } void generate_history_variables_initialization( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &clause, const irep_idt &mode, goto_programt &program) diff --git a/src/goto-instrument/contracts/utils.h b/src/goto-instrument/contracts/utils.h index d6a10ad259a..99595940b90 100644 --- a/src/goto-instrument/contracts/utils.h +++ b/src/goto-instrument/contracts/utils.h @@ -11,21 +11,11 @@ Date: September 2021 #ifndef CPROVER_GOTO_INSTRUMENT_CONTRACTS_UTILS_H #define CPROVER_GOTO_INSTRUMENT_CONTRACTS_UTILS_H -// clang-format off #include -#include -#include - #include #include -#include - -#include -#include -#include -// clang-format on /// \brief A class that overrides the low-level havocing functions in the base /// utility class, to havoc only when expressions point to valid memory, @@ -192,14 +182,14 @@ void widen_assigns(assignst &assigns); /// a fresh quantified variable is added to the symbol table and \p expression /// is updated to use this fresh variable. void add_quantified_variable( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &expression, const irep_idt &mode); /// This function recursively identifies the "old" expressions within expr /// and replaces them with correspoding history variables. void replace_history_parameter( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &expr, std::map ¶meter2history, source_locationt location, @@ -210,7 +200,7 @@ void replace_history_parameter( /// This function generates all the instructions required to initialize /// history variables. void generate_history_variables_initialization( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, exprt &clause, const irep_idt &mode, goto_programt &program); diff --git a/src/goto-instrument/cover.cpp b/src/goto-instrument/cover.cpp index ee132d0deec..1447191158c 100644 --- a/src/goto-instrument/cover.cpp +++ b/src/goto-instrument/cover.cpp @@ -59,7 +59,7 @@ static void instrument_cover_goals( /// \param goal_filters: goal filters to discard certain goals void cover_instrumenterst::add_from_criterion( coverage_criteriont criterion, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const goal_filterst &goal_filters) { switch(criterion) diff --git a/src/goto-instrument/cover.h b/src/goto-instrument/cover.h index 543e2247d81..84ec1873095 100644 --- a/src/goto-instrument/cover.h +++ b/src/goto-instrument/cover.h @@ -23,6 +23,7 @@ class goto_modelt; class goto_model_functiont; class message_handlert; class optionst; +class symbol_tablet; #define OPT_COVER \ "(cover):" \ diff --git a/src/goto-instrument/cover_basic_blocks.h b/src/goto-instrument/cover_basic_blocks.h index aa7923c0089..838fe28d5ef 100644 --- a/src/goto-instrument/cover_basic_blocks.h +++ b/src/goto-instrument/cover_basic_blocks.h @@ -12,8 +12,6 @@ Author: Daniel Kroening #ifndef CPROVER_GOTO_INSTRUMENT_COVER_BASIC_BLOCKS_H #define CPROVER_GOTO_INSTRUMENT_COVER_BASIC_BLOCKS_H -#include - #include #include diff --git a/src/goto-instrument/cover_filter.h b/src/goto-instrument/cover_filter.h index 623ec088108..c1a479f258e 100644 --- a/src/goto-instrument/cover_filter.h +++ b/src/goto-instrument/cover_filter.h @@ -17,6 +17,8 @@ Author: Daniel Kroening #include +class symbolt; + /// Base class for filtering functions class function_filter_baset { diff --git a/src/goto-instrument/cover_instrument.h b/src/goto-instrument/cover_instrument.h index 0f5bddecb2c..a535987fd91 100644 --- a/src/goto-instrument/cover_instrument.h +++ b/src/goto-instrument/cover_instrument.h @@ -12,12 +12,12 @@ Author: Peter Schrammel #ifndef CPROVER_GOTO_INSTRUMENT_COVER_INSTRUMENT_H #define CPROVER_GOTO_INSTRUMENT_COVER_INSTRUMENT_H -#include - -#include +#include #include +#include + enum class coverage_criteriont; class cover_blocks_baset; class goal_filterst; @@ -28,7 +28,7 @@ class cover_instrumenter_baset public: virtual ~cover_instrumenter_baset() = default; cover_instrumenter_baset( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters, const irep_idt &_coverage_criterion) : coverage_criterion(_coverage_criterion), @@ -104,7 +104,7 @@ class cover_instrumenterst public: void add_from_criterion( coverage_criteriont, - const symbol_tablet &, + const symbol_table_baset &, const goal_filterst &); /// Applies all instrumenters to the given goto program @@ -132,7 +132,7 @@ class cover_location_instrumentert : public cover_instrumenter_baset { public: cover_location_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "location") { @@ -152,7 +152,7 @@ class cover_branch_instrumentert : public cover_instrumenter_baset { public: cover_branch_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "branch") { @@ -172,7 +172,7 @@ class cover_condition_instrumentert : public cover_instrumenter_baset { public: cover_condition_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "condition") { @@ -192,7 +192,7 @@ class cover_decision_instrumentert : public cover_instrumenter_baset { public: cover_decision_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "decision") { @@ -212,7 +212,7 @@ class cover_mcdc_instrumentert : public cover_instrumenter_baset { public: cover_mcdc_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "MC/DC") { @@ -232,7 +232,7 @@ class cover_path_instrumentert : public cover_instrumenter_baset { public: cover_path_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "path") { @@ -252,7 +252,7 @@ class cover_assertion_instrumentert : public cover_instrumenter_baset { public: cover_assertion_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "assertion") { @@ -272,7 +272,7 @@ class cover_cover_instrumentert : public cover_instrumenter_baset { public: cover_cover_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "cover") { @@ -297,7 +297,7 @@ class cover_assume_instrumentert : public cover_instrumenter_baset { public: cover_assume_instrumentert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goal_filterst &_goal_filters) : cover_instrumenter_baset(_symbol_table, _goal_filters, "location") { diff --git a/src/goto-instrument/cover_instrument_assume.cpp b/src/goto-instrument/cover_instrument_assume.cpp index 7714b45ec21..0b0591ec4d6 100644 --- a/src/goto-instrument/cover_instrument_assume.cpp +++ b/src/goto-instrument/cover_instrument_assume.cpp @@ -7,7 +7,6 @@ #include "ansi-c/expr2c.h" #include "goto-programs/goto_program.h" #include "util/std_expr.h" -#include /// Instrument program to check coverage of assume statements. /// \param function_id The name of the function under instrumentation. @@ -23,8 +22,7 @@ void cover_assume_instrumentert::instrument( { if(i_it->is_assume()) { - const auto assume_condition = - expr2c(i_it->condition(), namespacet{symbol_tablet()}); + const auto assume_condition = expr2c(i_it->condition(), ns); const auto comment_before = "assert(false) before assume(" + assume_condition + ")"; const auto comment_after = diff --git a/src/goto-instrument/cover_instrument_mcdc.cpp b/src/goto-instrument/cover_instrument_mcdc.cpp index 7656f6617d1..a6aaa4f114d 100644 --- a/src/goto-instrument/cover_instrument_mcdc.cpp +++ b/src/goto-instrument/cover_instrument_mcdc.cpp @@ -9,16 +9,16 @@ Author: Daniel Kroening /// \file /// Coverage Instrumentation for MC/DC -#include "cover_instrument.h" - #include #include +#include "cover_instrument.h" +#include "cover_util.h" + #include #include - -#include "cover_util.h" +#include /// To recursively collect controlling exprs for for mcdc coverage. void collect_mcdc_controlling_rec( diff --git a/src/goto-instrument/full_slicer.cpp b/src/goto-instrument/full_slicer.cpp index ac73581f353..36d6a673d17 100644 --- a/src/goto-instrument/full_slicer.cpp +++ b/src/goto-instrument/full_slicer.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "full_slicer_class.h" #include -#include #include #include diff --git a/src/goto-instrument/function.cpp b/src/goto-instrument/function.cpp index 98f7f8b1a7e..b47523913da 100644 --- a/src/goto-instrument/function.cpp +++ b/src/goto-instrument/function.cpp @@ -16,20 +16,18 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include -#include #include code_function_callt function_to_call( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &id, const irep_idt &argument) { // already there? - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(id); if(s_it==symbol_table.symbols.end()) diff --git a/src/goto-instrument/function.h b/src/goto-instrument/function.h index 4197db65671..98652f00641 100644 --- a/src/goto-instrument/function.h +++ b/src/goto-instrument/function.h @@ -15,10 +15,10 @@ Author: Daniel Kroening, kroening@kroening.com #include class goto_modelt; -class symbol_tablet; +class symbol_table_baset; class code_function_callt function_to_call( - symbol_tablet &, + symbol_table_baset &, const irep_idt &id, const irep_idt &argument); diff --git a/src/goto-instrument/generate_function_bodies.cpp b/src/goto-instrument/generate_function_bodies.cpp index 7a7b7e6a61f..6c0b2b78d61 100644 --- a/src/goto-instrument/generate_function_bodies.cpp +++ b/src/goto-instrument/generate_function_bodies.cpp @@ -15,7 +15,6 @@ Author: Diffblue Ltd. #include #include -#include #include #include #include diff --git a/src/goto-instrument/goto_instrument_parse_options.cpp b/src/goto-instrument/goto_instrument_parse_options.cpp index 3fa4301ae93..1a21921c827 100644 --- a/src/goto-instrument/goto_instrument_parse_options.cpp +++ b/src/goto-instrument/goto_instrument_parse_options.cpp @@ -19,7 +19,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include +#include // IWYU pragma: keep #include #include @@ -108,6 +108,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "value_set_fi_fp_removal.h" #include "accelerate/accelerate.h" +#include "synthesizer/enumerative_loop_invariant_synthesizer.h" /// invoke main modules int goto_instrument_parse_optionst::doit() diff --git a/src/goto-instrument/goto_instrument_parse_options.h b/src/goto-instrument/goto_instrument_parse_options.h index 4fa2375f901..6aa7343c6c6 100644 --- a/src/goto-instrument/goto_instrument_parse_options.h +++ b/src/goto-instrument/goto_instrument_parse_options.h @@ -42,7 +42,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "contracts/contracts.h" #include "contracts/dynamic-frames/dfcc.h" -#include "synthesizer/enumerative_loop_invariant_synthesizer.h" +#include "synthesizer/loop_invariant_synthesizer_base.h" #include "wmm/weak_memory.h" // clang-format off diff --git a/src/goto-instrument/goto_program2code.cpp b/src/goto-instrument/goto_program2code.cpp index 3eb66540534..7abbaa56c0b 100644 --- a/src/goto-instrument/goto_program2code.cpp +++ b/src/goto-instrument/goto_program2code.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "goto_program2code.h" -#include - #include #include #include @@ -20,6 +18,9 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include + +#include void goto_program2codet::operator()() { diff --git a/src/goto-instrument/goto_program2code.h b/src/goto-instrument/goto_program2code.h index ebef177850e..7d11e767a6a 100644 --- a/src/goto-instrument/goto_program2code.h +++ b/src/goto-instrument/goto_program2code.h @@ -17,7 +17,7 @@ Author: Daniel Kroening, kroening@kroening.com #include -#include +class code_blockt; class goto_program2codet { diff --git a/src/goto-instrument/havoc_utils.cpp b/src/goto-instrument/havoc_utils.cpp index 185b010140b..f7d6dc5c5c7 100644 --- a/src/goto-instrument/havoc_utils.cpp +++ b/src/goto-instrument/havoc_utils.cpp @@ -13,11 +13,11 @@ Date: July 2021 #include "havoc_utils.h" -#include -#include #include #include +#include + void havoc_utilst::append_full_havoc_code( const source_locationt location, goto_programt &dest) const diff --git a/src/goto-instrument/havoc_utils.h b/src/goto-instrument/havoc_utils.h index eb9710a4794..19a0ca57815 100644 --- a/src/goto-instrument/havoc_utils.h +++ b/src/goto-instrument/havoc_utils.h @@ -14,11 +14,12 @@ Date: July 2021 #ifndef CPROVER_GOTO_INSTRUMENT_HAVOC_UTILS_H #define CPROVER_GOTO_INSTRUMENT_HAVOC_UTILS_H -#include +#include +#include -#include +#include -#include +class goto_programt; typedef std::set assignst; diff --git a/src/goto-instrument/nondet_volatile.cpp b/src/goto-instrument/nondet_volatile.cpp index 73553c6e2f5..5423c25b61e 100644 --- a/src/goto-instrument/nondet_volatile.cpp +++ b/src/goto-instrument/nondet_volatile.cpp @@ -20,7 +20,6 @@ Date: September 2011 #include #include #include -#include #include @@ -58,19 +57,20 @@ class nondet_volatilet goto_programt &post); void nondet_volatile_rhs( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, exprt &expr, goto_programt &pre, goto_programt &post); void nondet_volatile_lhs( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, exprt &expr, goto_programt &pre, goto_programt &post); - void - nondet_volatile(symbol_tablet &symbol_table, goto_programt &goto_program); + void nondet_volatile( + symbol_table_baset &symbol_table, + goto_programt &goto_program); const symbolt &typecheck_variable(const irep_idt &id, const namespacet &ns); @@ -162,7 +162,7 @@ void nondet_volatilet::handle_volatile_expression( } void nondet_volatilet::nondet_volatile_rhs( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, exprt &expr, goto_programt &pre, goto_programt &post) @@ -183,7 +183,7 @@ void nondet_volatilet::nondet_volatile_rhs( } void nondet_volatilet::nondet_volatile_lhs( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, exprt &expr, goto_programt &pre, goto_programt &post) @@ -212,7 +212,7 @@ void nondet_volatilet::nondet_volatile_lhs( } void nondet_volatilet::nondet_volatile( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_programt &goto_program) { namespacet ns(symbol_table); diff --git a/src/goto-instrument/race_check.cpp b/src/goto-instrument/race_check.cpp index a08e8bdef10..0ad15421874 100644 --- a/src/goto-instrument/race_check.cpp +++ b/src/goto-instrument/race_check.cpp @@ -34,7 +34,8 @@ Date: February 2006 class w_guardst { public: - explicit w_guardst(symbol_tablet &_symbol_table):symbol_table(_symbol_table) + explicit w_guardst(symbol_table_baset &_symbol_table) + : symbol_table(_symbol_table) { } @@ -60,14 +61,14 @@ class w_guardst void add_initialization(goto_programt &goto_program) const; protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; }; const symbolt &w_guardst::get_guard_symbol(const irep_idt &object) { const irep_idt identifier=id2string(object)+"$w_guard"; - const symbol_tablet::symbolst::const_iterator it= + const symbol_table_baset::symbolst::const_iterator it = symbol_table.symbols.find(identifier); if(it!=symbol_table.symbols.end()) @@ -160,7 +161,7 @@ static bool has_shared_entries(const namespacet &ns, const rw_set_baset &rw_set) // after static void race_check( value_setst &value_sets, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &function_id, L_M_ARG(const goto_functionst::goto_functiont &goto_function) goto_programt &goto_program, @@ -264,7 +265,7 @@ static void race_check( void race_check( value_setst &value_sets, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, diff --git a/src/goto-instrument/race_check.h b/src/goto-instrument/race_check.h index 704d19166cc..98e9bfd52d9 100644 --- a/src/goto-instrument/race_check.h +++ b/src/goto-instrument/race_check.h @@ -14,14 +14,19 @@ Date: February 2006 #ifndef CPROVER_GOTO_INSTRUMENT_RACE_CHECK_H #define CPROVER_GOTO_INSTRUMENT_RACE_CHECK_H -#include +#ifdef LOCAL_MAY +# include +#endif + +#include class goto_modelt; +class goto_programt; class value_setst; void race_check( value_setst &, - class symbol_tablet &, + class symbol_table_baset &, const irep_idt &function_id, #ifdef LOCAL_MAY const goto_functionst::goto_functiont &goto_function, diff --git a/src/goto-instrument/rw_set.cpp b/src/goto-instrument/rw_set.cpp index 8c348e73303..993b57a83a7 100644 --- a/src/goto-instrument/rw_set.cpp +++ b/src/goto-instrument/rw_set.cpp @@ -14,7 +14,6 @@ Date: February 2006 #include "rw_set.h" #include -#include #include diff --git a/src/goto-instrument/splice_call.cpp b/src/goto-instrument/splice_call.cpp index 4d125406e37..ba640a05dc3 100644 --- a/src/goto-instrument/splice_call.cpp +++ b/src/goto-instrument/splice_call.cpp @@ -16,8 +16,9 @@ Date: July 2017 #include "splice_call.h" #include +#include #include -#include +#include #include @@ -34,7 +35,7 @@ static bool parse_caller_callee( bool splice_call( goto_functionst &goto_functions, const std::string &callercallee, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, message_handlert &message_handler) { messaget message(message_handler); diff --git a/src/goto-instrument/splice_call.h b/src/goto-instrument/splice_call.h index 455823c6fcd..1a59c9f08e9 100644 --- a/src/goto-instrument/splice_call.h +++ b/src/goto-instrument/splice_call.h @@ -19,12 +19,12 @@ Date: July 2017 class goto_functionst; class message_handlert; -class symbol_tablet; +class symbol_table_baset; bool splice_call( - goto_functionst &goto_functions, - const std::string &callercallee, - const symbol_tablet &symbol_table, - message_handlert &message_handler); + goto_functionst &goto_functions, + const std::string &callercallee, + const symbol_table_baset &symbol_table, + message_handlert &message_handler); #endif // CPROVER_GOTO_INSTRUMENT_SPLICE_CALL_H diff --git a/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.cpp b/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.cpp index bc3ffc10718..67dbc3ed068 100644 --- a/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.cpp +++ b/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.cpp @@ -11,6 +11,8 @@ Author: Qinheping Hu #include "enumerative_loop_invariant_synthesizer.h" +#include + void enumerative_loop_invariant_synthesizert::init_candidates() { for(auto &function_p : goto_model.goto_functions.function_map) diff --git a/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.h b/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.h index b60ee146843..160531198f4 100644 --- a/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.h +++ b/src/goto-instrument/synthesizer/enumerative_loop_invariant_synthesizer.h @@ -14,11 +14,10 @@ Author: Qinheping Hu // NOLINTNEXTLINE(whitespace/line_length) #define CPROVER_GOTO_INSTRUMENT_SYNTHESIZER_ENUMERATIVE_LOOP_INVARIANT_SYNTHESIZER_H -#include - #include "loop_invariant_synthesizer_base.h" class messaget; +class goto_modelt; /// Enumerative loop invariant synthesizers. /// It is designed for `goto_model` containing only checks instrumented by diff --git a/src/goto-instrument/synthesizer/expr_enumerator.cpp b/src/goto-instrument/synthesizer/expr_enumerator.cpp index e470c1ec9c0..617a7aed25d 100644 --- a/src/goto-instrument/synthesizer/expr_enumerator.cpp +++ b/src/goto-instrument/synthesizer/expr_enumerator.cpp @@ -7,6 +7,7 @@ Author: Qinheping Hu #include #include +#include #include diff --git a/src/goto-instrument/synthesizer/expr_enumerator.h b/src/goto-instrument/synthesizer/expr_enumerator.h index 5895b8a3dc3..3a471901430 100644 --- a/src/goto-instrument/synthesizer/expr_enumerator.h +++ b/src/goto-instrument/synthesizer/expr_enumerator.h @@ -9,11 +9,10 @@ Author: Qinheping Hu #ifndef CPROVER_GOTO_INSTRUMENT_SYNTHESIZER_EXPR_ENUMERATOR_H #define CPROVER_GOTO_INSTRUMENT_SYNTHESIZER_EXPR_ENUMERATOR_H -#include - -#include "synthesizer_utils.h" +#include #include +#include typedef std::list expr_listt; typedef std::set expr_sett; diff --git a/src/goto-instrument/synthesizer/synthesizer_utils.cpp b/src/goto-instrument/synthesizer/synthesizer_utils.cpp index f871fce7a6e..f1a618b1dc9 100644 --- a/src/goto-instrument/synthesizer/synthesizer_utils.cpp +++ b/src/goto-instrument/synthesizer/synthesizer_utils.cpp @@ -8,6 +8,8 @@ Author: Qinheping Hu #include "synthesizer_utils.h" +#include + goto_programt::const_targett get_loop_end_from_loop_head_and_content( const goto_programt::const_targett &loop_head, const loop_templatet &loop) diff --git a/src/goto-instrument/synthesizer/synthesizer_utils.h b/src/goto-instrument/synthesizer/synthesizer_utils.h index 920a79814c0..40620f7feac 100644 --- a/src/goto-instrument/synthesizer/synthesizer_utils.h +++ b/src/goto-instrument/synthesizer/synthesizer_utils.h @@ -9,14 +9,15 @@ Author: Qinheping Hu #ifndef CPROVER_GOTO_INSTRUMENT_SYNTHESIZER_SYNTHESIZER_UTILS_H #define CPROVER_GOTO_INSTRUMENT_SYNTHESIZER_SYNTHESIZER_UTILS_H -#include #include #include -#include -#include +#include +class goto_functiont; class messaget; +template +class loop_templatet; typedef std::map invariant_mapt; diff --git a/src/goto-instrument/uninitialized.cpp b/src/goto-instrument/uninitialized.cpp index 3860358ae7e..2d4cb16f675 100644 --- a/src/goto-instrument/uninitialized.cpp +++ b/src/goto-instrument/uninitialized.cpp @@ -13,17 +13,13 @@ Date: January 2010 #include "uninitialized.h" -#include -#include - #include class uninitializedt { public: - explicit uninitializedt(symbol_tablet &_symbol_table): - symbol_table(_symbol_table), - ns(_symbol_table) + explicit uninitializedt(symbol_table_baset &_symbol_table) + : symbol_table(_symbol_table), ns(_symbol_table) { } @@ -32,7 +28,7 @@ class uninitializedt goto_programt &goto_program); protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; namespacet ns; uninitialized_analysist uninitialized_analysis; diff --git a/src/goto-instrument/unwindset.cpp b/src/goto-instrument/unwindset.cpp index 5b79a560bff..6c1ee7da68b 100644 --- a/src/goto-instrument/unwindset.cpp +++ b/src/goto-instrument/unwindset.cpp @@ -12,11 +12,14 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #ifdef _MSC_VER # include #endif +#include + #include void unwindsett::parse_unwind(const std::string &unwind) @@ -53,7 +56,7 @@ void unwindsett::parse_unwindset_one_loop( // 1) Just a function name to limit recursion. // 2) F.N where F is a function name and N is a loop number. // 3) F.L where F is a function name and L is a label. - const symbol_tablet &symbol_table = goto_model.get_symbol_table(); + const symbol_table_baset &symbol_table = goto_model.get_symbol_table(); const symbolt *maybe_fn = symbol_table.lookup(id); if(maybe_fn && maybe_fn->type.id() == ID_code) { diff --git a/src/goto-instrument/unwindset.h b/src/goto-instrument/unwindset.h index 4a236fb9216..b89b2850a9a 100644 --- a/src/goto-instrument/unwindset.h +++ b/src/goto-instrument/unwindset.h @@ -12,12 +12,14 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_INSTRUMENT_UNWINDSET_H #define CPROVER_GOTO_INSTRUMENT_UNWINDSET_H -#include +#include +#include #include #include #include +class abstract_goto_modelt; class message_handlert; class unwindsett diff --git a/src/goto-instrument/wmm/shared_buffers.h b/src/goto-instrument/wmm/shared_buffers.h index 241bc76f47d..b9e6fadb21c 100644 --- a/src/goto-instrument/wmm/shared_buffers.h +++ b/src/goto-instrument/wmm/shared_buffers.h @@ -10,17 +10,18 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_INSTRUMENT_WMM_SHARED_BUFFERS_H #define CPROVER_GOTO_INSTRUMENT_WMM_SHARED_BUFFERS_H -#include -#include - -#include #include #include #include -#include +#include + +#include #include "wmm.h" +#include +#include + class goto_functionst; class messaget; class value_setst; @@ -28,13 +29,15 @@ class value_setst; class shared_bufferst { public: - shared_bufferst(symbol_tablet &_symbol_table, unsigned _nb_threads, - messaget &_message): - symbol_table(_symbol_table), - nb_threads(_nb_threads+1), - uniq(0), - cav11(false), - message(_message) + shared_bufferst( + symbol_table_baset &_symbol_table, + unsigned _nb_threads, + messaget &_message) + : symbol_table(_symbol_table), + nb_threads(_nb_threads + 1), + uniq(0), + cav11(false), + message(_message) { } @@ -175,7 +178,7 @@ class shared_bufferst void weak_memory( value_setst &value_sets, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_programt &goto_program, memory_modelt model, goto_functionst &goto_functions); @@ -188,7 +191,7 @@ class shared_bufferst { protected: shared_bufferst &shared_buffers; - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; goto_functionst &goto_functions; /* for thread marking (dynamic) */ @@ -200,9 +203,12 @@ class shared_bufferst std::set past_writes; public: - cfg_visitort(shared_bufferst &_shared, symbol_tablet &_symbol_table, + cfg_visitort( + shared_bufferst &_shared, + symbol_table_baset &_symbol_table, goto_functionst &_goto_functions) - :shared_buffers(_shared), symbol_table(_symbol_table), + : shared_buffers(_shared), + symbol_table(_symbol_table), goto_functions(_goto_functions) { current_thread = 0; @@ -217,7 +223,7 @@ class shared_bufferst }; protected: - class symbol_tablet &symbol_table; + class symbol_table_baset &symbol_table; // number of threads interfering unsigned nb_threads; diff --git a/src/goto-programs/abstract_goto_model.h b/src/goto-programs/abstract_goto_model.h index 856c5cff284..150fe02a43f 100644 --- a/src/goto-programs/abstract_goto_model.h +++ b/src/goto-programs/abstract_goto_model.h @@ -14,7 +14,8 @@ Author: Diffblue Ltd. #include "goto_functions.h" #include "validate_goto_model.h" -#include + +class symbol_tablet; /// Abstract interface to eager or lazy GOTO models class abstract_goto_modelt diff --git a/src/goto-programs/builtin_functions.cpp b/src/goto-programs/builtin_functions.cpp index 62278e631fa..e4815276c6d 100644 --- a/src/goto-programs/builtin_functions.cpp +++ b/src/goto-programs/builtin_functions.cpp @@ -23,7 +23,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include +#include #include diff --git a/src/goto-programs/class_hierarchy.cpp b/src/goto-programs/class_hierarchy.cpp index 8f9ebb44a11..a58c2e3baf7 100644 --- a/src/goto-programs/class_hierarchy.cpp +++ b/src/goto-programs/class_hierarchy.cpp @@ -13,20 +13,20 @@ Date: April 2016 #include "class_hierarchy.h" -#include -#include - #include #include -#include +#include #include +#include +#include + /// Populate the class hierarchy graph, such that there is a node for every /// struct type in the symbol table and an edge representing each superclass /// <-> subclass relationship, pointing from parent to child. /// \param symbol_table: global symbol table, which will be searched for struct /// types. -void class_hierarchy_grapht::populate(const symbol_tablet &symbol_table) +void class_hierarchy_grapht::populate(const symbol_table_baset &symbol_table) { // Add nodes for all classes: for(const auto &symbol_pair : symbol_table.symbols) @@ -147,7 +147,7 @@ void class_hierarchyt::get_children_trans_rec( /// class names to a data structure that contains lists of parent and child /// classes for each struct type (ie class). /// \param symbol_table: The symbol table to analyze -void class_hierarchyt::operator()(const symbol_tablet &symbol_table) +void class_hierarchyt::operator()(const symbol_table_baset &symbol_table) { for(const auto &symbol_pair : symbol_table.symbols) { diff --git a/src/goto-programs/class_hierarchy.h b/src/goto-programs/class_hierarchy.h index f797ed01ad1..6327e30c3ce 100644 --- a/src/goto-programs/class_hierarchy.h +++ b/src/goto-programs/class_hierarchy.h @@ -29,7 +29,7 @@ Date: April 2016 " --show-class-hierarchy show the class hierarchy\n" // clang-format on -class symbol_tablet; +class symbol_table_baset; class json_stream_arrayt; class ui_message_handlert; @@ -54,10 +54,10 @@ class class_hierarchyt typedef std::map class_mapt; class_mapt class_map; - void operator()(const symbol_tablet &); + void operator()(const symbol_table_baset &); class_hierarchyt() = default; - explicit class_hierarchyt(const symbol_tablet &symbol_table) + explicit class_hierarchyt(const symbol_table_baset &symbol_table) { (*this)(symbol_table); } @@ -107,7 +107,7 @@ class class_hierarchy_grapht : public grapht /// Maps class identifiers onto node indices typedef std::unordered_map nodes_by_namet; - void populate(const symbol_tablet &); + void populate(const symbol_table_baset &); /// Get map from class identifier to node index /// \return map from class identifier to node index diff --git a/src/goto-programs/destructor_tree.h b/src/goto-programs/destructor_tree.h index 5a2fad30995..286e5678f82 100644 --- a/src/goto-programs/destructor_tree.h +++ b/src/goto-programs/destructor_tree.h @@ -10,7 +10,7 @@ #define CPROVER_GOTO_PROGRAMS_DESTRUCTOR_TREE_H #include -#include +#include typedef std::size_t node_indext; diff --git a/src/goto-programs/goto_convert.cpp b/src/goto-programs/goto_convert.cpp index b83502cc75f..7d32be168eb 100644 --- a/src/goto-programs/goto_convert.cpp +++ b/src/goto-programs/goto_convert.cpp @@ -22,7 +22,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include "goto_convert_class.h" @@ -1920,7 +1919,7 @@ void goto_convert( message_handlert &message_handler) { // find main symbol - const symbol_tablet::symbolst::const_iterator s_it= + const symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find("main"); DATA_INVARIANT( diff --git a/src/goto-programs/goto_convert_exceptions.cpp b/src/goto-programs/goto_convert_exceptions.cpp index e485aabd0b0..c1d86ba1367 100644 --- a/src/goto-programs/goto_convert_exceptions.cpp +++ b/src/goto-programs/goto_convert_exceptions.cpp @@ -12,7 +12,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "goto_convert_class.h" #include -#include +#include void goto_convertt::convert_msc_try_finally( const codet &code, @@ -237,7 +237,7 @@ symbol_exprt goto_convertt::exception_flag(const irep_idt &mode) { irep_idt id="$exception_flag"; - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(id); if(s_it==symbol_table.symbols.end()) diff --git a/src/goto-programs/goto_convert_functions.cpp b/src/goto-programs/goto_convert_functions.cpp index 6bec969876d..55d0bfe0aad 100644 --- a/src/goto-programs/goto_convert_functions.cpp +++ b/src/goto-programs/goto_convert_functions.cpp @@ -12,7 +12,6 @@ Date: June 2003 #include #include -#include #include #include diff --git a/src/goto-programs/goto_function.cpp b/src/goto-programs/goto_function.cpp index f3ed1e76db6..068a159d06f 100644 --- a/src/goto-programs/goto_function.cpp +++ b/src/goto-programs/goto_function.cpp @@ -13,6 +13,7 @@ Date: May 2018 #include "goto_function.h" +#include #include /// Return in \p dest the identifiers of the local variables declared in the \p diff --git a/src/goto-programs/goto_functions.cpp b/src/goto-programs/goto_functions.cpp index 789daedc074..f4ac42e6d4a 100644 --- a/src/goto-programs/goto_functions.cpp +++ b/src/goto-programs/goto_functions.cpp @@ -13,6 +13,7 @@ Date: June 2003 #include "goto_functions.h" +#include #include #include diff --git a/src/goto-programs/goto_inline_class.cpp b/src/goto-programs/goto_inline_class.cpp index f577aca2b49..e553f4cee96 100644 --- a/src/goto-programs/goto_inline_class.cpp +++ b/src/goto-programs/goto_inline_class.cpp @@ -17,6 +17,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include +#include #include #include diff --git a/src/goto-programs/goto_instruction_code.cpp b/src/goto-programs/goto_instruction_code.cpp index 4265d52e8dd..1547364f1a7 100644 --- a/src/goto-programs/goto_instruction_code.cpp +++ b/src/goto-programs/goto_instruction_code.cpp @@ -13,10 +13,11 @@ Author: Daniel Kroening, kroening@kroening.com #include #include +#include #include #include #include -#include +#include code_inputt::code_inputt( std::vector arguments, diff --git a/src/goto-programs/goto_instruction_code.h b/src/goto-programs/goto_instruction_code.h index 3b105396e57..a7d53e67850 100644 --- a/src/goto-programs/goto_instruction_code.h +++ b/src/goto-programs/goto_instruction_code.h @@ -9,7 +9,6 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_UTIL_GOTO_INSTRUCTION_CODE_H #define CPROVER_UTIL_GOTO_INSTRUCTION_CODE_H -#include #include #include diff --git a/src/goto-programs/goto_model.h b/src/goto-programs/goto_model.h index 52631d121a9..b5e0c55a839 100644 --- a/src/goto-programs/goto_model.h +++ b/src/goto-programs/goto_model.h @@ -12,8 +12,9 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_PROGRAMS_GOTO_MODEL_H #define CPROVER_GOTO_PROGRAMS_GOTO_MODEL_H -#include #include +#include +#include #include "abstract_goto_model.h" #include "goto_functions.h" diff --git a/src/goto-programs/goto_program.cpp b/src/goto-programs/goto_program.cpp index a10e0b777b8..7b8694e3fff 100644 --- a/src/goto-programs/goto_program.cpp +++ b/src/goto-programs/goto_program.cpp @@ -11,23 +11,25 @@ Author: Daniel Kroening, kroening@kroening.com #include "goto_program.h" -#include "validate_code.h" - -#include - #include #include #include #include #include +#include #include #include #include -#include +#include #include #include +#include "validate_code.h" + +#include +#include + goto_programt::instructiont goto_programt::make_incomplete_goto( const code_gotot &_code, const source_locationt &l) diff --git a/src/goto-programs/goto_program.h b/src/goto-programs/goto_program.h index 49514f40a64..8f878915ca4 100644 --- a/src/goto-programs/goto_program.h +++ b/src/goto-programs/goto_program.h @@ -21,10 +21,10 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include #include class code_gotot; +class namespacet; enum class validation_modet; /// The type of an instruction in a GOTO program. diff --git a/src/goto-programs/goto_trace.cpp b/src/goto-programs/goto_trace.cpp index f7b7f34b566..de8cc9bcf15 100644 --- a/src/goto-programs/goto_trace.cpp +++ b/src/goto-programs/goto_trace.cpp @@ -19,6 +19,7 @@ Author: Daniel Kroening #include #include #include +#include #include #include #include diff --git a/src/goto-programs/graphml_witness.cpp b/src/goto-programs/graphml_witness.cpp index 8ff498c5903..c411903e21c 100644 --- a/src/goto-programs/graphml_witness.cpp +++ b/src/goto-programs/graphml_witness.cpp @@ -15,19 +15,18 @@ Author: Daniel Kroening #include #include #include +#include #include #include #include #include -#include +#include +#include +#include #include #include -#include - -#include - #include "goto_program.h" #include "goto_trace.h" diff --git a/src/goto-programs/interpreter.cpp b/src/goto-programs/interpreter.cpp index d3572e6954a..164a803f291 100644 --- a/src/goto-programs/interpreter.cpp +++ b/src/goto-programs/interpreter.cpp @@ -27,7 +27,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include "goto_model.h" #include "interpreter_class.h" diff --git a/src/goto-programs/interpreter_class.h b/src/goto-programs/interpreter_class.h index ad883bbfb80..425934e87fa 100644 --- a/src/goto-programs/interpreter_class.h +++ b/src/goto-programs/interpreter_class.h @@ -12,24 +12,24 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_PROGRAMS_INTERPRETER_CLASS_H #define CPROVER_GOTO_PROGRAMS_INTERPRETER_CLASS_H -#include - #include #include #include +#include #include #include -#include #include "goto_functions.h" #include "goto_trace.h" #include "json_goto_trace.h" +#include + class interpretert { public: interpretert( - const symbol_tablet &_symbol_table, + const symbol_table_baset &_symbol_table, const goto_functionst &_goto_functions, message_handlert &_message_handler) : output(_message_handler), @@ -99,7 +99,7 @@ class interpretert protected: messaget output; - const symbol_tablet &symbol_table; + const symbol_table_baset &symbol_table; // This is a cache so that we don't have to create it when a call needs it const namespacet ns; diff --git a/src/goto-programs/json_expr.cpp b/src/goto-programs/json_expr.cpp index 4afbc6a1f39..81435609169 100644 --- a/src/goto-programs/json_expr.cpp +++ b/src/goto-programs/json_expr.cpp @@ -13,7 +13,6 @@ Author: Peter Schrammel #include #include -#include #include #include #include diff --git a/src/goto-programs/json_goto_trace.cpp b/src/goto-programs/json_goto_trace.cpp index e145226c043..d8eb7649637 100644 --- a/src/goto-programs/json_goto_trace.cpp +++ b/src/goto-programs/json_goto_trace.cpp @@ -14,6 +14,7 @@ Author: Daniel Kroening #include "json_goto_trace.h" #include +#include #include #include diff --git a/src/goto-programs/mm_io.cpp b/src/goto-programs/mm_io.cpp index d26b9b0afb2..2346ff40cbe 100644 --- a/src/goto-programs/mm_io.cpp +++ b/src/goto-programs/mm_io.cpp @@ -20,7 +20,6 @@ Date: April 2017 #include #include "goto_model.h" -#include "remove_returns.h" #include diff --git a/src/goto-programs/parameter_assignments.cpp b/src/goto-programs/parameter_assignments.cpp index 32b21457e70..9bea3c04f3b 100644 --- a/src/goto-programs/parameter_assignments.cpp +++ b/src/goto-programs/parameter_assignments.cpp @@ -14,15 +14,14 @@ Date: September 2015 #include "parameter_assignments.h" #include -#include #include "goto_model.h" class parameter_assignmentst { public: - explicit parameter_assignmentst(symbol_tablet &_symbol_table): - symbol_table(_symbol_table) + explicit parameter_assignmentst(symbol_table_baset &_symbol_table) + : symbol_table(_symbol_table) { } @@ -30,7 +29,7 @@ class parameter_assignmentst goto_functionst &goto_functions); protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; void do_function_calls( goto_programt &goto_program); @@ -91,7 +90,7 @@ void parameter_assignmentst::operator()(goto_functionst &goto_functions) /// removes returns void parameter_assignments( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_functionst &goto_functions) { parameter_assignmentst rr(symbol_table); diff --git a/src/goto-programs/read_bin_goto_object.cpp b/src/goto-programs/read_bin_goto_object.cpp index 751380b608d..93df35689cb 100644 --- a/src/goto-programs/read_bin_goto_object.cpp +++ b/src/goto-programs/read_bin_goto_object.cpp @@ -13,9 +13,9 @@ Date: June 2006 #include "read_bin_goto_object.h" -#include -#include #include +#include +#include #include "goto_functions.h" #include "write_goto_binary.h" @@ -25,7 +25,7 @@ Date: June 2006 /// \return true on error, false otherwise static bool read_bin_goto_object( std::istream &in, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_functionst &functions, irep_serializationt &irepconverter) { @@ -176,7 +176,7 @@ static bool read_bin_goto_object( bool read_bin_goto_object( std::istream &in, const std::string &filename, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_functionst &functions, message_handlert &message_handler) { diff --git a/src/goto-programs/read_bin_goto_object.h b/src/goto-programs/read_bin_goto_object.h index e7b684b3cc4..6b0d9361787 100644 --- a/src/goto-programs/read_bin_goto_object.h +++ b/src/goto-programs/read_bin_goto_object.h @@ -17,14 +17,14 @@ Date: May 2007 #include #include -class symbol_tablet; +class symbol_table_baset; class goto_functionst; class message_handlert; bool read_bin_goto_object( std::istream &in, const std::string &filename, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_functionst &goto_functions, message_handlert &message_handler); diff --git a/src/goto-programs/rebuild_goto_start_function.cpp b/src/goto-programs/rebuild_goto_start_function.cpp index bbb29e8089c..ea59938b423 100644 --- a/src/goto-programs/rebuild_goto_start_function.cpp +++ b/src/goto-programs/rebuild_goto_start_function.cpp @@ -12,13 +12,13 @@ Author: Thomas Kiley, thomas@diffblue.com #include "rebuild_goto_start_function.h" #include -#include - -#include -#include +#include #include +#include +#include + #include std::unique_ptr get_entry_point_language( diff --git a/src/goto-programs/remove_const_function_pointers.cpp b/src/goto-programs/remove_const_function_pointers.cpp index b260bef6886..6f213f5252c 100644 --- a/src/goto-programs/remove_const_function_pointers.cpp +++ b/src/goto-programs/remove_const_function_pointers.cpp @@ -17,7 +17,7 @@ Author: Thomas Kiley, thomas.kiley@diffblue.com #include #include #include -#include +#include #define LOG(message, irep) \ do \ @@ -34,7 +34,7 @@ Author: Thomas Kiley, thomas.kiley@diffblue.com remove_const_function_pointerst::remove_const_function_pointerst( message_handlert &message_handler, const namespacet &ns, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) : log(message_handler), ns(ns), symbol_table(symbol_table) {} diff --git a/src/goto-programs/remove_const_function_pointers.h b/src/goto-programs/remove_const_function_pointers.h index 4dbe3c1d122..b7870e1e4ef 100644 --- a/src/goto-programs/remove_const_function_pointers.h +++ b/src/goto-programs/remove_const_function_pointers.h @@ -21,13 +21,13 @@ Author: Thomas Kiley, thomas.kiley@diffblue.com class address_of_exprt; class dereference_exprt; -class index_exprt; -class member_exprt; +class index_exprt; // IWYU pragma: keep +class member_exprt; // IWYU pragma: keep class namespacet; -class struct_exprt; -class symbol_exprt; -class symbol_tablet; -class typecast_exprt; +class struct_exprt; // IWYU pragma: keep +class symbol_exprt; // IWYU pragma: keep +class symbol_table_baset; +class typecast_exprt; // IWYU pragma: keep class remove_const_function_pointerst { @@ -37,7 +37,7 @@ class remove_const_function_pointerst remove_const_function_pointerst( message_handlert &message_handler, const namespacet &ns, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); bool operator()(const exprt &base_expression, functionst &out_functions); @@ -103,7 +103,7 @@ class remove_const_function_pointerst messaget log; const namespacet &ns; - const symbol_tablet &symbol_table; + const symbol_table_baset &symbol_table; }; #define OPT_REMOVE_CONST_FUNCTION_POINTERS \ diff --git a/src/goto-programs/remove_function_pointers.h b/src/goto-programs/remove_function_pointers.h index ea7073a5294..d52e0338ccc 100644 --- a/src/goto-programs/remove_function_pointers.h +++ b/src/goto-programs/remove_function_pointers.h @@ -18,7 +18,6 @@ Date: June 2003 #include -class goto_functionst; class goto_modelt; class message_handlert; class symbol_tablet; diff --git a/src/goto-programs/remove_returns.h b/src/goto-programs/remove_returns.h index d18dfbf878e..5474e7cc519 100644 --- a/src/goto-programs/remove_returns.h +++ b/src/goto-programs/remove_returns.h @@ -73,15 +73,13 @@ Date: September 2009 #include -#include +#include "goto_program.h" -#include "goto_function.h" +#include -class code_function_callt; class goto_functionst; class goto_model_functiont; class goto_modelt; -class namespacet; class symbol_table_baset; class symbol_exprt; diff --git a/src/goto-programs/remove_virtual_functions.cpp b/src/goto-programs/remove_virtual_functions.cpp index d2addae6546..171a0037774 100644 --- a/src/goto-programs/remove_virtual_functions.cpp +++ b/src/goto-programs/remove_virtual_functions.cpp @@ -17,7 +17,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include "class_hierarchy.h" #include "class_identifier.h" @@ -811,7 +810,7 @@ void remove_virtual_functions( /// \return Returns a pointer to the statement in the supplied GOTO /// program after replaced function call goto_programt::targett remove_virtual_function( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &function_id, goto_programt &goto_program, goto_programt::targett instruction, diff --git a/src/goto-programs/remove_virtual_functions.h b/src/goto-programs/remove_virtual_functions.h index e332a49dc93..394db351c98 100644 --- a/src/goto-programs/remove_virtual_functions.h +++ b/src/goto-programs/remove_virtual_functions.h @@ -26,7 +26,6 @@ class class_hierarchyt; class goto_functionst; class goto_model_functiont; class goto_modelt; -class symbol_tablet; class symbol_table_baset; // For all of the following the class-hierarchy and non-class-hierarchy @@ -113,7 +112,7 @@ goto_programt::targett remove_virtual_function( virtual_dispatch_fallback_actiont fallback_action); goto_programt::targett remove_virtual_function( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const irep_idt &function_id, goto_programt &goto_program, goto_programt::targett instruction, diff --git a/src/goto-programs/resolve_inherited_component.cpp b/src/goto-programs/resolve_inherited_component.cpp index 22004763199..4a264460685 100644 --- a/src/goto-programs/resolve_inherited_component.cpp +++ b/src/goto-programs/resolve_inherited_component.cpp @@ -10,14 +10,12 @@ Author: Diffblue Ltd. #include #include -#include - -#include +#include /// See the operator() method comment /// \param symbol_table: The symbol table to resolve the component against resolve_inherited_componentt::resolve_inherited_componentt( - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) : symbol_table(symbol_table) { } @@ -128,7 +126,7 @@ optionalt get_inherited_method_implementation( const irep_idt &call_basename, const irep_idt &classname, - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { resolve_inherited_componentt call_resolver{symbol_table}; auto exclude_abstract_methods = [&](const symbolt &symbol) { diff --git a/src/goto-programs/resolve_inherited_component.h b/src/goto-programs/resolve_inherited_component.h index fc61bc77756..26210b59aff 100644 --- a/src/goto-programs/resolve_inherited_component.h +++ b/src/goto-programs/resolve_inherited_component.h @@ -19,12 +19,12 @@ Author: Diffblue Ltd. #include class symbolt; -class symbol_tablet; +class symbol_table_baset; class resolve_inherited_componentt { public: - explicit resolve_inherited_componentt(const symbol_tablet &symbol_table); + explicit resolve_inherited_componentt(const symbol_table_baset &symbol_table); class inherited_componentt { @@ -59,13 +59,13 @@ class resolve_inherited_componentt const irep_idt &class_name, const irep_idt &component_name); private: - const symbol_tablet &symbol_table; + const symbol_table_baset &symbol_table; }; optionalt get_inherited_method_implementation( const irep_idt &call_basename, const irep_idt &classname, - const symbol_tablet &symbol_table); + const symbol_table_baset &symbol_table); #endif // CPROVER_GOTO_PROGRAMS_RESOLVE_INHERITED_COMPONENT_H diff --git a/src/goto-programs/show_symbol_table.cpp b/src/goto-programs/show_symbol_table.cpp index 85e7049f4cb..4a5b870ab60 100644 --- a/src/goto-programs/show_symbol_table.cpp +++ b/src/goto-programs/show_symbol_table.cpp @@ -11,7 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "show_symbol_table.h" -#include #include #include @@ -46,7 +45,7 @@ void show_symbol_table_xml_ui() } void show_symbol_table_brief_plain( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, std::ostream &out) { // we want to sort alphabetically @@ -68,7 +67,7 @@ void show_symbol_table_brief_plain( } void show_symbol_table_plain( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, std::ostream &out) { out << '\n' << "Symbols:" << '\n' << '\n'; @@ -140,7 +139,7 @@ void show_symbol_table_plain( } static void show_symbol_table_json_ui( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, ui_message_handlert &message_handler) { json_stream_arrayt &out = message_handler.get_json_stream(); @@ -202,7 +201,7 @@ static void show_symbol_table_json_ui( } static void show_symbol_table_brief_json_ui( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, ui_message_handlert &message_handler) { json_stream_arrayt &out = message_handler.get_json_stream(); @@ -240,7 +239,7 @@ static void show_symbol_table_brief_json_ui( } void show_symbol_table( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, ui_message_handlert &ui) { switch(ui.get_ui()) @@ -267,7 +266,7 @@ void show_symbol_table( } void show_symbol_table_brief( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, ui_message_handlert &ui) { switch(ui.get_ui()) diff --git a/src/goto-programs/show_symbol_table.h b/src/goto-programs/show_symbol_table.h index 7b18a8df980..b7575e4d33c 100644 --- a/src/goto-programs/show_symbol_table.h +++ b/src/goto-programs/show_symbol_table.h @@ -13,15 +13,13 @@ Author: Daniel Kroening, kroening@kroening.com #define CPROVER_GOTO_PROGRAMS_SHOW_SYMBOL_TABLE_H class goto_modelt; -class symbol_tablet; +class symbol_table_baset; class ui_message_handlert; -void show_symbol_table( - const symbol_tablet &, - ui_message_handlert &ui); +void show_symbol_table(const symbol_table_baset &, ui_message_handlert &ui); void show_symbol_table_brief( - const symbol_tablet &, + const symbol_table_baset &, ui_message_handlert &ui); void show_symbol_table( diff --git a/src/goto-programs/string_abstraction.h b/src/goto-programs/string_abstraction.h index 2be7f6e1c2c..f518a7015b1 100644 --- a/src/goto-programs/string_abstraction.h +++ b/src/goto-programs/string_abstraction.h @@ -21,7 +21,6 @@ Author: Daniel Kroening, kroening@kroening.com #include -class goto_functionst; class goto_modelt; class message_handlert; diff --git a/src/goto-programs/string_instrumentation.cpp b/src/goto-programs/string_instrumentation.cpp index 2c5424e6b61..686885fc47c 100644 --- a/src/goto-programs/string_instrumentation.cpp +++ b/src/goto-programs/string_instrumentation.cpp @@ -19,7 +19,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include @@ -53,7 +52,7 @@ exprt buffer_size(const exprt &what) class string_instrumentationt { public: - explicit string_instrumentationt(symbol_tablet &_symbol_table) + explicit string_instrumentationt(symbol_table_baset &_symbol_table) : symbol_table(_symbol_table), ns(_symbol_table) { } @@ -62,7 +61,7 @@ class string_instrumentationt void operator()(goto_functionst &dest); protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; namespacet ns; void make_type(exprt &dest, const typet &type) @@ -160,7 +159,7 @@ class string_instrumentationt }; void string_instrumentation( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_programt &dest) { string_instrumentationt string_instrumentation{symbol_table}; @@ -168,7 +167,7 @@ void string_instrumentation( } void string_instrumentation( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, goto_functionst &dest) { string_instrumentationt string_instrumentation{symbol_table}; diff --git a/src/goto-programs/string_instrumentation.h b/src/goto-programs/string_instrumentation.h index 19b3a17ca04..646f803e3c8 100644 --- a/src/goto-programs/string_instrumentation.h +++ b/src/goto-programs/string_instrumentation.h @@ -16,15 +16,11 @@ class exprt; class goto_functionst; class goto_modelt; class goto_programt; -class symbol_tablet; +class symbol_table_baset; -void string_instrumentation( - symbol_tablet &, - goto_programt &); +void string_instrumentation(symbol_table_baset &, goto_programt &); -void string_instrumentation( - symbol_tablet &, - goto_functionst &); +void string_instrumentation(symbol_table_baset &, goto_functionst &); void string_instrumentation(goto_modelt &); diff --git a/src/goto-programs/system_library_symbols.cpp b/src/goto-programs/system_library_symbols.cpp index cf20cebab35..779a0d5671a 100644 --- a/src/goto-programs/system_library_symbols.cpp +++ b/src/goto-programs/system_library_symbols.cpp @@ -14,7 +14,6 @@ Author: Thomas Kiley #include #include #include -#include #include system_library_symbolst::system_library_symbolst(bool init): diff --git a/src/goto-programs/system_library_symbols.h b/src/goto-programs/system_library_symbols.h index a9cf0f22392..b32fc64c921 100644 --- a/src/goto-programs/system_library_symbols.h +++ b/src/goto-programs/system_library_symbols.h @@ -19,7 +19,6 @@ Author: Thomas Kiley #include class symbolt; -class typet; class system_library_symbolst { diff --git a/src/goto-programs/validate_code.cpp b/src/goto-programs/validate_code.cpp index 278b0b00988..8c8c22d6181 100644 --- a/src/goto-programs/validate_code.cpp +++ b/src/goto-programs/validate_code.cpp @@ -12,11 +12,11 @@ Author: Daniel Poetzl # include #endif -#include "goto_instruction_code.h" - -#include +#include // IWYU pragma: keep #include +#include "goto_instruction_code.h" // IWYU pragma: keep + #define CALL_ON_CODE(code_type) \ C()(code, std::forward(args)...) diff --git a/src/goto-programs/validate_goto_model.cpp b/src/goto-programs/validate_goto_model.cpp index d9bee1f2107..2c44733b30d 100644 --- a/src/goto-programs/validate_goto_model.cpp +++ b/src/goto-programs/validate_goto_model.cpp @@ -9,8 +9,6 @@ Date: Oct 2018 #include "validate_goto_model.h" -#include - #include #include "goto_functions.h" diff --git a/src/goto-programs/write_goto_binary.cpp b/src/goto-programs/write_goto_binary.cpp index 939ddf046b4..8c5ecffbcc1 100644 --- a/src/goto-programs/write_goto_binary.cpp +++ b/src/goto-programs/write_goto_binary.cpp @@ -16,14 +16,13 @@ Author: CM Wintersteiger #include #include #include -#include #include /// Writes a goto program to disc, using goto binary format bool write_goto_binary( std::ostream &out, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const goto_functionst &goto_functions, irep_serializationt &irepconverter) { @@ -140,7 +139,7 @@ bool write_goto_binary( /// Writes a goto program to disc bool write_goto_binary( std::ostream &out, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const goto_functionst &goto_functions, int version) { diff --git a/src/goto-programs/write_goto_binary.h b/src/goto-programs/write_goto_binary.h index 048cece7418..d0f61c5eccf 100644 --- a/src/goto-programs/write_goto_binary.h +++ b/src/goto-programs/write_goto_binary.h @@ -20,7 +20,7 @@ Author: CM Wintersteiger class goto_functionst; class goto_modelt; class message_handlert; -class symbol_tablet; +class symbol_table_baset; bool write_goto_binary( std::ostream &out, @@ -29,9 +29,9 @@ bool write_goto_binary( bool write_goto_binary( std::ostream &out, - const symbol_tablet &, + const symbol_table_baset &, const goto_functionst &, - int version=GOTO_BINARY_VERSION); + int version = GOTO_BINARY_VERSION); bool write_goto_binary( const std::string &filename, diff --git a/src/goto-programs/xml_goto_trace.cpp b/src/goto-programs/xml_goto_trace.cpp index 9f29a66bfee..498f59d91f1 100644 --- a/src/goto-programs/xml_goto_trace.cpp +++ b/src/goto-programs/xml_goto_trace.cpp @@ -14,6 +14,7 @@ Author: Daniel Kroening #include "xml_goto_trace.h" #include +#include #include #include #include diff --git a/src/goto-symex/auto_objects.cpp b/src/goto-symex/auto_objects.cpp index 66efc026a74..a5099b2ff57 100644 --- a/src/goto-symex/auto_objects.cpp +++ b/src/goto-symex/auto_objects.cpp @@ -15,7 +15,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include exprt goto_symext::make_auto_object(const typet &type, statet &state) { diff --git a/src/goto-symex/build_goto_trace.cpp b/src/goto-symex/build_goto_trace.cpp index 1f3e3e5741a..be66d245d7c 100644 --- a/src/goto-symex/build_goto_trace.cpp +++ b/src/goto-symex/build_goto_trace.cpp @@ -15,6 +15,7 @@ Author: Daniel Kroening #include #include +#include #include #include diff --git a/src/goto-symex/complexity_limiter.cpp b/src/goto-symex/complexity_limiter.cpp index 35c784e5800..00e47c5b4f9 100644 --- a/src/goto-symex/complexity_limiter.cpp +++ b/src/goto-symex/complexity_limiter.cpp @@ -7,7 +7,11 @@ Author: John Dumbell \*******************************************************************/ #include "complexity_limiter.h" + +#include + #include "goto_symex_state.h" + #include complexity_limitert::complexity_limitert( diff --git a/src/goto-symex/complexity_limiter.h b/src/goto-symex/complexity_limiter.h index a517e686c11..c893f330ed0 100644 --- a/src/goto-symex/complexity_limiter.h +++ b/src/goto-symex/complexity_limiter.h @@ -12,6 +12,8 @@ Author: John Dumbell #ifndef CPROVER_GOTO_SYMEX_COMPLEXITY_LIMITER_H #define CPROVER_GOTO_SYMEX_COMPLEXITY_LIMITER_H +#include + #include "complexity_violation.h" #include "symex_complexity_limit_exceeded_action.h" diff --git a/src/goto-symex/goto_symex.h b/src/goto-symex/goto_symex.h index c7fb2d37abe..cfbabc63786 100644 --- a/src/goto-symex/goto_symex.h +++ b/src/goto-symex/goto_symex.h @@ -16,9 +16,9 @@ Author: Daniel Kroening, kroening@kroening.com #include "complexity_limiter.h" #include "symex_config.h" +#include "symex_target_equation.h" class address_of_exprt; -class code_function_callt; class function_application_exprt; class goto_symex_statet; class path_storaget; @@ -48,7 +48,7 @@ class goto_symext /// \param guard_manager: Manager for creating guards goto_symext( message_handlert &mh, - const symbol_tablet &outer_symbol_table, + const symbol_table_baset &outer_symbol_table, symex_target_equationt &_target, const optionst &options, path_storaget &path_storage, @@ -107,7 +107,7 @@ class goto_symext /// Puts the initial state of the entry point function into the path storage virtual void initialize_path_storage_from_entry_point_of( const get_goto_functiont &get_goto_function, - symbol_tablet &new_symbol_table); + symbol_table_baset &new_symbol_table); /// Performs symbolic execution using a state and equation that have /// already been used to symbolically execute part of the program. The state @@ -231,7 +231,7 @@ class goto_symext /// part of symbolic execution added to it; those object are stored in the /// symbol table passed as the `new_symbol_table` argument to the `symex_*` /// methods. - const symbol_tablet &outer_symbol_table; + const symbol_table_baset &outer_symbol_table; /// Initialized just before symbolic execution begins, to point to /// both `outer_symbol_table` and the symbol table owned by the diff --git a/src/goto-symex/goto_symex_state.cpp b/src/goto-symex/goto_symex_state.cpp index 06f7e304d68..670f94bfa02 100644 --- a/src/goto-symex/goto_symex_state.cpp +++ b/src/goto-symex/goto_symex_state.cpp @@ -10,12 +10,9 @@ Author: Daniel Kroening, kroening@kroening.com /// Symbolic Execution #include "goto_symex_state.h" -#include "goto_symex_is_constant.h" - -#include #include -#include +#include // IWYU pragma: keep #include #include #include @@ -26,6 +23,9 @@ Author: Daniel Kroening, kroening@kroening.com #include #include +#include "goto_symex_is_constant.h" +#include "symex_target_equation.h" + static void get_l1_name(exprt &expr); goto_symex_statet::goto_symex_statet( diff --git a/src/goto-symex/goto_symex_state.h b/src/goto-symex/goto_symex_state.h index 5ed069374e1..00d145ab96d 100644 --- a/src/goto-symex/goto_symex_state.h +++ b/src/goto-symex/goto_symex_state.h @@ -12,23 +12,24 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_SYMEX_GOTO_SYMEX_STATE_H #define CPROVER_GOTO_SYMEX_GOTO_SYMEX_STATE_H -#include -#include - -#include - #include #include #include #include +#include + +#include #include "call_stack.h" #include "field_sensitivity.h" #include "goto_state.h" #include "renaming_level.h" -#include "symex_target_equation.h" + +#include +#include class incremental_dirtyt; +class symex_target_equationt; /// \brief Central data structure: state. /// diff --git a/src/goto-symex/path_storage.h b/src/goto-symex/path_storage.h index 46f6c5ebf9c..1b230776cd5 100644 --- a/src/goto-symex/path_storage.h +++ b/src/goto-symex/path_storage.h @@ -8,13 +8,13 @@ #include #include -#include - -#include +#include // IWYU pragma: keep #include "goto_symex_state.h" #include "symex_target_equation.h" +#include + class cmdlinet; class optionst; diff --git a/src/goto-symex/postcondition.cpp b/src/goto-symex/postcondition.cpp index f262c597f2d..74d23019bbf 100644 --- a/src/goto-symex/postcondition.cpp +++ b/src/goto-symex/postcondition.cpp @@ -13,7 +13,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include #include #include diff --git a/src/goto-symex/show_program.cpp b/src/goto-symex/show_program.cpp index 06f0ea71840..13c409ea197 100644 --- a/src/goto-symex/show_program.cpp +++ b/src/goto-symex/show_program.cpp @@ -11,16 +11,15 @@ Author: Daniel Kroening, kroening@kroening.com #include "show_program.h" -#include -#include +#include // IWYU pragma: keep +#include +#include #include - #include -#include -#include -#include +#include // IWYU pragma: keep +#include /// Output a single SSA step /// \param ns: Namespace diff --git a/src/goto-symex/show_vcc.cpp b/src/goto-symex/show_vcc.cpp index 33c4d9d300f..201bcd93885 100644 --- a/src/goto-symex/show_vcc.cpp +++ b/src/goto-symex/show_vcc.cpp @@ -10,16 +10,17 @@ Author: Daniel Kroening, kroening@kroening.com /// Output of the verification conditions (VCCs) #include "show_vcc.h" -#include "symex_target_equation.h" - -#include -#include #include #include #include #include +#include "symex_target_equation.h" + +#include // IWYU pragma: keep +#include + /// Output equations from \p equation in plain text format to the given output /// stream \p out. /// Each equation is prefixed by a negative index, formatted `{-N}` diff --git a/src/goto-symex/solver_hardness.cpp b/src/goto-symex/solver_hardness.cpp index ef8fcb4a951..2b5e8b5ffc3 100644 --- a/src/goto-symex/solver_hardness.cpp +++ b/src/goto-symex/solver_hardness.cpp @@ -8,14 +8,15 @@ Author: Diffblue Ltd. #include "solver_hardness.h" -#include - #include #include #include #include #include +#include +#include + solver_hardnesst::sat_hardnesst &solver_hardnesst::sat_hardnesst:: operator+=(const solver_hardnesst::sat_hardnesst &other) { diff --git a/src/goto-symex/solver_hardness.h b/src/goto-symex/solver_hardness.h index 3b80855dcd0..4515bcdb1c2 100644 --- a/src/goto-symex/solver_hardness.h +++ b/src/goto-symex/solver_hardness.h @@ -12,7 +12,6 @@ Author: Diffblue Ltd. #include #include -#include #include #include #include @@ -20,8 +19,6 @@ Author: Diffblue Ltd. #include -#include - /// A structure that facilitates collecting the complexity statistics from a /// decision procedure. The idea is to associate some solver complexity metric /// with each line-of-code, GOTO instruction, and SSA step. The motivation is to diff --git a/src/goto-symex/ssa_step.cpp b/src/goto-symex/ssa_step.cpp index df392982769..64674134c8b 100644 --- a/src/goto-symex/ssa_step.cpp +++ b/src/goto-symex/ssa_step.cpp @@ -9,6 +9,7 @@ Author: Romain Brenguier #include "ssa_step.h" #include +#include void SSA_stept::output(std::ostream &out) const { diff --git a/src/goto-symex/symex_config.h b/src/goto-symex/symex_config.h index 9f292e7f014..0680d648fd9 100644 --- a/src/goto-symex/symex_config.h +++ b/src/goto-symex/symex_config.h @@ -12,6 +12,8 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_GOTO_SYMEX_SYMEX_CONFIG_H #define CPROVER_GOTO_SYMEX_SYMEX_CONFIG_H +class optionst; + /// Configuration used for a symbolic execution struct symex_configt final { diff --git a/src/goto-symex/symex_dereference_state.cpp b/src/goto-symex/symex_dereference_state.cpp index 363b61eabc8..835256d91f2 100644 --- a/src/goto-symex/symex_dereference_state.cpp +++ b/src/goto-symex/symex_dereference_state.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "symex_dereference_state.h" -#include - /// Get or create a failed symbol for the given pointer-typed expression. These /// are used as placeholders when dereferencing expressions that are illegal to /// dereference, such as null pointers. The \ref add_failed_symbols pass must diff --git a/src/goto-symex/symex_function_call.cpp b/src/goto-symex/symex_function_call.cpp index 096fe555ee4..b1db3d9b949 100644 --- a/src/goto-symex/symex_function_call.cpp +++ b/src/goto-symex/symex_function_call.cpp @@ -17,7 +17,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include diff --git a/src/goto-symex/symex_main.cpp b/src/goto-symex/symex_main.cpp index b23e59e0ebc..d6462d946df 100644 --- a/src/goto-symex/symex_main.cpp +++ b/src/goto-symex/symex_main.cpp @@ -25,7 +25,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include "path_storage.h" @@ -338,7 +337,7 @@ void goto_symext::symex_with_state( ~reset_namespacet() { // Get symbol table 1, the outer symbol table from the GOTO program - const symbol_tablet &st = ns.get_symbol_table(); + const symbol_table_baset &st = ns.get_symbol_table(); // Move a new namespace containing this symbol table over the top of the // current one ns = namespacet(st); @@ -478,7 +477,7 @@ void goto_symext::symex_from_entry_point_of( void goto_symext::initialize_path_storage_from_entry_point_of( const get_goto_functiont &get_goto_function, - symbol_tablet &new_symbol_table) + symbol_table_baset &new_symbol_table) { auto state = initialize_entry_point_state(get_goto_function); diff --git a/src/jsil/jsil_convert.cpp b/src/jsil/jsil_convert.cpp index 1e9f66c945c..5317d6f93b0 100644 --- a/src/jsil/jsil_convert.cpp +++ b/src/jsil/jsil_convert.cpp @@ -11,24 +11,25 @@ Author: Michael Tautschnig, tautschn@amazon.com #include "jsil_convert.h" -#include - #include -#include +#include + +#include #include "jsil_parse_tree.h" class jsil_convertt { public: - jsil_convertt(symbol_tablet &_symbol_table) : symbol_table(_symbol_table) + explicit jsil_convertt(symbol_table_baset &_symbol_table) + : symbol_table(_symbol_table) { } bool operator()(const jsil_parse_treet &parse_tree, message_handlert &); protected: - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; bool convert_code(const symbolt &symbol, codet &code); }; @@ -116,7 +117,7 @@ bool jsil_convertt::convert_code(const symbolt &symbol, codet &code) bool jsil_convert( const jsil_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { jsil_convertt jsil_convert{symbol_table}; diff --git a/src/jsil/jsil_convert.h b/src/jsil/jsil_convert.h index 601d64e1b35..96ca67858fc 100644 --- a/src/jsil/jsil_convert.h +++ b/src/jsil/jsil_convert.h @@ -14,11 +14,11 @@ Author: Michael Tautschnig, tautschn@amazon.com class jsil_parse_treet; class message_handlert; -class symbol_tablet; +class symbol_table_baset; bool jsil_convert( const jsil_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler); #endif // CPROVER_JSIL_JSIL_CONVERT_H diff --git a/src/jsil/jsil_entry_point.cpp b/src/jsil/jsil_entry_point.cpp index f4278bf9369..ce13f1e597a 100644 --- a/src/jsil/jsil_entry_point.cpp +++ b/src/jsil/jsil_entry_point.cpp @@ -14,16 +14,17 @@ Author: Michael Tautschnig, tautschn@amazon.com #include #include #include +#include #include #include -#include +#include #include #include #include -static void create_initialize(symbol_tablet &symbol_table) +static void create_initialize(symbol_table_baset &symbol_table) { symbolt initialize; initialize.name = INITIALIZE_FUNCTION; @@ -49,7 +50,7 @@ static void create_initialize(symbol_tablet &symbol_table) } bool jsil_entry_point( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { // check if main is already there @@ -68,7 +69,7 @@ bool jsil_entry_point( equal_range(symbol_table.symbol_base_map, config.main.value())) { // look it up - symbol_tablet::symbolst::const_iterator s_it = + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(symbol_name_entry.second); if(s_it==symbol_table.symbols.end()) @@ -100,7 +101,7 @@ bool jsil_entry_point( main_symbol=ID_main; // look it up - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(main_symbol); if(s_it==symbol_table.symbols.end()) @@ -129,7 +130,7 @@ bool jsil_entry_point( // build call to initialization function { - symbol_tablet::symbolst::const_iterator init_it= + symbol_table_baset::symbolst::const_iterator init_it = symbol_table.symbols.find(INITIALIZE_FUNCTION); if(init_it==symbol_table.symbols.end()) diff --git a/src/jsil/jsil_entry_point.h b/src/jsil/jsil_entry_point.h index 382441d2fa9..6dfd4b9c57d 100644 --- a/src/jsil/jsil_entry_point.h +++ b/src/jsil/jsil_entry_point.h @@ -13,7 +13,7 @@ Author: Michael Tautschnig, tautschn@amazon.com #define CPROVER_JSIL_JSIL_ENTRY_POINT_H bool jsil_entry_point( - class symbol_tablet &symbol_table, + class symbol_table_baset &symbol_table, class message_handlert &message_handler); #endif // CPROVER_JSIL_JSIL_ENTRY_POINT_H diff --git a/src/jsil/jsil_internal_additions.cpp b/src/jsil/jsil_internal_additions.cpp index 2583361d128..5123e0535c1 100644 --- a/src/jsil/jsil_internal_additions.cpp +++ b/src/jsil/jsil_internal_additions.cpp @@ -11,17 +11,15 @@ Author: Michael Tautschnig, tautschn@amazon.com #include "jsil_internal_additions.h" -#include - +#include #include -#include -#include +#include -#include +#include #include "jsil_types.h" -void jsil_internal_additions(symbol_tablet &dest) +void jsil_internal_additions(symbol_table_baset &dest) { // add __CPROVER_rounding_mode diff --git a/src/jsil/jsil_internal_additions.h b/src/jsil/jsil_internal_additions.h index 1aed9edd692..c85f8905c3c 100644 --- a/src/jsil/jsil_internal_additions.h +++ b/src/jsil/jsil_internal_additions.h @@ -12,8 +12,8 @@ Author: Michael Tautschnig, tautschn@amazon.com #ifndef CPROVER_JSIL_JSIL_INTERNAL_ADDITIONS_H #define CPROVER_JSIL_JSIL_INTERNAL_ADDITIONS_H -class symbol_tablet; +class symbol_table_baset; -void jsil_internal_additions(symbol_tablet &dest); +void jsil_internal_additions(symbol_table_baset &dest); #endif // CPROVER_JSIL_JSIL_INTERNAL_ADDITIONS_H diff --git a/src/jsil/jsil_language.cpp b/src/jsil/jsil_language.cpp index 1ab3a9b4821..e9411b40575 100644 --- a/src/jsil/jsil_language.cpp +++ b/src/jsil/jsil_language.cpp @@ -11,8 +11,8 @@ Author: Michael Tautschnig, tautschn@amazon.com #include "jsil_language.h" -#include #include +#include #include "expr2jsil.h" #include "jsil_convert.h" @@ -32,7 +32,7 @@ void jsil_languaget::modules_provided(std::set &modules) } /// Adding symbols for all procedure declarations -bool jsil_languaget::interfaces(symbol_tablet &symbol_table) +bool jsil_languaget::interfaces(symbol_table_baset &symbol_table) { if(jsil_convert(parse_tree, symbol_table, get_message_handler())) return true; @@ -77,7 +77,7 @@ bool jsil_languaget::parse( /// Converting from parse tree and type checking. bool jsil_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &) { if(jsil_typecheck(symbol_table, get_message_handler())) @@ -87,7 +87,7 @@ bool jsil_languaget::typecheck( } bool jsil_languaget::generate_support_functions( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { return jsil_entry_point( symbol_table, diff --git a/src/jsil/jsil_language.h b/src/jsil/jsil_language.h index 8b902b86ded..7138620118b 100644 --- a/src/jsil/jsil_language.h +++ b/src/jsil/jsil_language.h @@ -23,53 +23,48 @@ Author: Michael Tautschnig, tautschn@amazon.com class jsil_languaget:public languaget { public: - virtual bool preprocess( + bool preprocess( std::istream &instream, const std::string &path, std::ostream &outstream) override; - virtual bool parse( - std::istream &instream, - const std::string &path) override; + bool parse(std::istream &instream, const std::string &path) override; - virtual bool generate_support_functions( - symbol_tablet &symbol_table) override; + bool generate_support_functions(symbol_table_baset &symbol_table) override; - virtual bool typecheck( - symbol_tablet &context, - const std::string &module) override; + bool + typecheck(symbol_table_baset &context, const std::string &module) override; - virtual void show_parse(std::ostream &out) override; + void show_parse(std::ostream &out) override; virtual ~jsil_languaget(); jsil_languaget() { } - virtual bool from_expr( - const exprt &expr, - std::string &code, - const namespacet &ns) override; + bool from_expr(const exprt &expr, std::string &code, const namespacet &ns) + override; - virtual bool from_type( - const typet &type, - std::string &code, - const namespacet &ns) override; + bool from_type(const typet &type, std::string &code, const namespacet &ns) + override; - virtual bool to_expr( + bool to_expr( const std::string &code, const std::string &module, exprt &expr, const namespacet &ns) override; - virtual std::unique_ptr new_language() override + std::unique_ptr new_language() override { return util_make_unique(); } - virtual std::string id() const override { return "jsil"; } - virtual std::string description() const override + std::string id() const override + { + return "jsil"; + } + std::string description() const override { return "Javascript Intermediate Language"; } - virtual std::set extensions() const override; + std::set extensions() const override; - virtual void modules_provided(std::set &modules) override; - virtual bool interfaces(symbol_tablet &symbol_table) override; + void modules_provided(std::set &modules) override; + bool interfaces(symbol_table_baset &symbol_table) override; protected: jsil_parse_treet parse_tree; diff --git a/src/jsil/jsil_typecheck.cpp b/src/jsil/jsil_typecheck.cpp index aa9e5122b86..458b3bde834 100644 --- a/src/jsil/jsil_typecheck.cpp +++ b/src/jsil/jsil_typecheck.cpp @@ -567,7 +567,7 @@ void jsil_typecheckt::typecheck_symbol_expr(symbol_exprt &symbol_expr) identifier=="eval" || identifier=="nan") { - symbol_tablet::symbolst::const_iterator s_it= + symbol_table_baset::symbolst::const_iterator s_it = symbol_table.symbols.find(identifier); if(s_it==symbol_table.symbols.end()) @@ -595,8 +595,8 @@ void jsil_typecheckt::typecheck_symbol_expr(symbol_exprt &symbol_expr) symbol_expr.set_identifier(identifier); } - symbol_tablet::symbolst::const_iterator s_it= - symbol_table.symbols.find(identifier); + symbol_table_baset::symbolst::const_iterator s_it = + symbol_table.symbols.find(identifier); if(s_it==symbol_table.symbols.end()) { @@ -898,7 +898,7 @@ void jsil_typecheckt::typecheck() } bool jsil_typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { jsil_typecheckt jsil_typecheck(symbol_table, message_handler); diff --git a/src/jsil/jsil_typecheck.h b/src/jsil/jsil_typecheck.h index 64b2e362b5a..248078de577 100644 --- a/src/jsil/jsil_typecheck.h +++ b/src/jsil/jsil_typecheck.h @@ -26,10 +26,10 @@ class codet; class message_handlert; class side_effect_expr_throwt; class symbol_exprt; -class symbol_tablet; +class symbol_table_baset; bool jsil_typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler); bool jsil_typecheck( diff --git a/src/jsil/scanner.l b/src/jsil/scanner.l index 8122866bced..1ed37abebfa 100755 --- a/src/jsil/scanner.l +++ b/src/jsil/scanner.l @@ -40,9 +40,9 @@ static int make_identifier() return TOK_IDENTIFIER; } -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep %} diff --git a/src/json-symtab-language/json_symbol_table.cpp b/src/json-symtab-language/json_symbol_table.cpp index b2c9b317d4d..04227f71fbe 100644 --- a/src/json-symtab-language/json_symbol_table.cpp +++ b/src/json-symtab-language/json_symbol_table.cpp @@ -7,13 +7,14 @@ Author: Chris Smowton, chris.smowton@diffblue.com \*******************************************************************/ #include "json_symbol_table.h" -#include "json_symbol.h" #include #include -#include +#include + +#include "json_symbol.h" -void symbol_table_from_json(const jsont &in, symbol_tablet &symbol_table) +void symbol_table_from_json(const jsont &in, symbol_table_baset &symbol_table) { if(!in.is_object()) { diff --git a/src/json-symtab-language/json_symbol_table.h b/src/json-symtab-language/json_symbol_table.h index 42e14a3ef54..f1aad11704c 100644 --- a/src/json-symtab-language/json_symbol_table.h +++ b/src/json-symtab-language/json_symbol_table.h @@ -10,8 +10,8 @@ Author: Chris Smowton, chris.smowton@diffblue.com #define CPROVER_JSON_SYMTAB_LANGUAGE_JSON_SYMBOL_TABLE_H class jsont; -class symbol_tablet; +class symbol_table_baset; -void symbol_table_from_json(const jsont &, symbol_tablet &); +void symbol_table_from_json(const jsont &, symbol_table_baset &); #endif diff --git a/src/json-symtab-language/json_symtab_language.cpp b/src/json-symtab-language/json_symtab_language.cpp index ed626ca301a..4bd0e6ef83b 100644 --- a/src/json-symtab-language/json_symtab_language.cpp +++ b/src/json-symtab-language/json_symtab_language.cpp @@ -9,11 +9,14 @@ Author: Chris Smowton, chris.smowton@diffblue.com \*******************************************************************/ #include "json_symtab_language.h" -#include "json_symbol_table.h" -#include +#include + +#include #include +#include "json_symbol_table.h" + /// Parse a goto program in json form. /// \param instream: The input stream /// \param path: A file path @@ -30,7 +33,7 @@ bool json_symtab_languaget::parse( /// \param module: A useless parameter, there for interface consistency. /// \return boolean signifying success or failure of the typechecking. bool json_symtab_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module) { (void)module; // unused parameter diff --git a/src/json-symtab-language/json_symtab_language.h b/src/json-symtab-language/json_symtab_language.h index 20508242ca0..cea1ceefb89 100644 --- a/src/json-symtab-language/json_symtab_language.h +++ b/src/json-symtab-language/json_symtab_language.h @@ -11,23 +11,24 @@ Author: Chris Smowton, chris.smowton@diffblue.com #ifndef CPROVER_JSON_SYMTAB_LANGUAGE_JSON_SYMTAB_LANGUAGE_H #define CPROVER_JSON_SYMTAB_LANGUAGE_JSON_SYMTAB_LANGUAGE_H -#include -#include +#include +#include +#include #include + #include -#include -#include -#include +#include +#include class json_symtab_languaget : public languaget { public: bool parse(std::istream &instream, const std::string &path) override; - bool - typecheck(symbol_tablet &symbol_table, const std::string &module) override; + bool typecheck(symbol_table_baset &symbol_table, const std::string &module) + override; void show_parse(std::ostream &out) override; @@ -57,7 +58,7 @@ class json_symtab_languaget : public languaget return util_make_unique(); } - bool generate_support_functions(symbol_tablet &symbol_table) override + bool generate_support_functions(symbol_table_baset &symbol_table) override { // check if entry point is already there bool entry_point_exists = diff --git a/src/json/scanner.l b/src/json/scanner.l index 599434b1143..c10efc414fb 100755 --- a/src/json/scanner.l +++ b/src/json/scanner.l @@ -29,9 +29,9 @@ #include "json_parser.h" #include "json_y.tab.h" -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep %} diff --git a/src/langapi/language.cpp b/src/langapi/language.cpp index 4f5771698d9..b9bb5ab38ea 100644 --- a/src/langapi/language.cpp +++ b/src/langapi/language.cpp @@ -18,7 +18,7 @@ bool languaget::final(symbol_table_baset &) return false; } -bool languaget::interfaces(symbol_tablet &) +bool languaget::interfaces(symbol_table_baset &) { return false; } diff --git a/src/langapi/language.h b/src/langapi/language.h index a33304d941c..8ad3c33efa8 100644 --- a/src/langapi/language.h +++ b/src/langapi/language.h @@ -25,7 +25,6 @@ class exprt; class namespacet; class optionst; class symbol_table_baset; -class symbol_tablet; class typet; #define OPT_FUNCTIONS \ @@ -68,8 +67,7 @@ class languaget:public messaget /// complete. Functions introduced here are visible to lazy loading and /// can influence its decisions (e.g. picking the types of input parameters /// and globals), whereas anything introduced during `final` cannot. - virtual bool generate_support_functions( - symbol_tablet &symbol_table)=0; + virtual bool generate_support_functions(symbol_table_baset &symbol_table) = 0; // add external dependencies of a given module to set @@ -113,14 +111,12 @@ class languaget:public messaget // type check interfaces of currently parsed file - virtual bool interfaces( - symbol_tablet &symbol_table); + virtual bool interfaces(symbol_table_baset &symbol_table); // type check a module in the currently parsed file - virtual bool typecheck( - symbol_tablet &symbol_table, - const std::string &module)=0; + virtual bool + typecheck(symbol_table_baset &symbol_table, const std::string &module) = 0; /// \brief Is it possible to call three-argument typecheck() on this object? virtual bool can_keep_file_local() @@ -138,7 +134,7 @@ class languaget:public messaget /// This function should only be called on objects for which a call to /// can_keep_symbols() returns `true`. virtual bool typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) { diff --git a/src/langapi/language_file.cpp b/src/langapi/language_file.cpp index 440d682a9d8..931f29e69d7 100644 --- a/src/langapi/language_file.cpp +++ b/src/langapi/language_file.cpp @@ -81,7 +81,7 @@ bool language_filest::parse() } bool language_filest::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const bool keep_file_local) { // typecheck interfaces @@ -161,7 +161,7 @@ bool language_filest::typecheck( } bool language_filest::generate_support_functions( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { std::set languages; @@ -189,8 +189,7 @@ bool language_filest::final(symbol_table_baset &symbol_table) return false; } -bool language_filest::interfaces( - symbol_tablet &symbol_table) +bool language_filest::interfaces(symbol_table_baset &symbol_table) { for(auto &file : file_map) { @@ -202,7 +201,7 @@ bool language_filest::interfaces( } bool language_filest::typecheck_module( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) { @@ -220,7 +219,7 @@ bool language_filest::typecheck_module( } bool language_filest::typecheck_module( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, language_modulet &module, const bool keep_file_local) { diff --git a/src/langapi/language_file.h b/src/langapi/language_file.h index 4aa9f9a1a25..186cb14a561 100644 --- a/src/langapi/language_file.h +++ b/src/langapi/language_file.h @@ -22,7 +22,6 @@ Author: Daniel Kroening, kroening@kroening.com class language_filet; class languaget; -class symbol_tablet; class language_modulet final { @@ -106,14 +105,15 @@ class language_filest:public messaget void show_parse(std::ostream &out); - bool generate_support_functions(symbol_tablet &symbol_table); + bool generate_support_functions(symbol_table_baset &symbol_table); - bool - typecheck(symbol_tablet &symbol_table, const bool keep_file_local = false); + bool typecheck( + symbol_table_baset &symbol_table, + const bool keep_file_local = false); bool final(symbol_table_baset &symbol_table); - bool interfaces(symbol_tablet &symbol_table); + bool interfaces(symbol_table_baset &symbol_table); // The method must have been added to the symbol table and registered // in lazy_method_map (currently always in language_filest::typecheck) @@ -142,12 +142,12 @@ class language_filest:public messaget protected: bool typecheck_module( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, language_modulet &module, const bool keep_file_local); bool typecheck_module( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local); }; diff --git a/src/linking/linking.cpp b/src/linking/linking.cpp index c365be90f2e..a9d068d168a 100644 --- a/src/linking/linking.cpp +++ b/src/linking/linking.cpp @@ -19,7 +19,7 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include +#include #include @@ -1519,7 +1519,7 @@ void linkingt::typecheck() for(const auto &symbol_pair : src_symbol_table.symbols) { - symbol_tablet::symbolst::const_iterator m_it = + symbol_table_baset::symbolst::const_iterator m_it = main_symbol_table.symbols.find(symbol_pair.first); if( @@ -1544,8 +1544,8 @@ void linkingt::typecheck() } bool linking( - symbol_tablet &dest_symbol_table, - const symbol_tablet &new_symbol_table, + symbol_table_baset &dest_symbol_table, + const symbol_table_baset &new_symbol_table, message_handlert &message_handler) { linkingt linking( diff --git a/src/linking/linking.h b/src/linking/linking.h index 672c79ee502..9a26ad0a5bc 100644 --- a/src/linking/linking.h +++ b/src/linking/linking.h @@ -13,14 +13,14 @@ Author: Daniel Kroening, kroening@kroening.com #define CPROVER_LINKING_LINKING_H class message_handlert; -class symbol_tablet; +class symbol_table_baset; /// Merges the symbol table \p new_symbol_table into \p dest_symbol_table, /// renaming symbols from \p new_symbol_table when necessary. /// \return True, iff linking failed with unresolvable conflicts. bool linking( - symbol_tablet &dest_symbol_table, - const symbol_tablet &new_symbol_table, + symbol_table_baset &dest_symbol_table, + const symbol_table_baset &new_symbol_table, message_handlert &message_handler); #endif // CPROVER_LINKING_LINKING_H diff --git a/src/linking/remove_internal_symbols.cpp b/src/linking/remove_internal_symbols.cpp index 5518376d011..e26a85cbd8d 100644 --- a/src/linking/remove_internal_symbols.cpp +++ b/src/linking/remove_internal_symbols.cpp @@ -17,7 +17,7 @@ Author: Daniel Kroening #include #include #include -#include +#include #include @@ -109,7 +109,7 @@ static void get_symbols( /// \param keep_file_local: keep file-local functions with bodies even if we /// would otherwise remove them void remove_internal_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &mh, const bool keep_file_local) { @@ -132,7 +132,7 @@ void remove_internal_symbols( /// \param keep: set of symbol names to keep in the symbol table regardless /// of usage or kind void remove_internal_symbols( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &mh, const bool keep_file_local, const std::set &keep) @@ -168,9 +168,9 @@ void remove_internal_symbols( // plus any extra symbols we wish to keep special.insert(keep.begin(), keep.end()); - for(symbol_tablet::symbolst::const_iterator - it=symbol_table.symbols.begin(); - it!=symbol_table.symbols.end(); + for(symbol_table_baset::symbolst::const_iterator it = + symbol_table.symbols.begin(); + it != symbol_table.symbols.end(); it++) { // already marked? @@ -236,14 +236,13 @@ void remove_internal_symbols( } // remove all that are _not_ exported! - for(symbol_tablet::symbolst::const_iterator - it=symbol_table.symbols.begin(); - it!=symbol_table.symbols.end(); - ) // no it++ + for(symbol_table_baset::symbolst::const_iterator it = + symbol_table.symbols.begin(); + it != symbol_table.symbols.end();) // no it++ { if(exported.find(it->first)==exported.end()) { - symbol_tablet::symbolst::const_iterator next=std::next(it); + symbol_table_baset::symbolst::const_iterator next = std::next(it); symbol_table.erase(it); it=next; } diff --git a/src/linking/remove_internal_symbols.h b/src/linking/remove_internal_symbols.h index 50c5bd4e22f..7f740b6d23e 100644 --- a/src/linking/remove_internal_symbols.h +++ b/src/linking/remove_internal_symbols.h @@ -19,12 +19,12 @@ Author: Daniel Kroening class message_handlert; void remove_internal_symbols( - class symbol_tablet &symbol_table, + class symbol_table_baset &symbol_table, message_handlert &, const bool); void remove_internal_symbols( - class symbol_tablet &symbol_table, + class symbol_table_baset &symbol_table, message_handlert &, const bool keep_file_local, const std::set &keep); diff --git a/src/linking/static_lifetime_init.cpp b/src/linking/static_lifetime_init.cpp index 451922abf1a..d59a63e789d 100644 --- a/src/linking/static_lifetime_init.cpp +++ b/src/linking/static_lifetime_init.cpp @@ -14,12 +14,13 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include +#include #include -static optionalt -static_lifetime_init(const irep_idt &identifier, symbol_tablet &symbol_table) +static optionalt static_lifetime_init( + const irep_idt &identifier, + symbol_table_baset &symbol_table) { const namespacet ns(symbol_table); const symbolt &symbol = ns.lookup(identifier); @@ -92,7 +93,7 @@ static_lifetime_init(const irep_idt &identifier, symbol_tablet &symbol_table) } void static_lifetime_init( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const source_locationt &source_location) { PRECONDITION(symbol_table.has_symbol(INITIALIZE_FUNCTION)); diff --git a/src/linking/static_lifetime_init.h b/src/linking/static_lifetime_init.h index 958b555ed2e..84f5b77df98 100644 --- a/src/linking/static_lifetime_init.h +++ b/src/linking/static_lifetime_init.h @@ -13,10 +13,10 @@ Author: Daniel Kroening, kroening@kroening.com #include class source_locationt; -class symbol_tablet; +class symbol_table_baset; void static_lifetime_init( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const source_locationt &source_location); #define INITIALIZE_FUNCTION CPROVER_PREFIX "initialize" diff --git a/src/memory-analyzer/analyze_symbol.cpp b/src/memory-analyzer/analyze_symbol.cpp index b7f9c9c9da3..2bcad763224 100644 --- a/src/memory-analyzer/analyze_symbol.cpp +++ b/src/memory-analyzer/analyze_symbol.cpp @@ -22,7 +22,7 @@ Author: Malte Mues #include gdb_value_extractort::gdb_value_extractort( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const std::vector &args) : gdb_api(args), symbol_table(symbol_table), diff --git a/src/memory-analyzer/analyze_symbol.h b/src/memory-analyzer/analyze_symbol.h index 6ded9b196ae..569c0f36fe6 100644 --- a/src/memory-analyzer/analyze_symbol.h +++ b/src/memory-analyzer/analyze_symbol.h @@ -20,16 +20,12 @@ Author: Malte Mues #include -#include #include -#include -#include #include #include -class gdb_apit; -class exprt; +class pointer_typet; class source_locationt; /// Interface for extracting values from GDB (building on \ref gdb_apit) @@ -37,7 +33,7 @@ class gdb_value_extractort { public: gdb_value_extractort( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const std::vector &args); /// For each input symbol in \p symbols: map its value address to its diff --git a/src/memory-analyzer/gdb_api.cpp b/src/memory-analyzer/gdb_api.cpp index 669347b41f1..65253ae3612 100644 --- a/src/memory-analyzer/gdb_api.cpp +++ b/src/memory-analyzer/gdb_api.cpp @@ -17,8 +17,6 @@ Author: Malte Mues #include #include -#include - #include "gdb_api.h" #include diff --git a/src/memory-analyzer/gdb_api.h b/src/memory-analyzer/gdb_api.h index a672d644e3e..6edff80a536 100644 --- a/src/memory-analyzer/gdb_api.h +++ b/src/memory-analyzer/gdb_api.h @@ -20,7 +20,6 @@ Author: Malte Mues #include #include -#include #include #include diff --git a/src/memory-analyzer/memory_analyzer_parse_options.cpp b/src/memory-analyzer/memory_analyzer_parse_options.cpp index dcb0dc6de3f..37cd74a3cd3 100644 --- a/src/memory-analyzer/memory_analyzer_parse_options.cpp +++ b/src/memory-analyzer/memory_analyzer_parse_options.cpp @@ -26,8 +26,7 @@ Author: Malte Mues #include "analyze_symbol.h" -#include -#include +#include // IWYU pragma: keep #include memory_analyzer_parse_optionst::memory_analyzer_parse_optionst( diff --git a/src/nonstd/optional.hpp b/src/nonstd/optional.hpp index 816af185239..60011dff73c 100644 --- a/src/nonstd/optional.hpp +++ b/src/nonstd/optional.hpp @@ -13,6 +13,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// IWYU pragma: private, include +// IWYU pragma: private, include "optional.h" + #pragma once #ifndef NONSTD_OPTIONAL_LITE_HPP diff --git a/src/pointer-analysis/add_failed_symbols.cpp b/src/pointer-analysis/add_failed_symbols.cpp index 19e4b3ba274..659cd611e34 100644 --- a/src/pointer-analysis/add_failed_symbols.cpp +++ b/src/pointer-analysis/add_failed_symbols.cpp @@ -11,8 +11,8 @@ Author: Daniel Kroening, kroening@kroening.com #include "add_failed_symbols.h" -#include #include +#include #include #include #include diff --git a/src/pointer-analysis/goto_program_dereference.h b/src/pointer-analysis/goto_program_dereference.h index ec4cf0ae26c..e286e5ec23b 100644 --- a/src/pointer-analysis/goto_program_dereference.h +++ b/src/pointer-analysis/goto_program_dereference.h @@ -22,7 +22,7 @@ class goto_functionst; class goto_modelt; class namespacet; class optionst; -class symbol_tablet; +class symbol_table_baset; class symbolt; class value_setst; @@ -45,7 +45,7 @@ class goto_program_dereferencet:protected dereference_callbackt // _log to be a default messaget instance. goto_program_dereferencet( const namespacet &_ns, - symbol_tablet &_new_symbol_table, + symbol_table_baset &_new_symbol_table, const optionst &_options, value_setst &_value_sets, const messaget &_log = messaget()) diff --git a/src/pointer-analysis/value_set.cpp b/src/pointer-analysis/value_set.cpp index 8156ba98f7e..e8ed78cbff6 100644 --- a/src/pointer-analysis/value_set.cpp +++ b/src/pointer-analysis/value_set.cpp @@ -18,13 +18,14 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #include #include #include #include #include #include -#include +#include #include diff --git a/src/pointer-analysis/value_set_analysis_fi.cpp b/src/pointer-analysis/value_set_analysis_fi.cpp index 1b3e0ce83f5..9b5e2f9f896 100644 --- a/src/pointer-analysis/value_set_analysis_fi.cpp +++ b/src/pointer-analysis/value_set_analysis_fi.cpp @@ -12,8 +12,9 @@ Author: Daniel Kroening, kroening@kroening.com #include "value_set_analysis_fi.h" +#include #include -#include +#include void value_set_analysis_fit::initialize( const goto_programt &goto_program) diff --git a/src/pointer-analysis/value_set_analysis_fi.h b/src/pointer-analysis/value_set_analysis_fi.h index b846aa999c2..9d3887c345a 100644 --- a/src/pointer-analysis/value_set_analysis_fi.h +++ b/src/pointer-analysis/value_set_analysis_fi.h @@ -17,6 +17,8 @@ Author: Daniel Kroening, kroening@kroening.com #include "value_set_domain_fi.h" #include "value_sets.h" +class symbolt; + class value_set_analysis_fit: public value_setst, public flow_insensitive_analysist diff --git a/src/pointer-analysis/value_set_dereference.cpp b/src/pointer-analysis/value_set_dereference.cpp index 01c5710a53a..6b082e63b4e 100644 --- a/src/pointer-analysis/value_set_dereference.cpp +++ b/src/pointer-analysis/value_set_dereference.cpp @@ -25,17 +25,18 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include +#include #include #include #include #include #include -#include - -#include +#include #include "dereference_callback.h" +#include + /// Returns true if \p expr is complicated enough that a local definition (using /// a let expression) is preferable to repeating it, potentially many times. /// Of course this is just a heuristic -- currently we allow any expression that diff --git a/src/pointer-analysis/value_set_dereference.h b/src/pointer-analysis/value_set_dereference.h index c7763dccff3..d33abf35f04 100644 --- a/src/pointer-analysis/value_set_dereference.h +++ b/src/pointer-analysis/value_set_dereference.h @@ -16,7 +16,7 @@ Author: Daniel Kroening, kroening@kroening.com class dereference_callbackt; class messaget; -class symbol_tablet; +class symbol_table_baset; /// Wrapper for a function dereferencing pointer expressions using a value set. class value_set_dereferencet final @@ -33,7 +33,7 @@ class value_set_dereferencet final /// \param _log: Messaget object for displaying points-to set value_set_dereferencet( const namespacet &_ns, - symbol_tablet &_new_symbol_table, + symbol_table_baset &_new_symbol_table, dereference_callbackt &_dereference_callback, const irep_idt _language_mode, bool _exclude_null_derefs, @@ -97,7 +97,7 @@ class value_set_dereferencet final private: const namespacet &ns; - symbol_tablet &new_symbol_table; + symbol_table_baset &new_symbol_table; dereference_callbackt &dereference_callback; /// language_mode: ID_java, ID_C or another language identifier /// if we know the source language in use, irep_idt() otherwise. diff --git a/src/pointer-analysis/value_set_domain_fi.cpp b/src/pointer-analysis/value_set_domain_fi.cpp index a0d88d9f81c..01c618d60c8 100644 --- a/src/pointer-analysis/value_set_domain_fi.cpp +++ b/src/pointer-analysis/value_set_domain_fi.cpp @@ -12,8 +12,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "value_set_domain_fi.h" -#include - bool value_set_domain_fit::transform( const namespacet &ns, const irep_idt &function_from, diff --git a/src/solvers/bdd/miniBDD/miniBDD.h b/src/solvers/bdd/miniBDD/miniBDD.h index ded723930f2..4a1f8de179b 100644 --- a/src/solvers/bdd/miniBDD/miniBDD.h +++ b/src/solvers/bdd/miniBDD/miniBDD.h @@ -145,6 +145,6 @@ std::string cubes(const mini_bddt &u); bool OneSat(const mini_bddt &v, std::map &assignment); // inline functions -#include "miniBDD.inc" +#include "miniBDD.inc" // IWYU pragma: keep #endif // CPROVER_SOLVERS_BDD_MINIBDD_MINIBDD_H diff --git a/src/solvers/flattening/boolbv.cpp b/src/solvers/flattening/boolbv.cpp index d1241364589..76f950ac9ec 100644 --- a/src/solvers/flattening/boolbv.cpp +++ b/src/solvers/flattening/boolbv.cpp @@ -20,7 +20,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include #include diff --git a/src/solvers/flattening/boolbv.h b/src/solvers/flattening/boolbv.h index 6c819cea792..1636dd67ffa 100644 --- a/src/solvers/flattening/boolbv.h +++ b/src/solvers/flattening/boolbv.h @@ -17,16 +17,14 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #include -#include "bv_utils.h" -#include "boolbv_width.h" -#include "boolbv_map.h" #include "arrays.h" +#include "boolbv_map.h" +#include "boolbv_width.h" +#include "bv_utils.h" // IWYU pragma: keep -class array_comprehension_exprt; class binary_overflow_exprt; class bitreverse_exprt; class bswap_exprt; @@ -37,7 +35,6 @@ class extractbit_exprt; class extractbits_exprt; class floatbv_typecast_exprt; class ieee_float_op_exprt; -class member_exprt; class overflow_result_exprt; class replication_exprt; class unary_overflow_exprt; diff --git a/src/solvers/flattening/boolbv_floatbv_op.cpp b/src/solvers/flattening/boolbv_floatbv_op.cpp index e71867827c4..b3909dac0d7 100644 --- a/src/solvers/flattening/boolbv_floatbv_op.cpp +++ b/src/solvers/flattening/boolbv_floatbv_op.cpp @@ -9,7 +9,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "boolbv.h" #include -#include #include #include diff --git a/src/solvers/flattening/boolbv_get.cpp b/src/solvers/flattening/boolbv_get.cpp index 064f9330080..6f3eb70b171 100644 --- a/src/solvers/flattening/boolbv_get.cpp +++ b/src/solvers/flattening/boolbv_get.cpp @@ -16,8 +16,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "boolbv.h" #include "boolbv_type.h" -#include - exprt boolbvt::get(const exprt &expr) const { if(expr.id()==ID_symbol || diff --git a/src/solvers/flattening/boolbv_quantifier.cpp b/src/solvers/flattening/boolbv_quantifier.cpp index 2df5b755990..5598a1fb84b 100644 --- a/src/solvers/flattening/boolbv_quantifier.cpp +++ b/src/solvers/flattening/boolbv_quantifier.cpp @@ -11,8 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include -#include #include /// A method to detect equivalence between experts that can contain typecast diff --git a/src/solvers/flattening/boolbv_width.h b/src/solvers/flattening/boolbv_width.h index 2b2674d1af7..d50c433109e 100644 --- a/src/solvers/flattening/boolbv_width.h +++ b/src/solvers/flattening/boolbv_width.h @@ -10,7 +10,7 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H #define CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H -#include +#include // IWYU pragma: keep class namespacet; class struct_typet; diff --git a/src/solvers/flattening/bv_dimacs.cpp b/src/solvers/flattening/bv_dimacs.cpp index 2d7ce367a56..ddb8c19f27c 100644 --- a/src/solvers/flattening/bv_dimacs.cpp +++ b/src/solvers/flattening/bv_dimacs.cpp @@ -11,11 +11,11 @@ Author: Daniel Kroening, kroening@kroening.com #include "bv_dimacs.h" -#include -#include - #include +#include // IWYU pragma: keep +#include + bool bv_dimacst::write_dimacs() { if(filename.empty() || filename == "-") diff --git a/src/solvers/prop/bdd_expr.h b/src/solvers/prop/bdd_expr.h index d3c19e6ee0e..6ba72224206 100644 --- a/src/solvers/prop/bdd_expr.h +++ b/src/solvers/prop/bdd_expr.h @@ -21,7 +21,7 @@ Author: Michael Tautschnig, michael.tautschnig@qmul.ac.uk #include -#include +#include // IWYU pragma: keep #include diff --git a/src/solvers/prop/prop_conv_solver.cpp b/src/solvers/prop/prop_conv_solver.cpp index 74ffd5923dc..df911ebbe78 100644 --- a/src/solvers/prop/prop_conv_solver.cpp +++ b/src/solvers/prop/prop_conv_solver.cpp @@ -8,8 +8,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "prop_conv_solver.h" -#include - #include #include diff --git a/src/solvers/sat/cnf.cpp b/src/solvers/sat/cnf.cpp index a485751708c..d15e301711a 100644 --- a/src/solvers/sat/cnf.cpp +++ b/src/solvers/sat/cnf.cpp @@ -12,7 +12,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "cnf.h" #include -#include #include diff --git a/src/solvers/sat/satcheck_cadical.cpp b/src/solvers/sat/satcheck_cadical.cpp index 9ad79b05180..bc1f9ffcbfd 100644 --- a/src/solvers/sat/satcheck_cadical.cpp +++ b/src/solvers/sat/satcheck_cadical.cpp @@ -6,16 +6,16 @@ Author: Michael Tautschnig \*******************************************************************/ -#include "satcheck_cadical.h" +#ifdef HAVE_CADICAL -#include -#include -#include -#include +# include "satcheck_cadical.h" -#ifdef HAVE_CADICAL +# include +# include +# include +# include -#include +# include tvt satcheck_cadicalt::l_get(literalt a) const { diff --git a/src/solvers/sat/satcheck_ipasir.cpp b/src/solvers/sat/satcheck_ipasir.cpp index 4464575c564..98ed4d6e538 100644 --- a/src/solvers/sat/satcheck_ipasir.cpp +++ b/src/solvers/sat/satcheck_ipasir.cpp @@ -6,15 +6,15 @@ Author: Norbert Manthey, nmanthey@amazon.com \*******************************************************************/ -#include +#ifdef HAVE_IPASIR -#include -#include -#include +# include "satcheck_ipasir.h" -#include "satcheck_ipasir.h" +# include +# include +# include -#ifdef HAVE_IPASIR +# include extern "C" { diff --git a/src/solvers/sat/satcheck_minisat2.h b/src/solvers/sat/satcheck_minisat2.h index d6bd176518d..6c3cfc62a09 100644 --- a/src/solvers/sat/satcheck_minisat2.h +++ b/src/solvers/sat/satcheck_minisat2.h @@ -23,8 +23,10 @@ Author: Daniel Kroening, kroening@kroening.com namespace Minisat // NOLINT(readability/namespace) { -class Solver; // NOLINT(readability/identifiers) -class SimpSolver; // NOLINT(readability/identifiers) +// NOLINTNEXTLINE(readability/identifiers) +class Solver; // IWYU pragma: keep +// NOLINTNEXTLINE(readability/identifiers) +class SimpSolver; // IWYU pragma: keep } template diff --git a/src/solvers/smt2/smt2_solver.cpp b/src/solvers/smt2/smt2_solver.cpp index aa148082079..73e1617e13d 100644 --- a/src/solvers/smt2/smt2_solver.cpp +++ b/src/solvers/smt2/smt2_solver.cpp @@ -6,21 +6,19 @@ Author: Daniel Kroening, kroening@kroening.com \*******************************************************************/ -#include "smt2_parser.h" - -#include "smt2_format.h" - -#include -#include - #include #include -#include #include #include -#include #include +#include + +#include "smt2_format.h" +#include "smt2_parser.h" + +#include // IWYU pragma: keep +#include class smt2_solvert:public smt2_parsert { diff --git a/src/solvers/smt2_incremental/ast/smt_terms.h b/src/solvers/smt2_incremental/ast/smt_terms.h index 465b10bea3e..f69aadeffd6 100644 --- a/src/solvers/smt2_incremental/ast/smt_terms.h +++ b/src/solvers/smt2_incremental/ast/smt_terms.h @@ -14,7 +14,7 @@ #include #include -class BigInt; +class BigInt; // IWYU pragma: keep using mp_integer = BigInt; class smt_term_const_downcast_visitort; diff --git a/src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp b/src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp index e3ab7472e67..5cee12fe188 100644 --- a/src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp +++ b/src/solvers/smt2_incremental/construct_value_expr_from_smt.cpp @@ -1,7 +1,6 @@ // Author: Diffblue Ltd. #include -#include #include #include #include diff --git a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp index 18e86d7267d..ffca16fb60f 100644 --- a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp +++ b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -23,6 +22,7 @@ #include #include +#include /// Issues a command to the solving process which is expected to optionally /// return a success status followed by the actual response of interest. diff --git a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h index cec582f543a..ce46c51029f 100644 --- a/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h +++ b/src/solvers/smt2_incremental/smt2_incremental_decision_procedure.h @@ -18,12 +18,9 @@ #include #include -#include -class smt_commandt; -class message_handlert; class namespacet; -class smt_base_solver_processt; +class smt_base_solver_processt; // IWYU pragma: keep class smt2_incremental_decision_proceduret final : public stack_decision_proceduret diff --git a/src/solvers/smt2_incremental/smt_is_dynamic_object.cpp b/src/solvers/smt2_incremental/smt_is_dynamic_object.cpp index f98e1aed19a..cfd3a87da52 100644 --- a/src/solvers/smt2_incremental/smt_is_dynamic_object.cpp +++ b/src/solvers/smt2_incremental/smt_is_dynamic_object.cpp @@ -2,7 +2,6 @@ #include "smt_is_dynamic_object.h" -#include #include #include diff --git a/src/solvers/smt2_incremental/smt_object_size.h b/src/solvers/smt2_incremental/smt_object_size.h index 1b62d8716d2..de5a6c2afee 100644 --- a/src/solvers/smt2_incremental/smt_object_size.h +++ b/src/solvers/smt2_incremental/smt_object_size.h @@ -3,8 +3,8 @@ #ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_OBJECT_SIZE_H #define CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_OBJECT_SIZE_H -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep /// Specifics of how the object size lookup is implemented in SMT terms. /// This uses an uninterpreted function as a lookup. Because these functions diff --git a/src/solvers/smt2_incremental/smt_response_validation.h b/src/solvers/smt2_incremental/smt_response_validation.h index 156a9b2c20e..4fbfbd7dc7f 100644 --- a/src/solvers/smt2_incremental/smt_response_validation.h +++ b/src/solvers/smt2_incremental/smt_response_validation.h @@ -5,7 +5,7 @@ #include -#include +#include // IWYU pragma: keep #include NODISCARD response_or_errort validate_smt_response( diff --git a/src/solvers/smt2_incremental/smt_to_smt2_string.cpp b/src/solvers/smt2_incremental/smt_to_smt2_string.cpp index 3dfe15c9473..4d3558af3cc 100644 --- a/src/solvers/smt2_incremental/smt_to_smt2_string.cpp +++ b/src/solvers/smt2_incremental/smt_to_smt2_string.cpp @@ -12,8 +12,7 @@ #include #include -#include -#include +#include // IWYU pragma: keep #include #include diff --git a/src/solvers/smt2_incremental/type_size_mapping.h b/src/solvers/smt2_incremental/type_size_mapping.h index a5e7f030ef1..cf20c84cbee 100644 --- a/src/solvers/smt2_incremental/type_size_mapping.h +++ b/src/solvers/smt2_incremental/type_size_mapping.h @@ -6,14 +6,14 @@ #ifndef CPROVER_SOLVERS_SMT2_INCREMENTAL_TYPE_SIZE_MAPPING_H #define CPROVER_SOLVERS_SMT2_INCREMENTAL_TYPE_SIZE_MAPPING_H -#include +#include // IWYU pragma: keep -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include -#include +#include // IWYU pragma: keep -#include +#include // IWYU pragma: keep using type_size_mapt = std::unordered_map; diff --git a/src/solvers/strings/string_builtin_function.h b/src/solvers/strings/string_builtin_function.h index 566863d2593..510f909ee3b 100644 --- a/src/solvers/strings/string_builtin_function.h +++ b/src/solvers/strings/string_builtin_function.h @@ -7,7 +7,6 @@ #include "string_constraint_generator.h" #include -#include #include #include diff --git a/src/solvers/strings/string_constraint_instantiation.h b/src/solvers/strings/string_constraint_instantiation.h index 7eaa02bf1f9..e20bec37c9f 100644 --- a/src/solvers/strings/string_constraint_instantiation.h +++ b/src/solvers/strings/string_constraint_instantiation.h @@ -12,9 +12,9 @@ Author: Jesse Sigal, jesse.sigal@diffblue.com #ifndef CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_INSTANTIATION_H #define CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_INSTANTIATION_H -#include +#include // IWYU pragma: keep -#include +#include class string_constraintt; struct string_not_contains_constraintt; diff --git a/src/solvers/strings/string_refinement_util.cpp b/src/solvers/strings/string_refinement_util.cpp index f0213a5184e..5b7542faeeb 100644 --- a/src/solvers/strings/string_refinement_util.cpp +++ b/src/solvers/strings/string_refinement_util.cpp @@ -8,8 +8,6 @@ Author: Diffblue Ltd. #include "string_refinement_util.h" -#include -#include #include #include diff --git a/src/statement-list/converters/convert_real_literal.cpp b/src/statement-list/converters/convert_real_literal.cpp index bfd33c41742..555da5efe11 100644 --- a/src/statement-list/converters/convert_real_literal.cpp +++ b/src/statement-list/converters/convert_real_literal.cpp @@ -10,11 +10,12 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com /// Statement List Language Conversion #include "convert_real_literal.h" -#include "statement_list_types.h" -#include +#include // IWYU pragma: keep #include +#include "statement_list_types.h" + constant_exprt convert_real_literal(const std::string &src) { ieee_floatt real{get_real_type()}; diff --git a/src/statement-list/converters/convert_string_value.h b/src/statement-list/converters/convert_string_value.h index 4e638bd3398..aedd7e7b18f 100644 --- a/src/statement-list/converters/convert_string_value.h +++ b/src/statement-list/converters/convert_string_value.h @@ -12,7 +12,6 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #ifndef CPROVER_STATEMENT_LIST_CONVERTERS_CONVERT_STRING_VALUE_H #define CPROVER_STATEMENT_LIST_CONVERTERS_CONVERT_STRING_VALUE_H -#include #include /// Converts a string into a Statement List identifier. diff --git a/src/statement-list/parser.y b/src/statement-list/parser.y index 7c3e8ce4c04..70b2ccce969 100644 --- a/src/statement-list/parser.y +++ b/src/statement-list/parser.y @@ -19,6 +19,7 @@ #include "converters/statement_list_types.h" #include +#include #include diff --git a/src/statement-list/scanner.l b/src/statement-list/scanner.l index 72434d7c3fb..a06e11cf1f6 100644 --- a/src/statement-list/scanner.l +++ b/src/statement-list/scanner.l @@ -17,9 +17,9 @@ #include "converters/convert_string_value.h" // Disable warnings for generated file. -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include diff --git a/src/statement-list/statement_list_entry_point.cpp b/src/statement-list/statement_list_entry_point.cpp index 66da25f41ab..8b8990e6e0f 100644 --- a/src/statement-list/statement_list_entry_point.cpp +++ b/src/statement-list/statement_list_entry_point.cpp @@ -11,17 +11,17 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #include "statement_list_entry_point.h" -#include -#include - -#include - #include #include #include #include #include -#include +#include + +#include +#include + +#include /// Postfix for the artificial data block that is created when calling a main /// symbol that is a function block. @@ -39,7 +39,7 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com /// \param main_symbol_name: Name of the symbol to look for. /// \return False if there is exactly one match, true otherwise. static bool is_main_symbol_invalid( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, message_handlert &message_handler, const irep_idt &main_symbol_name) { @@ -80,7 +80,7 @@ static bool is_main_symbol_invalid( /// \param main_symbol_location: Source location of the main symbol. static void add_initialize_call( code_blockt &function_body, - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const source_locationt &main_symbol_location) { symbolt init = symbol_table.lookup_ref(INITIALIZE_FUNCTION); @@ -96,7 +96,7 @@ static void add_initialize_call( /// \param main_function_block: Main symbol of this application. static void add_main_function_block_call( code_blockt &function_body, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const symbolt &main_function_block) { const code_typet &function_type = to_code_type(main_function_block.type); @@ -121,7 +121,8 @@ static void add_main_function_block_call( /// Creates __CPROVER_initialize and adds it to the symbol table. /// \param [out] symbol_table: Symbol table that should contain the function. -static void generate_statement_list_init_function(symbol_tablet &symbol_table) +static void +generate_statement_list_init_function(symbol_table_baset &symbol_table) { symbolt init; init.name = INITIALIZE_FUNCTION; @@ -143,7 +144,7 @@ static void generate_statement_list_init_function(symbol_tablet &symbol_table) /// Creates __CPROVER_rounding_mode and adds it to the symbol table. /// \param [out] symbol_table: Symbol table that should contain the symbol. -static void generate_rounding_mode(symbol_tablet &symbol_table) +static void generate_rounding_mode(symbol_table_baset &symbol_table) { symbolt rounding_mode; rounding_mode.name = rounding_mode_identifier(); @@ -164,7 +165,7 @@ static void generate_rounding_mode(symbol_tablet &symbol_table) /// \param message_handler: Handler that is responsible for error messages. bool generate_statement_list_start_function( const symbolt &main, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { PRECONDITION(!main.value.is_nil()); @@ -196,7 +197,7 @@ bool generate_statement_list_start_function( } bool statement_list_entry_point( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler) { // Check if the entry point is already present and return if it is. diff --git a/src/statement-list/statement_list_entry_point.h b/src/statement-list/statement_list_entry_point.h index 0638a9e8a40..720309c5864 100644 --- a/src/statement-list/statement_list_entry_point.h +++ b/src/statement-list/statement_list_entry_point.h @@ -13,14 +13,14 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #define CPROVER_STATEMENT_LIST_STATEMENT_LIST_ENTRY_POINT_H class message_handlert; -class symbol_tablet; +class symbol_table_baset; /// Creates a new entry point for the Statement List language. /// \param [out] symbol_table: Symbol table of the current TIA program. Gets /// filled with the symbols that are necessary for a proper entry point. /// \param message_handler: Handler that is responsible for error messages. bool statement_list_entry_point( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, message_handlert &message_handler); #endif // CPROVER_STATEMENT_LIST_STATEMENT_LIST_ENTRY_POINT_H diff --git a/src/statement-list/statement_list_language.cpp b/src/statement-list/statement_list_language.cpp index f7e2c8f85f0..f9d7fe9be6b 100644 --- a/src/statement-list/statement_list_language.cpp +++ b/src/statement-list/statement_list_language.cpp @@ -28,13 +28,13 @@ void statement_list_languaget::set_language_options(const optionst &options) } bool statement_list_languaget::generate_support_functions( - symbol_tablet &symbol_table) + symbol_table_baset &symbol_table) { return statement_list_entry_point(symbol_table, get_message_handler()); } bool statement_list_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) { @@ -82,7 +82,7 @@ bool statement_list_languaget::can_keep_file_local() } bool statement_list_languaget::typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module) { return typecheck(symbol_table, module, true); diff --git a/src/statement-list/statement_list_language.h b/src/statement-list/statement_list_language.h index 6edc0cdda42..312d6a2d741 100644 --- a/src/statement-list/statement_list_language.h +++ b/src/statement-list/statement_list_language.h @@ -36,7 +36,7 @@ class statement_list_languaget : public languaget bool parse(std::istream &instream, const std::string &path) override; /// Currently unused. - bool generate_support_functions(symbol_tablet &symbol_table) override; + bool generate_support_functions(symbol_table_baset &symbol_table) override; /// Converts the current parse tree into a symbol table. /// \param [out] symbol_table: Object that shall be filled by this function. @@ -47,12 +47,12 @@ class statement_list_languaget : public languaget /// should be included in the table. /// \return False if no errors occurred, true otherwise. bool typecheck( - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, const bool keep_file_local) override; - bool - typecheck(symbol_tablet &symbol_table, const std::string &module) override; + bool typecheck(symbol_table_baset &symbol_table, const std::string &module) + override; bool can_keep_file_local() override; diff --git a/src/statement-list/statement_list_parse_tree.h b/src/statement-list/statement_list_parse_tree.h index 803f75abe99..406b4b5acbf 100644 --- a/src/statement-list/statement_list_parse_tree.h +++ b/src/statement-list/statement_list_parse_tree.h @@ -12,7 +12,8 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #ifndef CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSE_TREE_H #define CPROVER_STATEMENT_LIST_STATEMENT_LIST_PARSE_TREE_H -#include +#include +#include /// Intermediate representation of a parsed Statement List file before /// converting it into a goto program. Contains all data structures that are diff --git a/src/statement-list/statement_list_parse_tree_io.cpp b/src/statement-list/statement_list_parse_tree_io.cpp index dbabfd8ab1e..82e6171814f 100644 --- a/src/statement-list/statement_list_parse_tree_io.cpp +++ b/src/statement-list/statement_list_parse_tree_io.cpp @@ -10,11 +10,13 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com /// Statement List Language Parse Tree Output #include "statement_list_parse_tree_io.h" -#include "converters/statement_list_types.h" #include #include #include +#include + +#include "converters/statement_list_types.h" /// String to indicate that there is no value. #define NO_VALUE "(none)" diff --git a/src/statement-list/statement_list_parser.cpp b/src/statement-list/statement_list_parser.cpp index 2a3e677d739..a059149aac2 100644 --- a/src/statement-list/statement_list_parser.cpp +++ b/src/statement-list/statement_list_parser.cpp @@ -11,12 +11,15 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #include "statement_list_parser.h" +#include +#include + #include "statement_list_parse_tree.h" #include "statement_list_parse_tree_io.h" + #include #include #include -#include statement_list_parsert statement_list_parser; diff --git a/src/statement-list/statement_list_typecheck.cpp b/src/statement-list/statement_list_typecheck.cpp index 219c1d900bf..09604809f14 100644 --- a/src/statement-list/statement_list_typecheck.cpp +++ b/src/statement-list/statement_list_typecheck.cpp @@ -10,9 +10,6 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com /// Statement List Language Type Checking #include "statement_list_typecheck.h" -#include "converters/statement_list_types.h" - -#include #include #include @@ -20,7 +17,11 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #include #include #include -#include +#include + +#include + +#include "converters/statement_list_types.h" /// Size of pointers in Siemens TIA. #define STATEMENT_LIST_PTR_WIDTH 64 @@ -80,7 +81,7 @@ static code_typet::parametert create_data_block_parameter( bool statement_list_typecheck( const statement_list_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) { @@ -116,7 +117,7 @@ statement_list_typecheckt::stl_jump_locationt::stl_jump_locationt( statement_list_typecheckt::statement_list_typecheckt( const statement_list_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) : typecheckt(message_handler), diff --git a/src/statement-list/statement_list_typecheck.h b/src/statement-list/statement_list_typecheck.h index 383b8b71eeb..c37fc401a58 100644 --- a/src/statement-list/statement_list_typecheck.h +++ b/src/statement-list/statement_list_typecheck.h @@ -12,11 +12,14 @@ Author: Matthias Weiss, matthias.weiss@diffblue.com #ifndef CPROVER_STATEMENT_LIST_STATEMENT_LIST_TYPECHECK_H #define CPROVER_STATEMENT_LIST_STATEMENT_LIST_TYPECHECK_H +#include #include #include "statement_list_parse_tree.h" -class symbol_tablet; +class code_frontend_assignt; +class code_labelt; +class symbol_table_baset; class symbolt; /// Create a new statement_list_typecheckt object and perform a type check to @@ -31,7 +34,7 @@ class symbolt; /// \return False if no errors occurred, true otherwise. bool statement_list_typecheck( const statement_list_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler); @@ -49,7 +52,7 @@ class statement_list_typecheckt : public typecheckt /// messages. statement_list_typecheckt( const statement_list_parse_treet &parse_tree, - symbol_tablet &symbol_table, + symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler); @@ -62,7 +65,7 @@ class statement_list_typecheckt : public typecheckt const statement_list_parse_treet &parse_tree; /// Reference to the symbol table that should be filled during the typecheck. - symbol_tablet &symbol_table; + symbol_table_baset &symbol_table; /// Name of the module this typecheck belongs to. const irep_idt module; diff --git a/src/util/base_exceptions.h b/src/util/base_exceptions.h index 6d1218a9e7c..454aced1cea 100644 --- a/src/util/base_exceptions.h +++ b/src/util/base_exceptions.h @@ -12,7 +12,7 @@ Author: Diffblue Ltd. #ifndef CPROVER_UTIL_BASE_EXCEPTIONS_H #define CPROVER_UTIL_BASE_EXCEPTIONS_H -#include "util/invariant.h" +#include "invariant.h" class bad_cast_exceptiont:public invariant_failedt { diff --git a/src/util/config.cpp b/src/util/config.cpp index 51b39f0894d..ee2dd53561d 100644 --- a/src/util/config.cpp +++ b/src/util/config.cpp @@ -8,9 +8,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "config.h" -#include -#include - #include "arith_tools.h" #include "cmdline.h" #include "cprover_prefix.h" @@ -20,7 +17,10 @@ Author: Daniel Kroening, kroening@kroening.com #include "simplify_expr.h" #include "string2int.h" #include "string_utils.h" -#include "symbol_table.h" +#include "symbol_table_base.h" + +#include +#include configt config; @@ -1251,8 +1251,7 @@ static unsigned unsigned_from_ns( return numeric_cast_v(int_value); } -void configt::set_from_symbol_table( - const symbol_tablet &symbol_table) +void configt::set_from_symbol_table(const symbol_table_baset &symbol_table) { // maybe not compiled from C/C++ if(symbol_table.symbols.find(CPROVER_PREFIX "architecture_" "int_width")== @@ -1312,7 +1311,7 @@ void configt::set_from_symbol_table( /// Sets the number of bits used for object addresses /// \param symbol_table: The symbol table void configt::set_object_bits_from_symbol_table( - const symbol_tablet &symbol_table) + const symbol_table_baset &symbol_table) { // has been overridden by command line option, // thus do not apply language defaults diff --git a/src/util/config.h b/src/util/config.h index f66229230a4..98ee28bf8da 100644 --- a/src/util/config.h +++ b/src/util/config.h @@ -16,7 +16,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "optional.h" class cmdlinet; -class symbol_tablet; +class symbol_table_baset; // Configt is the one place beyond *_parse_options where options are ... parsed. // Options that are handled by configt are documented here. @@ -342,11 +342,11 @@ class configt void set_arch(const irep_idt &); - void set_from_symbol_table(const symbol_tablet &); + void set_from_symbol_table(const symbol_table_baset &); bool set(const cmdlinet &cmdline); - void set_object_bits_from_symbol_table(const symbol_tablet &); + void set_object_bits_from_symbol_table(const symbol_table_baset &); std::string object_bits_info(); static irep_idt this_architecture(); diff --git a/src/util/console.cpp b/src/util/console.cpp index 76a3c122ff6..6e3ac416b1b 100644 --- a/src/util/console.cpp +++ b/src/util/console.cpp @@ -10,12 +10,12 @@ Author: Daniel Kroening, dkr@amazon.com #include #include -#include #ifdef _WIN32 # include # include # define isatty _isatty +# include #else # include #endif @@ -23,7 +23,6 @@ Author: Daniel Kroening, dkr@amazon.com #include #include #include -#include #ifdef _WIN32 class windows_coutt : public std::streambuf diff --git a/src/util/console.h b/src/util/console.h index 9ff4e4c4011..514f36135ad 100644 --- a/src/util/console.h +++ b/src/util/console.h @@ -12,7 +12,7 @@ Author: Daniel Kroening, dkr@amazon.com #ifndef CPROVER_UTIL_CONSOLE_H #define CPROVER_UTIL_CONSOLE_H -#include +#include // IWYU pragma: keep #include class consolet diff --git a/src/util/dstring.cpp b/src/util/dstring.cpp index 96c8d95dbb0..b499d1ebac4 100644 --- a/src/util/dstring.cpp +++ b/src/util/dstring.cpp @@ -11,6 +11,8 @@ Author: Daniel Kroening, kroening@kroening.com #include "dstring.h" +#include // IWYU pragma: keep + std::ostream &dstringt::operator<<(std::ostream &out) const { return out << as_string(); diff --git a/src/util/dstring.h b/src/util/dstring.h index 344e7e31b53..47ba831053a 100644 --- a/src/util/dstring.h +++ b/src/util/dstring.h @@ -15,10 +15,12 @@ Author: Daniel Kroening, kroening@kroening.com #include #include -#include "invariant.h" #include "magic.h" #include "string_container.h" +template +struct diagnostics_helpert; + /// \ref dstringt has one field, an unsigned integer \ref no which is an index /// into a static table of strings. This makes it expensive to create a new /// string(because you have to look through the whole table to see if it is diff --git a/src/util/expr_initializer.cpp b/src/util/expr_initializer.cpp index fb8808887b9..ef6275963b4 100644 --- a/src/util/expr_initializer.cpp +++ b/src/util/expr_initializer.cpp @@ -14,8 +14,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "arith_tools.h" #include "c_types.h" #include "magic.h" -#include "namespace.h" -#include "pointer_offset_size.h" +#include "namespace.h" // IWYU pragma: keep #include "std_code.h" template diff --git a/src/util/find_symbols.cpp b/src/util/find_symbols.cpp index a3b46c691ce..18b924ddc4c 100644 --- a/src/util/find_symbols.cpp +++ b/src/util/find_symbols.cpp @@ -9,8 +9,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "find_symbols.h" #include "c_types.h" -#include "expr_iterator.h" -#include "range.h" #include "std_expr.h" /// Kinds of symbols to be considered by \ref find_symbols. diff --git a/src/util/find_symbols.h b/src/util/find_symbols.h index 6de59bd5485..df840001b7e 100644 --- a/src/util/find_symbols.h +++ b/src/util/find_symbols.h @@ -12,12 +12,11 @@ Author: Daniel Kroening, kroening@kroening.com #include "irep.h" -#include #include #include class exprt; -class symbol_exprt; +class symbol_exprt; // IWYU pragma: keep class typet; typedef std::unordered_set find_symbols_sett; diff --git a/src/util/format_expr.h b/src/util/format_expr.h index 458ade7db21..c22d5c90bf3 100644 --- a/src/util/format_expr.h +++ b/src/util/format_expr.h @@ -9,7 +9,7 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_UTIL_FORMAT_EXPR_H #define CPROVER_UTIL_FORMAT_EXPR_H -#include "format.h" +#include "format.h" // IWYU pragma: keep #include "irep.h" #include diff --git a/src/util/format_number_range.cpp b/src/util/format_number_range.cpp index 46823cd18fd..642384e8ead 100644 --- a/src/util/format_number_range.cpp +++ b/src/util/format_number_range.cpp @@ -15,7 +15,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "exception_utils.h" #include "invariant.h" -#include "optional.h" #include "format_number_range.h" diff --git a/src/util/format_type.h b/src/util/format_type.h index 50c530aaaab..50ef91e00b1 100644 --- a/src/util/format_type.h +++ b/src/util/format_type.h @@ -9,7 +9,7 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_UTIL_FORMAT_TYPE_H #define CPROVER_UTIL_FORMAT_TYPE_H -#include "format.h" +#include "format.h" // IWYU pragma: keep class typet; diff --git a/src/util/get_module.cpp b/src/util/get_module.cpp index 4ed0779ea1f..0f706fc7e06 100644 --- a/src/util/get_module.cpp +++ b/src/util/get_module.cpp @@ -11,17 +11,17 @@ Author: Daniel Kroening, kroening@kroening.com #include "get_module.h" -#include -#include - #include "message.h" #include "range.h" -#include "symbol_table.h" +#include "symbol_table_base.h" + +#include +#include typedef std::list symbolptr_listt; const symbolt &get_module_by_name( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) { @@ -31,7 +31,7 @@ const symbolt &get_module_by_name( for(const auto &symbol_name_entry : equal_range(symbol_table.symbol_base_map, module)) { - symbol_tablet::symbolst::const_iterator it2 = + symbol_table_baset::symbolst::const_iterator it2 = symbol_table.symbols.find(symbol_name_entry.second); if(it2==symbol_table.symbols.end()) @@ -67,7 +67,7 @@ const symbolt &get_module_by_name( } const symbolt &get_module( - const symbol_tablet &symbol_table, + const symbol_table_baset &symbol_table, const std::string &module, message_handlert &message_handler) { diff --git a/src/util/ieee_float.h b/src/util/ieee_float.h index 2f7041b014b..788975ba040 100644 --- a/src/util/ieee_float.h +++ b/src/util/ieee_float.h @@ -14,7 +14,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "mp_arith.h" #include "format_spec.h" -#include "cprover_prefix.h" class constant_exprt; class floatbv_typet; diff --git a/src/util/interval.cpp b/src/util/interval.cpp index 2d87be0bcb7..4b1c0f7ddc0 100644 --- a/src/util/interval.cpp +++ b/src/util/interval.cpp @@ -16,8 +16,6 @@ #include "interval.h" -#include - #include "arith_tools.h" #include "bitvector_expr.h" #include "c_types.h" diff --git a/src/util/invariant.cpp b/src/util/invariant.cpp index 7007711dd5a..86e30f297c9 100644 --- a/src/util/invariant.cpp +++ b/src/util/invariant.cpp @@ -10,7 +10,6 @@ Author: Martin Brain, martin.brain@diffblue.com #include "freer.h" -#include #include #include #include @@ -20,6 +19,7 @@ Author: Martin Brain, martin.brain@diffblue.com #ifdef _WIN32 // the ordering of includes is required // clang-format off +#include #include #include // clang-format on @@ -30,7 +30,7 @@ bool cbmc_invariants_should_throw = false; // Backtraces compiler and C library specific // So we should include something explicitly from the C library // to check if the C library is glibc. -#include +#include // IWYU pragma: keep #if defined(__GLIBC__) || defined(__APPLE__) // GCC needs LINKFLAGS="-rdynamic" to give function names in the backtrace diff --git a/src/util/irep.cpp b/src/util/irep.cpp index c786ffb5f94..929a3ea37b3 100644 --- a/src/util/irep.cpp +++ b/src/util/irep.cpp @@ -12,7 +12,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "irep.h" #include "string2int.h" -#include "string_hash.h" #include "irep_hash.h" irept nil_rep_storage; diff --git a/src/util/journalling_symbol_table.h b/src/util/journalling_symbol_table.h index 43e6a2fe05a..a1f9643d048 100644 --- a/src/util/journalling_symbol_table.h +++ b/src/util/journalling_symbol_table.h @@ -6,10 +6,11 @@ #ifndef CPROVER_UTIL_JOURNALLING_SYMBOL_TABLE_H #define CPROVER_UTIL_JOURNALLING_SYMBOL_TABLE_H -#include -#include #include "irep.h" -#include "symbol_table.h" +#include "symbol_table_base.h" + +#include +#include /// \brief A symbol table wrapper that records which entries have been /// updated/removed @@ -115,7 +116,7 @@ class journalling_symbol_tablet : public symbol_table_baset } virtual void - erase(const symbol_tablet::symbolst::const_iterator &entry) override + erase(const symbol_table_baset::symbolst::const_iterator &entry) override { const irep_idt entry_name = entry->first; base_symbol_table.erase(entry); @@ -143,6 +144,12 @@ class journalling_symbol_tablet : public symbol_table_baset using symbol_table_baset::begin; using symbol_table_baset::end; + void validate( + const validation_modet vm = validation_modet::INVARIANT) const override + { + base_symbol_table.validate(vm); + } + const changesett &get_inserted() const { return inserted; diff --git a/src/util/mathematical_expr.cpp b/src/util/mathematical_expr.cpp index 9452dab1faf..1c467b924ca 100644 --- a/src/util/mathematical_expr.cpp +++ b/src/util/mathematical_expr.cpp @@ -9,8 +9,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "mathematical_expr.h" #include "mathematical_types.h" -#include - function_application_exprt::function_application_exprt( const exprt &_function, argumentst _arguments) diff --git a/src/util/mathematical_types.h b/src/util/mathematical_types.h index 8d2c151b747..d639ac0d684 100644 --- a/src/util/mathematical_types.h +++ b/src/util/mathematical_types.h @@ -13,7 +13,7 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_UTIL_MATHEMATICAL_TYPES_H #define CPROVER_UTIL_MATHEMATICAL_TYPES_H -#include "expr_cast.h" +#include "expr_cast.h" // IWYU pragma: keep #include "invariant.h" #include "type.h" diff --git a/src/util/namespace.cpp b/src/util/namespace.cpp index 898937568cd..fcdf4b1465b 100644 --- a/src/util/namespace.cpp +++ b/src/util/namespace.cpp @@ -11,11 +11,11 @@ Author: Daniel Kroening, kroening@kroening.com #include "namespace.h" -#include - #include "c_types.h" #include "std_expr.h" -#include "symbol_table.h" +#include "symbol_table_base.h" + +#include namespace_baset::~namespace_baset() { @@ -139,7 +139,7 @@ bool namespacet::lookup( const irep_idt &name, const symbolt *&symbol) const { - symbol_tablet::symbolst::const_iterator it; + symbol_table_baset::symbolst::const_iterator it; if(symbol_table1!=nullptr) { @@ -190,7 +190,7 @@ bool multi_namespacet::lookup( const irep_idt &name, const symbolt *&symbol) const { - symbol_tablet::symbolst::const_iterator s_it; + symbol_table_baset::symbolst::const_iterator s_it; for(symbol_table_listt::const_iterator c_it=symbol_table_list.begin(); diff --git a/src/util/parse_options.cpp b/src/util/parse_options.cpp index 0bf572917f8..04edffcaccf 100644 --- a/src/util/parse_options.cpp +++ b/src/util/parse_options.cpp @@ -11,7 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include #include #include -#include #if defined (_WIN32) #define EX_OK 0 diff --git a/src/util/piped_process.cpp b/src/util/piped_process.cpp index 504343a56ac..e3345c19c18 100644 --- a/src/util/piped_process.cpp +++ b/src/util/piped_process.cpp @@ -93,7 +93,6 @@ #include "narrow.h" #include "optional.h" #include "piped_process.h" -#include "string_utils.h" #include // library for strerror function (on linux) #include diff --git a/src/util/pointer_offset_size.h b/src/util/pointer_offset_size.h index ac44ac92958..b4ce99dbf73 100644 --- a/src/util/pointer_offset_size.h +++ b/src/util/pointer_offset_size.h @@ -21,7 +21,6 @@ class namespacet; class struct_typet; class typet; class member_exprt; -class constant_exprt; optionalt member_offset( const struct_typet &type, diff --git a/src/util/rational.cpp b/src/util/rational.cpp index 37c204bfdf1..96bdc40cc11 100644 --- a/src/util/rational.cpp +++ b/src/util/rational.cpp @@ -11,7 +11,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "rational.h" -#include #include #include "invariant.h" diff --git a/src/util/refined_string_type.cpp b/src/util/refined_string_type.cpp index 3eee7f64220..7f298d6889e 100644 --- a/src/util/refined_string_type.cpp +++ b/src/util/refined_string_type.cpp @@ -18,6 +18,8 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #include "refined_string_type.h" +#include "pointer_expr.h" + refined_string_typet::refined_string_typet( const typet &index_type, const pointer_typet &content_type) diff --git a/src/util/refined_string_type.h b/src/util/refined_string_type.h index 96b12923059..3ddecf19977 100644 --- a/src/util/refined_string_type.h +++ b/src/util/refined_string_type.h @@ -20,7 +20,9 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #define CPROVER_UTIL_REFINED_STRING_TYPE_H #include "cprover_prefix.h" -#include "pointer_expr.h" +#include "std_types.h" + +class pointer_typet; // Internal type used for string refinement class refined_string_typet: public struct_typet diff --git a/src/util/std_code.cpp b/src/util/std_code.cpp index 926df5fb296..b31acf57e47 100644 --- a/src/util/std_code.cpp +++ b/src/util/std_code.cpp @@ -12,9 +12,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "std_code.h" #include "arith_tools.h" -#include "c_types.h" -#include "pointer_expr.h" -#include "string_constant.h" /// In the case of a `codet` type that represents multiple statements, return /// the first of them. Otherwise return the `codet` itself. diff --git a/src/util/std_types.h b/src/util/std_types.h index 3ed8f514235..1e02a2400bb 100644 --- a/src/util/std_types.h +++ b/src/util/std_types.h @@ -14,7 +14,7 @@ Author: Daniel Kroening, kroening@kroening.com #define CPROVER_UTIL_STD_TYPES_H #include "expr.h" -#include "expr_cast.h" +#include "expr_cast.h" // IWYU pragma: keep #include "invariant.h" #include "mp_arith.h" #include "validate.h" diff --git a/src/util/string_expr.h b/src/util/string_expr.h index 369471d0462..0588b2dccdd 100644 --- a/src/util/string_expr.h +++ b/src/util/string_expr.h @@ -13,6 +13,7 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com #define CPROVER_UTIL_STRING_EXPR_H #include "arith_tools.h" +#include "pointer_expr.h" #include "refined_string_type.h" #include "std_expr.h" diff --git a/src/util/string_utils.h b/src/util/string_utils.h index ebf1a1005e5..0a0ad5a932e 100644 --- a/src/util/string_utils.h +++ b/src/util/string_utils.h @@ -10,7 +10,6 @@ Author: Daniel Poetzl #ifndef CPROVER_UTIL_STRING_UTILS_H #define CPROVER_UTIL_STRING_UTILS_H -#include #include #include diff --git a/src/util/substitute_symbols.h b/src/util/substitute_symbols.h index e4701e3dd48..0c4ded4b494 100644 --- a/src/util/substitute_symbols.h +++ b/src/util/substitute_symbols.h @@ -12,10 +12,13 @@ Author: Daniel Kroening, dkr@amazon.com /// \file util/substitute_symbols.h /// Symbol Substitution -#include "expr.h" +#include "irep.h" +#include "optional.h" #include +class exprt; + /// Substitute free occurrences of the variables given /// by their identifiers in the keys of the map in the /// given expression. Only symbol_exprt expressions are diff --git a/src/util/symbol_table.h b/src/util/symbol_table.h index 96672d27569..a6fa8b798fe 100644 --- a/src/util/symbol_table.h +++ b/src/util/symbol_table.h @@ -118,7 +118,8 @@ class symbol_tablet : public symbol_table_baset using symbol_table_baset::end; /// Check that the symbol table is well-formed - void validate(const validation_modet vm = validation_modet::INVARIANT) const; + void validate( + const validation_modet vm = validation_modet::INVARIANT) const override; bool operator==(const symbol_tablet &other) const; }; diff --git a/src/util/symbol_table_base.h b/src/util/symbol_table_base.h index a323da95b2b..e53aa279b14 100644 --- a/src/util/symbol_table_base.h +++ b/src/util/symbol_table_base.h @@ -6,11 +6,11 @@ #ifndef CPROVER_UTIL_SYMBOL_TABLE_BASE_H #define CPROVER_UTIL_SYMBOL_TABLE_BASE_H +#include "symbol.h" // IWYU pragma: keep + #include #include -#include "symbol.h" - typedef std::multimap symbol_base_mapt; typedef std::multimap symbol_module_mapt; @@ -239,6 +239,9 @@ class symbol_table_baset virtual const_iteratort begin() const; virtual const_iteratort end() const; + + virtual void + validate(const validation_modet vm = validation_modet::INVARIANT) const = 0; }; std::ostream & diff --git a/src/util/symbol_table_builder.h b/src/util/symbol_table_builder.h index 4e2b91efc9d..28046919de6 100644 --- a/src/util/symbol_table_builder.h +++ b/src/util/symbol_table_builder.h @@ -88,6 +88,12 @@ class symbol_table_buildert : public symbol_table_baset using symbol_table_baset::begin; using symbol_table_baset::end; + void validate( + const validation_modet vm = validation_modet::INVARIANT) const override + { + base_symbol_table.validate(vm); + } + /// Try to find the next free identity for the passed-in prefix in /// this symbol table. /// \remark diff --git a/src/util/tempdir.cpp b/src/util/tempdir.cpp index 9069eb3ee4f..b8b0a0fe78b 100644 --- a/src/util/tempdir.cpp +++ b/src/util/tempdir.cpp @@ -28,8 +28,6 @@ Author: CM Wintersteiger // clang-format off #if defined(__FreeBSD_kernel__) || \ - defined(__GNU__) || \ - defined(__unix__) || \ defined(__CYGWIN__) || \ defined(__MACH__) #include diff --git a/src/util/ui_message.cpp b/src/util/ui_message.cpp index cd26a51285e..13204451ead 100644 --- a/src/util/ui_message.cpp +++ b/src/util/ui_message.cpp @@ -8,9 +8,6 @@ Author: Daniel Kroening, kroening@kroening.com #include "ui_message.h" -#include -#include - #include "cmdline.h" #include "cout_message.h" #include "json.h" @@ -21,6 +18,9 @@ Author: Daniel Kroening, kroening@kroening.com #include "xml.h" #include "xml_irep.h" +#include // IWYU pragma: keep +#include + ui_message_handlert::ui_message_handlert( message_handlert *_message_handler, uit __ui, diff --git a/src/util/validate_expressions.cpp b/src/util/validate_expressions.cpp index aa7c14c2cda..5e563d1526b 100644 --- a/src/util/validate_expressions.cpp +++ b/src/util/validate_expressions.cpp @@ -13,8 +13,8 @@ Author: Daniel Poetzl #include #endif -#include "bitvector_expr.h" -#include "pointer_expr.h" +#include "bitvector_expr.h" // IWYU pragma: keep +#include "pointer_expr.h" // IWYU pragma: keep #include "ssa_expr.h" #define CALL_ON_EXPR(expr_type) \ diff --git a/src/util/validate_types.cpp b/src/util/validate_types.cpp index 0188cd7fcb4..e409f3a90f2 100644 --- a/src/util/validate_types.cpp +++ b/src/util/validate_types.cpp @@ -12,9 +12,8 @@ Author: Daniel Poetzl #include #endif -#include "bitvector_types.h" -#include "c_types.h" -#include "pointer_expr.h" +#include "bitvector_types.h" // IWYU pragma: keep +#include "c_types.h" // IWYU pragma: keep #include "validate_helpers.h" #define CALL_ON_TYPE(type_type) \ diff --git a/src/xmllang/graphml.cpp b/src/xmllang/graphml.cpp index 3847d03101c..08b469c40d5 100644 --- a/src/xmllang/graphml.cpp +++ b/src/xmllang/graphml.cpp @@ -11,8 +11,6 @@ Author: Michael Tautschnig, mt@eecs.qmul.ac.uk #include "graphml.h" -#include - // include last to make sure #define stack(x) of parser.h does not // collide with std::stack included by graph.h #include "xml_parser.h" diff --git a/src/xmllang/scanner.l b/src/xmllang/scanner.l index 425a6b944a5..a9907847c58 100755 --- a/src/xmllang/scanner.l +++ b/src/xmllang/scanner.l @@ -35,9 +35,9 @@ static char *word(char *s) return buf; } -#include -#include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep +#include // IWYU pragma: keep %} diff --git a/unit/CMakeLists.txt b/unit/CMakeLists.txt index 81a5b57e24b..c81399af77a 100644 --- a/unit/CMakeLists.txt +++ b/unit/CMakeLists.txt @@ -89,6 +89,9 @@ target_link_libraries( json-symtab-language statement-list ) +if(WITH_MEMORY_ANALYZER) + target_link_libraries(unit memory-analyzer-lib) +endif() add_test( NAME unit diff --git a/unit/Makefile b/unit/Makefile index 179985b1682..904fb2c9210 100644 --- a/unit/Makefile +++ b/unit/Makefile @@ -278,6 +278,8 @@ CATCH_TEST = unit_tests$(EXEEXT) EXCLUDED_TESTS=expr_undefined_casts.cpp ifneq ($(WITH_MEMORY_ANALYZER),1) EXCLUDED_TESTS += gdb_api.cpp +else +CPROVER_LIBS += ../src/memory-analyzer/gdb_api$(OBJEXT) endif ifeq ($(MINISAT2),) EXCLUDED_TESTS += satcheck_minisat2.cpp diff --git a/unit/analyses/does_remove_const/does_expr_lose_const.cpp b/unit/analyses/does_remove_const/does_expr_lose_const.cpp index c42004822b6..91b48bb592d 100644 --- a/unit/analyses/does_remove_const/does_expr_lose_const.cpp +++ b/unit/analyses/does_remove_const/does_expr_lose_const.cpp @@ -9,20 +9,19 @@ Author: Diffblue Ltd. /// \file /// Does Remove Const Unit Tests -#include - #include #include +#include #include #include #include -#include - #include #include #include +#include +#include SCENARIO("does_expr_lose_const", "[core][analyses][does_remove_const][does_expr_remove_const]") diff --git a/unit/analyses/variable-sensitivity/abstract_environment/to_predicate.cpp b/unit/analyses/variable-sensitivity/abstract_environment/to_predicate.cpp index 0fbaa685efc..10cd6ef6052 100644 --- a/unit/analyses/variable-sensitivity/abstract_environment/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/abstract_environment/to_predicate.cpp @@ -6,16 +6,19 @@ \*******************************************************************/ +#include +#include +#include +#include + +#include #include #include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep #include -#include -#include -#include -#include - SCENARIO( "abstract_environment to predicate", "[core][analyses][variable-sensitivity][abstract_environment][to_predicate]") diff --git a/unit/analyses/variable-sensitivity/abstract_object/index_range.cpp b/unit/analyses/variable-sensitivity/abstract_object/index_range.cpp index 3f3e1717ec5..31a30119f05 100644 --- a/unit/analyses/variable-sensitivity/abstract_object/index_range.cpp +++ b/unit/analyses/variable-sensitivity/abstract_object/index_range.cpp @@ -6,16 +6,19 @@ \*******************************************************************/ -#include "analyses/variable-sensitivity/variable_sensitivity_test_helpers.h" +#include +#include +#include +#include + #include #include +#include #include #include #include -#include -#include -#include +#include "analyses/variable-sensitivity/variable_sensitivity_test_helpers.h" SCENARIO( "index_range for constant_abstract_values" diff --git a/unit/analyses/variable-sensitivity/abstract_object/merge.cpp b/unit/analyses/variable-sensitivity/abstract_object/merge.cpp index ca45f8100cb..fb5b00fd275 100644 --- a/unit/analyses/variable-sensitivity/abstract_object/merge.cpp +++ b/unit/analyses/variable-sensitivity/abstract_object/merge.cpp @@ -6,17 +6,20 @@ \*******************************************************************/ -#include +#include +#include +#include +#include +#include #include +#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep #include #include -#include -#include -#include - SCENARIO( "merge abstract object", "[core][analyses][variable-sensitivity][abstract_object][merge]") diff --git a/unit/analyses/variable-sensitivity/constant_abstract_value/meet.cpp b/unit/analyses/variable-sensitivity/constant_abstract_value/meet.cpp index 59436db82aa..26b500e73cd 100644 --- a/unit/analyses/variable-sensitivity/constant_abstract_value/meet.cpp +++ b/unit/analyses/variable-sensitivity/constant_abstract_value/meet.cpp @@ -6,14 +6,25 @@ \*******************************************************************/ -#include -#include -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + static std::shared_ptr meet(abstract_object_pointert const &op1, abstract_object_pointert const &op2) { diff --git a/unit/analyses/variable-sensitivity/constant_abstract_value/merge.cpp b/unit/analyses/variable-sensitivity/constant_abstract_value/merge.cpp index bdc6d976e7d..10fffe551e5 100644 --- a/unit/analyses/variable-sensitivity/constant_abstract_value/merge.cpp +++ b/unit/analyses/variable-sensitivity/constant_abstract_value/merge.cpp @@ -6,14 +6,25 @@ \*******************************************************************/ -#include -#include -#include - #include #include +#include #include +#include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include + static merge_result merge(abstract_object_pointert op1, abstract_object_pointert op2) { diff --git a/unit/analyses/variable-sensitivity/constant_abstract_value/to_predicate.cpp b/unit/analyses/variable-sensitivity/constant_abstract_value/to_predicate.cpp index 83b40ad7bfe..3f373ae591c 100644 --- a/unit/analyses/variable-sensitivity/constant_abstract_value/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/constant_abstract_value/to_predicate.cpp @@ -6,15 +6,17 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include +#include +#include +#include + SCENARIO( "constant_abstract_value to predicate", "[core][analyses][variable-sensitivity][constant_abstract_value][to_" diff --git a/unit/analyses/variable-sensitivity/constant_pointer_abstract_object/to_predicate.cpp b/unit/analyses/variable-sensitivity/constant_pointer_abstract_object/to_predicate.cpp index 93a7e78590b..d3b1e6e38a9 100644 --- a/unit/analyses/variable-sensitivity/constant_pointer_abstract_object/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/constant_pointer_abstract_object/to_predicate.cpp @@ -6,16 +6,17 @@ \*******************************************************************/ -#include -#include - -#include - -#include #include +#include #include #include +#include +#include +#include +#include +#include + SCENARIO( "constant_pointer_abstract_object to predicate", "[core][analyses][variable-sensitivity][constant_pointer_abstract_object][to_" diff --git a/unit/analyses/variable-sensitivity/eval-member-access.cpp b/unit/analyses/variable-sensitivity/eval-member-access.cpp index feeea753bac..c8f78b7ed47 100644 --- a/unit/analyses/variable-sensitivity/eval-member-access.cpp +++ b/unit/analyses/variable-sensitivity/eval-member-access.cpp @@ -6,16 +6,16 @@ \*******************************************************************/ -#include +#include +#include +#include #include #include +#include #include #include - -#include -#include -#include +#include void test_array( std::vector contents, diff --git a/unit/analyses/variable-sensitivity/eval.cpp b/unit/analyses/variable-sensitivity/eval.cpp index fdbf07363d9..c6a99d6326f 100644 --- a/unit/analyses/variable-sensitivity/eval.cpp +++ b/unit/analyses/variable-sensitivity/eval.cpp @@ -1,14 +1,17 @@ // Copyright 2016-2020 Diffblue Limited. -#include -#include -#include - #include #include +#include #include #include +#include +#include +#include +#include +#include + static symbolt simple_symbol(const irep_idt &identifier, const typet &type) { symbolt b1; diff --git a/unit/analyses/variable-sensitivity/full_array_abstract_object/array_builder.cpp b/unit/analyses/variable-sensitivity/full_array_abstract_object/array_builder.cpp index 485c9004dd5..6a5f80b4918 100644 --- a/unit/analyses/variable-sensitivity/full_array_abstract_object/array_builder.cpp +++ b/unit/analyses/variable-sensitivity/full_array_abstract_object/array_builder.cpp @@ -6,7 +6,6 @@ \*******************************************************************/ -#include #include #include #include diff --git a/unit/analyses/variable-sensitivity/full_array_abstract_object/maximum_length.cpp b/unit/analyses/variable-sensitivity/full_array_abstract_object/maximum_length.cpp index b2fc8b881f3..d9bfaf98927 100644 --- a/unit/analyses/variable-sensitivity/full_array_abstract_object/maximum_length.cpp +++ b/unit/analyses/variable-sensitivity/full_array_abstract_object/maximum_length.cpp @@ -15,7 +15,6 @@ #include #include -#include #include using abstract_object_ptrt = std::shared_ptr; diff --git a/unit/analyses/variable-sensitivity/full_array_abstract_object/merge.cpp b/unit/analyses/variable-sensitivity/full_array_abstract_object/merge.cpp index 7e82939fcff..140279e4855 100644 --- a/unit/analyses/variable-sensitivity/full_array_abstract_object/merge.cpp +++ b/unit/analyses/variable-sensitivity/full_array_abstract_object/merge.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/unit/analyses/variable-sensitivity/full_struct_abstract_object/to_predicate.cpp b/unit/analyses/variable-sensitivity/full_struct_abstract_object/to_predicate.cpp index 42431368313..2ad91a4e383 100644 --- a/unit/analyses/variable-sensitivity/full_struct_abstract_object/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/full_struct_abstract_object/to_predicate.cpp @@ -7,15 +7,12 @@ \*******************************************************************/ #include -#include #include #include #include #include -#include -#include #include SCENARIO( diff --git a/unit/analyses/variable-sensitivity/interval_abstract_value/extremes-go-top.cpp b/unit/analyses/variable-sensitivity/interval_abstract_value/extremes-go-top.cpp index b13541c5db6..468fd0e3067 100644 --- a/unit/analyses/variable-sensitivity/interval_abstract_value/extremes-go-top.cpp +++ b/unit/analyses/variable-sensitivity/interval_abstract_value/extremes-go-top.cpp @@ -6,17 +6,18 @@ \*******************************************************************/ +#include +#include +#include +#include + #include -#include -#include #include -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep #include - -#include -#include -#include +#include static void verify_extreme_interval(typet type, abstract_environmentt &env, namespacet &ns) diff --git a/unit/analyses/variable-sensitivity/interval_abstract_value/meet.cpp b/unit/analyses/variable-sensitivity/interval_abstract_value/meet.cpp index 69398581a3d..76a82cc2fc5 100644 --- a/unit/analyses/variable-sensitivity/interval_abstract_value/meet.cpp +++ b/unit/analyses/variable-sensitivity/interval_abstract_value/meet.cpp @@ -6,18 +6,25 @@ \*******************************************************************/ -#include +#include +#include +#include +#include #include #include -#include -#include +#include -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep -#include -#include -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include static std::shared_ptr meet(abstract_object_pointert const &op1, abstract_object_pointert const &op2) diff --git a/unit/analyses/variable-sensitivity/interval_abstract_value/merge.cpp b/unit/analyses/variable-sensitivity/interval_abstract_value/merge.cpp index af83d5c5aa5..8951fd2c0d8 100644 --- a/unit/analyses/variable-sensitivity/interval_abstract_value/merge.cpp +++ b/unit/analyses/variable-sensitivity/interval_abstract_value/merge.cpp @@ -6,15 +6,25 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + static merge_result merge(abstract_object_pointert op1, abstract_object_pointert op2) { diff --git a/unit/analyses/variable-sensitivity/interval_abstract_value/to_predicate.cpp b/unit/analyses/variable-sensitivity/interval_abstract_value/to_predicate.cpp index 46ecd73dbb5..d5c673e391b 100644 --- a/unit/analyses/variable-sensitivity/interval_abstract_value/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/interval_abstract_value/to_predicate.cpp @@ -6,15 +6,25 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + SCENARIO( "interval_abstract_value to predicate", "[core][analyses][variable-sensitivity][interval_abstract_value][to_" diff --git a/unit/analyses/variable-sensitivity/interval_abstract_value/widening_merge.cpp b/unit/analyses/variable-sensitivity/interval_abstract_value/widening_merge.cpp index 8622c08b831..d88df12f2a2 100644 --- a/unit/analyses/variable-sensitivity/interval_abstract_value/widening_merge.cpp +++ b/unit/analyses/variable-sensitivity/interval_abstract_value/widening_merge.cpp @@ -6,14 +6,19 @@ \*******************************************************************/ -#include -#include -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + static merge_result widening_merge( const abstract_object_pointert &op1, const abstract_object_pointert &op2) diff --git a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp index 9441a748af7..f10efaa9bab 100644 --- a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp +++ b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume.cpp @@ -6,15 +6,23 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include +#include + exprt binary_expression( dstringt const &exprId, const abstract_object_pointert &op1, 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 16858b9dec0..3d9f56d2de3 100644 --- a/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp +++ b/unit/analyses/variable-sensitivity/value_expression_evaluation/assume_prune.cpp @@ -6,14 +6,23 @@ \*******************************************************************/ -#include -#include -#include - #include #include +#include #include +#include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + static void ASSUME_TRUE( symbol_exprt const &x, const irep_idt &id, diff --git a/unit/analyses/variable-sensitivity/value_expression_evaluation/expression_evaluation.cpp b/unit/analyses/variable-sensitivity/value_expression_evaluation/expression_evaluation.cpp index e13e668437a..a33d432cb3f 100644 --- a/unit/analyses/variable-sensitivity/value_expression_evaluation/expression_evaluation.cpp +++ b/unit/analyses/variable-sensitivity/value_expression_evaluation/expression_evaluation.cpp @@ -6,15 +6,25 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + SCENARIO( "value expression evaluation", "[core][analyses][variable-sensitivity][constant_abstract_value][value_set_" diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/compacting.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/compacting.cpp index 5d298eaa230..1baefda7468 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/compacting.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/compacting.cpp @@ -11,16 +11,19 @@ \*******************************************************************/ -#include -#include - -#include - #include #include -#include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + SCENARIO( "compacting value sets", "[core][analysis][variable-sensitivity][value_set_abstract_object][compact]") diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/extremes-go-top.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/extremes-go-top.cpp index 8bebf537a07..91be2ae67f3 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/extremes-go-top.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/extremes-go-top.cpp @@ -6,18 +6,18 @@ \*******************************************************************/ +#include +#include +#include + #include -#include -#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep #include #include - #include -#include -#include -#include - SCENARIO( "value-sets spanning min-max go TOP", "[core][analyses][variable-sensitivity][value_set_abstract_object][extreme]") diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/meet.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/meet.cpp index 67c44589c26..e354520d407 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/meet.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/meet.cpp @@ -6,19 +6,21 @@ \*******************************************************************/ -#include +#include +#include +#include +#include #include #include -#include +#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep #include - #include -#include -#include -#include - static std::shared_ptr meet(abstract_object_pointert const &op1, abstract_object_pointert const &op2) { diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/merge.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/merge.cpp index 126398ec5ea..31eb26d9148 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/merge.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/merge.cpp @@ -6,15 +6,25 @@ \*******************************************************************/ +#include +#include +#include +#include + +#include + #include "../variable_sensitivity_test_helpers.h" -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep -#include -#include -#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include static merge_result merge(abstract_object_pointert op1, abstract_object_pointert op2) diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/to_predicate.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/to_predicate.cpp index c3f2bbc139b..fb720e98f15 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/to_predicate.cpp @@ -6,15 +6,22 @@ \*******************************************************************/ -#include -#include - -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + SCENARIO( "value_set_abstract_object to predicate", "[core][analyses][variable-sensitivity][value_set_abstract_object][to_" diff --git a/unit/analyses/variable-sensitivity/value_set_abstract_object/widening_merge.cpp b/unit/analyses/variable-sensitivity/value_set_abstract_object/widening_merge.cpp index a64e2e541db..3da04da2640 100644 --- a/unit/analyses/variable-sensitivity/value_set_abstract_object/widening_merge.cpp +++ b/unit/analyses/variable-sensitivity/value_set_abstract_object/widening_merge.cpp @@ -6,14 +6,22 @@ \*******************************************************************/ -#include -#include -#include - #include #include +#include #include +#include +#include + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep + +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include + static merge_result widening_merge(abstract_object_pointert op1, abstract_object_pointert op2) { diff --git a/unit/analyses/variable-sensitivity/value_set_pointer_abstract_object/to_predicate.cpp b/unit/analyses/variable-sensitivity/value_set_pointer_abstract_object/to_predicate.cpp index 0869d2eeefb..85a48f8c2d3 100644 --- a/unit/analyses/variable-sensitivity/value_set_pointer_abstract_object/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/value_set_pointer_abstract_object/to_predicate.cpp @@ -6,17 +6,18 @@ \*******************************************************************/ -#include -#include -#include - -#include - -#include #include +#include #include #include +#include +// NOLINTNEXTLINE(whitespace/line_length) +#include // IWYU pragma: keep +#include +#include +#include + template std::shared_ptr make_vsp(Args &&... args) { diff --git a/unit/analyses/variable-sensitivity/variable_sensitivity_domain/to_predicate.cpp b/unit/analyses/variable-sensitivity/variable_sensitivity_domain/to_predicate.cpp index ab9a07e2da5..aa149ae0383 100644 --- a/unit/analyses/variable-sensitivity/variable_sensitivity_domain/to_predicate.cpp +++ b/unit/analyses/variable-sensitivity/variable_sensitivity_domain/to_predicate.cpp @@ -6,17 +6,16 @@ \*******************************************************************/ +#include +#include +#include +#include + #include #include #include - #include -#include -#include -#include -#include - SCENARIO( "variable_sensitivity_domain to predicate", "[core][analyses][variable-sensitivity][variable_sensitivity_domain][to_" diff --git a/unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.cpp b/unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.cpp index 95399ea7a7a..eb33d027daa 100644 --- a/unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.cpp +++ b/unit/analyses/variable-sensitivity/variable_sensitivity_test_helpers.cpp @@ -8,22 +8,21 @@ #include "variable_sensitivity_test_helpers.h" +#include +#include +#include +#include +#include +#include + #include #include #include #include #include - #include - #include -#include -#include -#include -#include -#include - std::shared_ptr make_constant(exprt val, abstract_environmentt &env, namespacet &ns) { diff --git a/unit/big-int/big-int.cpp b/unit/big-int/big-int.cpp index 7220484a2ba..678318bf238 100644 --- a/unit/big-int/big-int.cpp +++ b/unit/big-int/big-int.cpp @@ -126,7 +126,7 @@ TEST_CASE("arbitrary precision integers", "[core][big-int][bigint]") SECTION("clisp tests") { const std::vector number_tst = { -#include "number.tst" +#include "number.tst" // IWYU pragma: keep }; for(std::size_t i = 0; i < number_tst.size(); i += 4) diff --git a/unit/catch/catch.hpp b/unit/catch/catch.hpp index 36eaeb27f78..0a2b6f2fe5c 100644 --- a/unit/catch/catch.hpp +++ b/unit/catch/catch.hpp @@ -1,3 +1,5 @@ +// IWYU pragma: private, include + /* * Catch v2.13.6 * Generated: 2021-04-16 18:23:38.044268 diff --git a/unit/compound_block_locations.cpp b/unit/compound_block_locations.cpp index 3547b2bc479..d607d37ddd7 100644 --- a/unit/compound_block_locations.cpp +++ b/unit/compound_block_locations.cpp @@ -8,25 +8,22 @@ Author: Kareem Khazem , 2018 #include "compound_block_locations.h" -#include +#include +#include +#include +#include +#include -#include -#include +#include #include - #include - #include - -#include - #include +#include -#include -#include -#include -#include +#include +#include SCENARIO("Compound blocks should have a location") { diff --git a/unit/goto-instrument/expr_enumerator/expr_enumerator.cpp b/unit/goto-instrument/expr_enumerator/expr_enumerator.cpp index b4ad59a46f4..be2955b15a3 100644 --- a/unit/goto-instrument/expr_enumerator/expr_enumerator.cpp +++ b/unit/goto-instrument/expr_enumerator/expr_enumerator.cpp @@ -8,7 +8,9 @@ Author: Qinheping Hu #include #include +#include #include +#include #include #include diff --git a/unit/goto-programs/goto_program_assume.cpp b/unit/goto-programs/goto_program_assume.cpp index f9147e8ca9f..dcdb959d321 100644 --- a/unit/goto-programs/goto_program_assume.cpp +++ b/unit/goto-programs/goto_program_assume.cpp @@ -6,14 +6,15 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include +#include #include #include +#include + SCENARIO( "Validation of well-formed assert/assume codes", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_dead.cpp b/unit/goto-programs/goto_program_dead.cpp index 36aed6daaff..7abba241eea 100644 --- a/unit/goto-programs/goto_program_dead.cpp +++ b/unit/goto-programs/goto_program_dead.cpp @@ -6,13 +6,14 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include +#include #include #include +#include + SCENARIO( "Validation of well-formed symbol removing codes", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_declaration.cpp b/unit/goto-programs/goto_program_declaration.cpp index 4f4d1292e76..7a16550a5cc 100644 --- a/unit/goto-programs/goto_program_declaration.cpp +++ b/unit/goto-programs/goto_program_declaration.cpp @@ -6,13 +6,14 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include +#include #include #include +#include + SCENARIO( "Validation of well-formed declaration codes", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_function_call.cpp b/unit/goto-programs/goto_program_function_call.cpp index 03bf2661e7b..14256a01ddd 100644 --- a/unit/goto-programs/goto_program_function_call.cpp +++ b/unit/goto-programs/goto_program_function_call.cpp @@ -6,13 +6,14 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include +#include #include #include +#include + SCENARIO( "Validation of well-formed function call codes", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_goto_target.cpp b/unit/goto-programs/goto_program_goto_target.cpp index 5033304ece6..d46a66b42c2 100644 --- a/unit/goto-programs/goto_program_goto_target.cpp +++ b/unit/goto-programs/goto_program_goto_target.cpp @@ -6,14 +6,15 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include +#include #include #include +#include + SCENARIO( "Validation of well-formed goto codes", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_symbol_type_table_consistency.cpp b/unit/goto-programs/goto_program_symbol_type_table_consistency.cpp index 1a8e942137d..818c9f7378a 100644 --- a/unit/goto-programs/goto_program_symbol_type_table_consistency.cpp +++ b/unit/goto-programs/goto_program_symbol_type_table_consistency.cpp @@ -6,14 +6,15 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include +#include #include #include +#include + SCENARIO( "Validation of consistent program/table pair (type-wise)", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_program_table_consistency.cpp b/unit/goto-programs/goto_program_table_consistency.cpp index 8e381448bec..85c496f5ff3 100644 --- a/unit/goto-programs/goto_program_table_consistency.cpp +++ b/unit/goto-programs/goto_program_table_consistency.cpp @@ -6,14 +6,15 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - #include #include +#include #include #include +#include + SCENARIO( "Validation of consistent program/table pair", "[core][goto-programs][validate]") diff --git a/unit/goto-programs/goto_trace_output.cpp b/unit/goto-programs/goto_trace_output.cpp index 4d8ea1d2ed7..729d5ca2b50 100644 --- a/unit/goto-programs/goto_trace_output.cpp +++ b/unit/goto-programs/goto_trace_output.cpp @@ -6,14 +6,15 @@ Author: Diffblue Ltd. \*******************************************************************/ +#include +#include + #include #include -#include - #include -#include +#include SCENARIO( "Output trace with nil lhs object", diff --git a/unit/goto-programs/osx_fat_reader.cpp b/unit/goto-programs/osx_fat_reader.cpp index aad75b8d902..fa0236e6ecc 100644 --- a/unit/goto-programs/osx_fat_reader.cpp +++ b/unit/goto-programs/osx_fat_reader.cpp @@ -13,7 +13,7 @@ Author: Diffblue Ltd. #include #endif -#include +#include // IWYU pragma: keep TEST_CASE("OSX fat binary reader", "[core][goto-programs][osx_fat_reader]") { diff --git a/unit/goto-symex/ssa_equation.cpp b/unit/goto-symex/ssa_equation.cpp index f86b3d89f9c..1e39a549605 100644 --- a/unit/goto-symex/ssa_equation.cpp +++ b/unit/goto-symex/ssa_equation.cpp @@ -6,13 +6,13 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include -#include - #include +#include #include #include +#include +#include SCENARIO("Validation of well-formed SSA steps", "[core][goto-symex][validate]") { diff --git a/unit/goto-symex/symex_assign.cpp b/unit/goto-symex/symex_assign.cpp index 00e006ff75c..aa2395be29b 100644 --- a/unit/goto-symex/symex_assign.cpp +++ b/unit/goto-symex/symex_assign.cpp @@ -6,22 +6,21 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com \*******************************************************************/ -#include -#include +#include +#include +#include +#include +#include #include #include - #include #include #include #include -#include - -#include -#include -#include -#include +#include +#include +#include static void add_to_symbol_table( symbol_tablet &symbol_table, diff --git a/unit/interpreter/interpreter.cpp b/unit/interpreter/interpreter.cpp index 1d7607c9067..f891fa6b862 100644 --- a/unit/interpreter/interpreter.cpp +++ b/unit/interpreter/interpreter.cpp @@ -6,14 +6,16 @@ Author: Diffblue Ltd. \*******************************************************************/ -#include - -#include #include #include #include #include +#include + +#include + +#include typedef interpretert::mp_vectort mp_vectort; diff --git a/unit/memory-analyzer/gdb_api.cpp b/unit/memory-analyzer/gdb_api.cpp index 758e21b6f94..a4192f77487 100644 --- a/unit/memory-analyzer/gdb_api.cpp +++ b/unit/memory-analyzer/gdb_api.cpp @@ -7,21 +7,19 @@ Author: Malte Mues \*******************************************************************/ +#include +#include + +#include #include #include +#include // IWYU pragma: keep +#include #include #include #include -#include -#include - -#include - -#include -#include - struct compile_test_filet { compile_test_filet() : compiled("test", "") @@ -31,8 +29,8 @@ struct compile_test_filet REQUIRE(of.is_open()); of << -#include - ; // NOLINT(whitespace/semicolon) +#include // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) of.close(); REQUIRE(run("gcc", {"gcc", "-g", "-o", compiled(), tmp()}) == 0); @@ -87,8 +85,8 @@ void gdb_api_internals_test() REQUIRE(of.is_open()); of << -#include - ; // NOLINT(whitespace/semicolon) +#include // IWYU pragma: keep + ; // NOLINT(whitespace/semicolon) of.close(); gdb_api_testt gdb_api(args); diff --git a/unit/path_strategies.h b/unit/path_strategies.h index 118bc2f7307..46a182678e0 100644 --- a/unit/path_strategies.h +++ b/unit/path_strategies.h @@ -5,11 +5,9 @@ #ifndef CPROVER_PATH_STRATEGIES_H #define CPROVER_PATH_STRATEGIES_H -#include - #include -#include +class goto_symex_statet; /// \brief Events that we expect to happen during path exploration /// diff --git a/unit/pointer-analysis/value_set.cpp b/unit/pointer-analysis/value_set.cpp index 537362c32f4..d946d6c8701 100644 --- a/unit/pointer-analysis/value_set.cpp +++ b/unit/pointer-analysis/value_set.cpp @@ -9,14 +9,14 @@ Author: Diffblue Ltd. /// \file /// Unit tests for value_sett -#include - -#include - #include +#include #include #include +#include +#include + static bool object_descriptor_matches( const exprt &descriptor_expr, const exprt &target) { diff --git a/unit/solvers/smt2_incremental/ast/module_dependencies.txt b/unit/solvers/smt2_incremental/ast/module_dependencies.txt index 957ae56b205..bdf634de77b 100644 --- a/unit/solvers/smt2_incremental/ast/module_dependencies.txt +++ b/unit/solvers/smt2_incremental/ast/module_dependencies.txt @@ -1,3 +1,4 @@ solvers/smt2_incremental/ast solvers/smt2_incremental/theories testing-utils +util diff --git a/unit/solvers/smt2_incremental/ast/smt_responses.cpp b/unit/solvers/smt2_incremental/ast/smt_responses.cpp index f80073da356..fbcfc4d75f1 100644 --- a/unit/solvers/smt2_incremental/ast/smt_responses.cpp +++ b/unit/solvers/smt2_incremental/ast/smt_responses.cpp @@ -1,6 +1,6 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep #include #include diff --git a/unit/solvers/smt2_incremental/construct_value_expr_from_smt.cpp b/unit/solvers/smt2_incremental/construct_value_expr_from_smt.cpp index 6ee384d03f7..755d9fa4834 100644 --- a/unit/solvers/smt2_incremental/construct_value_expr_from_smt.cpp +++ b/unit/solvers/smt2_incremental/construct_value_expr_from_smt.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include diff --git a/unit/solvers/smt2_incremental/convert_expr_to_smt.cpp b/unit/solvers/smt2_incremental/convert_expr_to_smt.cpp index e9e7b3d1b2b..3ff1b9d1f2b 100644 --- a/unit/solvers/smt2_incremental/convert_expr_to_smt.cpp +++ b/unit/solvers/smt2_incremental/convert_expr_to_smt.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/unit/solvers/smt2_incremental/smt_response_validation.cpp b/unit/solvers/smt2_incremental/smt_response_validation.cpp index ff4a15c792d..ec1aa27c791 100644 --- a/unit/solvers/smt2_incremental/smt_response_validation.cpp +++ b/unit/solvers/smt2_incremental/smt_response_validation.cpp @@ -1,7 +1,8 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep +#include #include #include #include diff --git a/unit/solvers/smt2_incremental/smt_to_smt2_string.cpp b/unit/solvers/smt2_incremental/smt_to_smt2_string.cpp index 8dd71129de5..0acc53a4129 100644 --- a/unit/solvers/smt2_incremental/smt_to_smt2_string.cpp +++ b/unit/solvers/smt2_incremental/smt_to_smt2_string.cpp @@ -1,9 +1,9 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep #include -#include +#include // IWYU pragma: keep #include #include #include diff --git a/unit/solvers/smt2_incremental/theories/smt_array_theory.cpp b/unit/solvers/smt2_incremental/theories/smt_array_theory.cpp index 2b38f0541cb..e4ed658aba7 100644 --- a/unit/solvers/smt2_incremental/theories/smt_array_theory.cpp +++ b/unit/solvers/smt2_incremental/theories/smt_array_theory.cpp @@ -1,9 +1,8 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep #include -#include #include #include diff --git a/unit/solvers/smt2_incremental/theories/smt_bit_vector_theory.cpp b/unit/solvers/smt2_incremental/theories/smt_bit_vector_theory.cpp index 13d13d1463e..6a65f15cb92 100644 --- a/unit/solvers/smt2_incremental/theories/smt_bit_vector_theory.cpp +++ b/unit/solvers/smt2_incremental/theories/smt_bit_vector_theory.cpp @@ -1,6 +1,6 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep #include #include diff --git a/unit/solvers/smt2_incremental/theories/smt_core_theory.cpp b/unit/solvers/smt2_incremental/theories/smt_core_theory.cpp index c481209d21e..5457f0bc653 100644 --- a/unit/solvers/smt2_incremental/theories/smt_core_theory.cpp +++ b/unit/solvers/smt2_incremental/theories/smt_core_theory.cpp @@ -1,6 +1,6 @@ // Author: Diffblue Ltd. -#include +#include // IWYU pragma: keep #include #include diff --git a/unit/testing-utils/call_graph_test_utils.cpp b/unit/testing-utils/call_graph_test_utils.cpp index 058c8e4904e..bca85d6da1e 100644 --- a/unit/testing-utils/call_graph_test_utils.cpp +++ b/unit/testing-utils/call_graph_test_utils.cpp @@ -8,7 +8,7 @@ Author: Chris Smowton, chris.smowton@diffblue.com #include "call_graph_test_utils.h" -#include +#include symbolt create_void_function_symbol(const irep_idt &name, const codet &code) diff --git a/unit/testing-utils/require_symbol.cpp b/unit/testing-utils/require_symbol.cpp index 8d3e541e3aa..4e3289ff32f 100644 --- a/unit/testing-utils/require_symbol.cpp +++ b/unit/testing-utils/require_symbol.cpp @@ -7,10 +7,11 @@ Author: Diffblue Limited. \*******************************************************************/ #include "require_symbol.h" -#include "use_catch.h" #include +#include + /// Verify whether a given identifier is found in the symbol table and return it /// \param symbol_table: The symbol table to look in /// \param symbol_identifier: The name of the symbol diff --git a/unit/util/file_util.cpp b/unit/util/file_util.cpp index 4c0c9e2cdbe..93c03fcfa92 100644 --- a/unit/util/file_util.cpp +++ b/unit/util/file_util.cpp @@ -6,12 +6,12 @@ Author: Daniel Kroening \*******************************************************************/ -#include - -#include +#include // IWYU pragma: keep #include #include +#include + #ifdef _MSC_VER # include #endif diff --git a/unit/util/format.cpp b/unit/util/format.cpp index d6e711ed18d..29ac4216ec1 100644 --- a/unit/util/format.cpp +++ b/unit/util/format.cpp @@ -7,8 +7,14 @@ \*******************************************************************/ #include -#include #include -#include +#include #include + +TEST_CASE("Format an expression.", "[core][util][format]") +{ + const signedbv_typet int_type{32}; + plus_exprt plus{symbol_exprt{"foo", int_type}, symbol_exprt{"bar", int_type}}; + REQUIRE(format_to_string(plus) == "foo + bar"); +} diff --git a/unit/util/format_expr.cpp b/unit/util/format_expr.cpp index b39f642b6b3..3b3c45c4f27 100644 --- a/unit/util/format_expr.cpp +++ b/unit/util/format_expr.cpp @@ -6,7 +6,6 @@ \*******************************************************************/ -#include #include #include diff --git a/unit/util/format_number_range.cpp b/unit/util/format_number_range.cpp index 4ec29521c0a..846362d2ab3 100644 --- a/unit/util/format_number_range.cpp +++ b/unit/util/format_number_range.cpp @@ -6,11 +6,11 @@ Author: Michael Tautschnig \*******************************************************************/ -#include - -#include +#include // IWYU pragma: keep #include +#include + TEST_CASE( "Format a range of unsigned numbers", "[core][util][format_number_range]") diff --git a/unit/util/piped_process.cpp b/unit/util/piped_process.cpp index 746722ffa5a..83455c8f271 100644 --- a/unit/util/piped_process.cpp +++ b/unit/util/piped_process.cpp @@ -2,15 +2,16 @@ /// \author Diffblue Ltd. /// Unit tests for checking the piped process communication mechanism. -#include #include #include #include #include +#ifdef _WIN32 // Used for testing destructor/timing #include +#endif TEST_CASE( "Creating a sub process and reading its output.", diff --git a/unit/util/symbol.cpp b/unit/util/symbol.cpp index 6ed1baf152a..cf4c420384e 100644 --- a/unit/util/symbol.cpp +++ b/unit/util/symbol.cpp @@ -10,7 +10,6 @@ Author: Diffblue Ltd. #include -#include #include SCENARIO( diff --git a/unit/util/symbol_table.cpp b/unit/util/symbol_table.cpp index f83244e77f6..6b189a78df7 100644 --- a/unit/util/symbol_table.cpp +++ b/unit/util/symbol_table.cpp @@ -2,10 +2,12 @@ /// \file Tests for symbol_tablet +#include // IWYU pragma: keep +#include +#include + #include #include -#include -#include TEST_CASE("Iterating through a symbol table", "[core][utils][symbol_tablet]") {