Skip to content

Commit 450845d

Browse files
committed
Remove unnecessary includes
Manual removal of includes based on include-what-you-use's output, filtered for includes that should be removed. The goal is to avoid unnecessary build dependencies, reducing the amount of code that needs to be rebuilt during incremental builds. The build time for fresh rebuilds decreases by about 7% as the following experiment shows: ``` rm -rf build && ccache -C cmake -H. -Bbuild -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld -Wl,--threads" /usr/bin/time -v ninja -C build -j32 ``` Repeated execution for both develop and this branch producing the following data, which less than 1s of variation across multiple runs: develop: ``` Command being timed: "ninja -C build -j32" User time (seconds): 2714.02 System time (seconds): 203.75 Percent of CPU this job got: 2833% Elapsed (wall clock) time (h:mm:ss or m:ss): 1:42.96 ``` this PR: ``` Command being timed: "ninja -C build -j32" User time (seconds): 2507.14 System time (seconds): 189.95 Percent of CPU this job got: 2822% Elapsed (wall clock) time (h:mm:ss or m:ss): 1:35.56 ```
1 parent e2af83f commit 450845d

File tree

864 files changed

+1310
-1869
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

864 files changed

+1310
-1869
lines changed

jbmc/src/janalyzer/janalyzer_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Author: Peter Schrammel
1111

1212
#include "janalyzer_parse_options.h"
1313

14-
#include <util/unicode.h>
14+
#ifdef _MSC_VER
15+
# include <util/unicode.h>
16+
#endif
1517

1618
#ifdef _MSC_VER
1719
int wmain(int argc, const wchar_t **argv_wide)

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,8 @@ Author: Daniel Kroening, [email protected]
1919

2020
#include <ansi-c/ansi_c_language.h>
2121

22-
#include <goto-programs/goto_convert_functions.h>
23-
#include <goto-programs/goto_inline.h>
24-
#include <goto-programs/read_goto_binary.h>
25-
#include <goto-programs/remove_complex.h>
26-
#include <goto-programs/remove_function_pointers.h>
2722
#include <goto-programs/remove_returns.h>
2823
#include <goto-programs/remove_skip.h>
29-
#include <goto-programs/remove_vector.h>
3024
#include <goto-programs/remove_virtual_functions.h>
3125
#include <goto-programs/set_properties.h>
3226
#include <goto-programs/show_properties.h>
@@ -36,7 +30,6 @@ Author: Daniel Kroening, [email protected]
3630
#include <analyses/dependence_graph.h>
3731
#include <analyses/goto_check.h>
3832
#include <analyses/interval_domain.h>
39-
#include <analyses/is_threaded.h>
4033
#include <analyses/local_may_alias.h>
4134

4235
#include <java_bytecode/java_bytecode_language.h>
@@ -52,7 +45,6 @@ Author: Daniel Kroening, [email protected]
5245
#include <util/config.h>
5346
#include <util/exit_codes.h>
5447
#include <util/options.h>
55-
#include <util/unicode.h>
5648
#include <util/version.h>
5749

5850
#include <goto-analyzer/static_show_domain.h>

jbmc/src/janalyzer/janalyzer_parse_options.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,19 @@ Author: Daniel Kroening, [email protected]
102102

103103
#include <util/parse_options.h>
104104
#include <util/timestamper.h>
105-
#include <util/ui_message.h>
106105

107106
#include <langapi/language.h>
108107

109-
#include <goto-programs/goto_model.h>
110108
#include <goto-programs/show_goto_functions.h>
111109
#include <goto-programs/show_properties.h>
112110

113-
#include <analyses/ai.h>
114111
#include <analyses/goto_check.h>
115112

116113
#include <java_bytecode/java_bytecode_language.h>
117114

118-
class bmct;
119-
class goto_functionst;
115+
class abstract_goto_modelt;
116+
class ai_baset;
117+
class goto_model_functiont;
120118
class optionst;
121119

122120
// clang-format off

jbmc/src/java_bytecode/assignments_from_json.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ Author: Diffblue Ltd.
1111
#include "ci_lazy_methods_needed.h"
1212
#include "code_with_references.h"
1313
#include "java_static_initializers.h"
14-
#include "java_string_library_preprocess.h"
1514
#include "java_string_literals.h"
15+
#include "java_types.h"
1616
#include "java_utils.h"
1717

