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

jbmc/src/java_bytecode/convert_java_nondet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Author: Reuben Thomas, [email protected]
1212
#ifndef CPROVER_JAVA_BYTECODE_CONVERT_NONDET_H
1313
#define CPROVER_JAVA_BYTECODE_CONVERT_NONDET_H
1414

15-
#include <cstddef> // size_t
1615
#include <util/irep.h>
1716

1817
class goto_functionst;

jbmc/src/java_bytecode/create_array_with_type_intrinsic.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Author: Diffblue Ltd.
1111

1212
#include "create_array_with_type_intrinsic.h"
1313

14-
#include <goto-programs/class_identifier.h>
15-
1614
#include <java_bytecode/java_types.h>
1715

1816
#include <util/fresh_symbol.h>

jbmc/src/java_bytecode/create_array_with_type_intrinsic.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ Author: Diffblue Ltd.
1212
#ifndef CPROVER_JAVA_BYTECODE_CREATE_ARRAY_WITH_TYPE_INTRINSIC_H
1313
#define CPROVER_JAVA_BYTECODE_CREATE_ARRAY_WITH_TYPE_INTRINSIC_H
1414

15-
#include <util/message.h>
1615
#include <util/std_code.h>
17-
#include <util/symbol_table_base.h>
16+
17+
class message_handlert;
18+
class symbol_table_baset;
1819

1920
irep_idt get_create_array_with_type_name();
2021

jbmc/src/java_bytecode/expr2java.cpp

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

99
#include "expr2java.h"
1010

11-
#include <sstream>
12-
1311
#include <util/namespace.h>
14-
#include <util/std_types.h>
1512
#include <util/std_expr.h>
16-
#include <util/symbol.h>
1713
#include <util/unicode.h>
1814
#include <util/arith_tools.h>
1915
#include <util/ieee_float.h>

jbmc/src/java_bytecode/expr2java.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Author: Daniel Kroening, [email protected]
1111
#define CPROVER_JAVA_BYTECODE_EXPR2JAVA_H
1212

1313
#include <cmath>
14-
#include <limits>
15-
#include <numeric>
1614
#include <sstream>
1715
#include <string>
1816

jbmc/src/java_bytecode/generic_parameter_specialization_map_keys.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include "generic_parameter_specialization_map_keys.h"
44

5-
#include <util/range.h>
6-
75
/// Add the parameters and their types for each generic parameter of the
86
/// given generic pointer type to the map.
97
/// Own the keys and pop from their stack on destruction.

jbmc/src/java_bytecode/generic_parameter_specialization_map_keys.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#ifndef CPROVER_JAVA_BYTECODE_GENERIC_PARAMETER_SPECIALIZATION_MAP_KEYS_H
44
#define CPROVER_JAVA_BYTECODE_GENERIC_PARAMETER_SPECIALIZATION_MAP_KEYS_H
55

6-
#include "select_pointer_type.h"
7-
#include "java_types.h"
6+
#include "generic_parameter_specialization_map.h"
87

98
/// \file
109
/// Generic-parameter-specialization-map entries owner class.

jbmc/src/java_bytecode/jar_file.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ Author: Diffblue Ltd
1010

1111
#include <algorithm>
1212
#include <cctype>
13-
14-
#include <util/invariant.h>
15-
#include <util/suffix.h>
16-
17-
#include "java_class_loader_limit.h"
13+
#include <sstream>
1814

1915
void jar_filet::initialize_file_index()
2016
{

jbmc/src/java_bytecode/jar_file.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Author: Diffblue Ltd
1010
#define CPROVER_JAVA_BYTECODE_JAR_FILE_H
1111

1212
#include <unordered_map>
13-
#include <memory>
1413
#include <string>
1514
#include <vector>
1615

jbmc/src/java_bytecode/jar_pool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include <map>
1313
#include <string>
1414

15-
class jar_filet;
15+
#include "jar_file.h"
1616

1717
/// A chache for jar_filet objects, by file name
1818
class jar_poolt

jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Author: Kurt Degiogrio, [email protected]
1111
#include "java_types.h"
1212
#include "java_utils.h"
1313

14+
#include <util/arith_tools.h>
15+
#include <util/cprover_prefix.h>
1416
#include <util/expr_iterator.h>
17+
#include <util/message.h>
1518
#include <util/namespace.h>
16-
#include <util/cprover_prefix.h>
1719
#include <util/std_types.h>
18-
#include <util/arith_tools.h>
20+
#include <util/symbol_table.h>
1921

2022
// Disable linter to allow an std::string constant.
2123
const std::string next_thread_id = CPROVER_PREFIX "_next_thread_id";// NOLINT(*)

jbmc/src/java_bytecode/java_bytecode_concurrency_instrumentation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Author: Kurt Degiogrio, [email protected]
88
#ifndef CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONCURRENCY_INSTRUMENTATION_H
99
#define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONCURRENCY_INSTRUMENTATION_H
1010

11-
#include <util/symbol_table.h>
12-
#include <util/message.h>
11+
class message_handlert;
12+
class symbol_tablet;
1313

1414
void convert_threadblock(symbol_tablet &symbol_table);
1515
void convert_synchronized_methods(

jbmc/src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,17 @@ Author: Daniel Kroening, [email protected]
1515
#include <iostream>
1616
#endif
1717

18+
#include "ci_lazy_methods.h"
19+
#include "java_bytecode_convert_method.h"
1820
#include "java_root_class.h"
1921
#include "java_types.h"
20-
#include "java_bytecode_convert_method.h"
21-
#include "java_bytecode_language.h"
2222
#include "java_utils.h"
2323

24-
#include <goto-programs/class_identifier.h>
25-
2624
#include <util/arith_tools.h>
27-
#include <util/c_types.h>
2825
#include <util/expr_initializer.h>
2926
#include <util/namespace.h>
3027
#include <util/prefix.h>
3128
#include <util/std_expr.h>
32-
#include <util/suffix.h>
3329

3430
class java_bytecode_convert_classt
3531
{

jbmc/src/java_bytecode/java_bytecode_convert_class.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ Author: Daniel Kroening, [email protected]
1313
#define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_CLASS_H
1414

1515
#include <unordered_set>
16-
#include <util/symbol_table.h>
17-
#include <util/message.h>
1816

1917
#include "java_bytecode_parse_tree.h"
20-
#include "java_bytecode_language.h"
18+
#include "java_class_loader.h"
19+
20+
class java_string_library_preprocesst;
21+
class method_bytecodet;
22+
class symbol_tablet;
2123

2224
/// See class \ref java_bytecode_convert_classt
2325
bool java_bytecode_convert_class(

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,26 @@ Author: Daniel Kroening, [email protected]
2424
#include "java_utils.h"
2525
#include "lambda_synthesis.h"
2626
#include "pattern.h"
27-
#include "remove_exceptions.h"
2827

2928
#include <util/arith_tools.h>
29+
#include <util/bitvector_expr.h>
3030
#include <util/c_types.h>
3131
#include <util/expr_initializer.h>
3232
#include <util/floatbv_expr.h>
3333
#include <util/ieee_float.h>
3434
#include <util/invariant.h>
3535
#include <util/namespace.h>
3636
#include <util/prefix.h>
37-
#include <util/simplify_expr.h>
37+
#include <util/prefix_filter.h>
3838
#include <util/std_expr.h>
39-
#include <util/string2int.h>
4039
#include <util/threeval.h>
4140

42-
#include <goto-programs/cfg.h>
43-
#include <goto-programs/class_hierarchy.h>
44-
#include <goto-programs/remove_returns.h>
4541
#include <goto-programs/resolve_inherited_component.h>
4642

47-
#include <analyses/cfg_dominators.h>
4843
#include <analyses/uncaught_exceptions_analysis.h>
4944

5045
#include <algorithm>
51-
#include <functional>
5246
#include <limits>
53-
#include <regex>
54-
#include <unordered_set>
5547

5648
/// Iterates through the parameters of the function type \p ftype, finds a new
5749
/// new name for each parameter and renames them in `ftype.parameters()` as

0 commit comments

Comments
 (0)