1818
#include <goto-programs/class_identifier.h>
19+
1920
#include <util/allocate_objects.h>
21+
#include <util/arith_tools.h>
2022
#include <util/array_element_from_pointer.h>
2123
#include <util/expr_initializer.h>
22-
#include <util/prefix.h>
24+
#include <util/ieee_float.h>
25+
#include <util/json.h>
26+
#include <util/symbol_table_base.h>
2327
#include <util/unicode.h>
2428

2529
/// Values passed around between most functions of the recursive deterministic

jbmc/src/java_bytecode/assignments_from_json.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Author: Diffblue Ltd.
1212
#define CPROVER_JAVA_BYTECODE_ASSIGNMENTS_FROM_JSON_H
1313

1414
#include "code_with_references.h"
15-
#include <util/std_code.h>
1615

1716
class jsont;
1817
class symbol_table_baset;

jbmc/src/java_bytecode/ci_lazy_methods.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ Author: Diffblue Ltd.
77
\*******************************************************************/
88

99
#include "ci_lazy_methods.h"
10-
#include "java_entry_point.h"
10+
#include "java_bytecode_language.h"
1111
#include "java_class_loader.h"
12-
#include "java_utils.h"
13-
#include "java_string_library_preprocess.h"
12+
#include "java_entry_point.h"
1413
#include "remove_exceptions.h"
1514

1615
#include <util/expr_iterator.h>
16+
#include <util/namespace.h>
1717
#include <util/suffix.h>
1818

1919
#include <goto-programs/resolve_inherited_component.h>

jbmc/src/java_bytecode/ci_lazy_methods.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,21 @@ Author: Diffblue Ltd.
1212
#ifndef CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H
1313
#define CPROVER_JAVA_BYTECODE_GATHER_METHODS_LAZILY_H
1414

15-
#include "ci_lazy_methods_needed.h"
1615
#include "java_bytecode_parse_tree.h"
17-
#include "java_class_loader.h"
18-
#include "select_pointer_type.h"
1916
#include "synthetic_methods_map.h"
2017

21-
#include <map>
2218
#include <functional>
19+
#include <map>
20+
#include <unordered_set>
2321

2422
#include <util/irep.h>
25-
#include <util/symbol_table.h>
26-
#include <util/message.h>
2723

2824
#include <goto-programs/class_hierarchy.h>
2925

30-
class java_string_library_preprocesst;
26+
class ci_lazy_methods_neededt;
27+
class java_class_loadert;
28+
class message_handlert;
29+
class select_pointer_typet;
3130

3231
// Map from method id to class_method_and_bytecodet
3332
class method_bytecodet

jbmc/src/java_bytecode/ci_lazy_methods_needed.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ Author: Chris Smowton, [email protected]
1515

1616
#include <util/namespace.h>
1717
#include <util/std_types.h>
18+
#include <util/symbol_table.h>
1819

19-
#include <string>
20-
20+
#include "generic_parameter_specialization_map.h"
2121
#include "java_static_initializers.h"
22+
#include "java_types.h"
2223
#include "select_pointer_type.h"
2324

2425
/// Notes `method_symbol_name` is referenced from some reachable function, and

jbmc/src/java_bytecode/ci_lazy_methods_needed.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ Author: Chris Smowton, [email protected]
1212
#ifndef CPROVER_JAVA_BYTECODE_CI_LAZY_METHODS_H
1313
#define CPROVER_JAVA_BYTECODE_CI_LAZY_METHODS_H
1414

15-
#include <set>
1615
#include <unordered_set>
17-
#include <util/namespace.h>
18-
#include <util/symbol_table.h>
19-
#include <vector>
2016

21-
class select_pointer_typet;
17+
#include <util/irep.h>
18+
19+
class namespacet;
2220
class pointer_typet;
21+
class select_pointer_typet;
22+
class symbol_tablet;
23+
class typet;
2324

2425
class ci_lazy_methods_neededt
2526
{

jbmc/src/java_bytecode/convert_java_nondet.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ Author: Reuben Thomas, [email protected]
1515
#include <goto-programs/goto_model.h>
1616
#include <goto-programs/remove_skip.h>
1717

18-
#include <util/irep_ids.h>
19-
20-
#include <memory>
21-
2218
#include "java_object_factory.h" // gen_nondet_init
19+
#include "java_object_factory_parameters.h"
2320
#include "java_utils.h"
2421

2522
/// Returns true if `expr` is a nondet pointer that isn't a function pointer or

0 commit comments

Comments
 (0)