Skip to content

Commit a425011

Browse files
committed
move goto_convert from goto-programs/ to ansi-c/
The goto_convertt class and associated helpers convert a C parse tree into a set of GOTO functions. They are specific to C, and hence, should be in the ansi-c/ directory.
1 parent 08b2f2f commit a425011

File tree

99 files changed

+506
-494
lines changed

Some content is hidden

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

99 files changed

+506
-494
lines changed

jbmc/src/java_bytecode/assignments_from_json.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Author: Diffblue Ltd.
1616
#include <util/symbol_table_base.h>
1717
#include <util/unicode.h>
1818

19-
#include <goto-programs/allocate_objects.h>
19+
#include <ansi-c/allocate_objects.h>
20+
2021
#include <goto-programs/class_identifier.h>
2122
#include <goto-programs/goto_instruction_code.h>
2223

jbmc/src/java_bytecode/convert_java_nondet.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ Author: Reuben Thomas, [email protected]
1111

1212
#include "convert_java_nondet.h"
1313

14-
#include <goto-programs/goto_convert.h>
1514
#include <goto-programs/goto_model.h>
1615
#include <goto-programs/remove_skip.h>
1716

17+
#include <ansi-c/goto-conversion/goto_convert.h>
18+
1819
#include "java_object_factory.h" // gen_nondet_init
1920
#include "java_object_factory_parameters.h"
2021
#include "java_utils.h"

jbmc/src/java_bytecode/java_object_factory.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ Author: Daniel Kroening, [email protected]
7171
#ifndef CPROVER_JAVA_BYTECODE_JAVA_OBJECT_FACTORY_H
7272
#define CPROVER_JAVA_BYTECODE_JAVA_OBJECT_FACTORY_H
7373

74-
#include "nondet.h"
74+
#include <util/std_code.h>
7575

76-
#include <goto-programs/allocate_objects.h>
76+
#include <ansi-c/allocate_objects.h>
7777

78-
#include <util/std_code.h>
78+
#include "nondet.h"
7979

8080
class message_handlert;
8181
class select_pointer_typet;

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ Date: April 2017
2929
#include <util/string_expr.h>
3030
#include <util/symbol_table_base.h>
3131

32-
#include <goto-programs/allocate_objects.h>
3332
#include <goto-programs/class_identifier.h>
3433

34+
#include <ansi-c/allocate_objects.h>
35+
3536
#include "java_types.h"
3637
#include "java_utils.h"
3738

jbmc/src/java_bytecode/lazy_goto_functions_map.h

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66
#ifndef CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H
77
#define CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H
88

9-
#include <unordered_set>
9+
#include <util/journalling_symbol_table.h>
10+
#include <util/message.h>
11+
#include <util/symbol_table_builder.h>
1012

11-
#include <goto-programs/goto_convert_functions.h>
1213
#include <goto-programs/goto_functions.h>
1314

15+
#include <ansi-c/goto-conversion/goto_convert_functions.h>
1416
#include <langapi/language_file.h>
15-
#include <util/journalling_symbol_table.h>
16-
#include <util/message.h>
17-
#include <util/symbol_table_builder.h>
17+
18+
#include <unordered_set>
1819

1920
/// Provides a wrapper for a map of lazily loaded goto_functiont.
2021
/// This incrementally builds a goto-functions object, while permitting

jbmc/src/java_bytecode/nondet.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Author: Diffblue Ltd.
88

99
#include "nondet.h"
1010

11-
#include <goto-programs/allocate_objects.h>
12-
1311
#include <util/arith_tools.h>
1412

13+
#include <ansi-c/allocate_objects.h>
14+
1515
symbol_exprt generate_nondet_int(
1616
const exprt &min_value_expr,
1717
const exprt &max_value_expr,

jbmc/src/java_bytecode/remove_java_new.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ Author: Peter Schrammel
1919
#include <util/std_code.h>
2020

2121
#include <goto-programs/class_identifier.h>
22-
#include <goto-programs/goto_convert.h>
2322
#include <goto-programs/goto_model.h>
2423

24+
#include <ansi-c/goto-conversion/goto_convert.h>
25+
2526
#include "java_types.h"
2627
#include "java_utils.h"
2728

jbmc/src/jbmc/jbmc_parse_options.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Author: Daniel Kroening, [email protected]
2020

2121
#include <goto-programs/adjust_float_expressions.h>
2222
#include <goto-programs/goto_check.h>
23-
#include <goto-programs/goto_convert_functions.h>
2423
#include <goto-programs/instrument_preconditions.h>
2524
#include <goto-programs/loop_ids.h>
2625
#include <goto-programs/remove_returns.h>
@@ -33,6 +32,7 @@ Author: Daniel Kroening, [email protected]
3332
#include <goto-programs/show_symbol_table.h>
3433

3534
#include <ansi-c/ansi_c_language.h>
35+
#include <ansi-c/goto-conversion/goto_convert_functions.h>
3636
#include <goto-checker/all_properties_verifier.h>
3737
#include <goto-checker/all_properties_verifier_with_fault_localization.h>
3838
#include <goto-checker/all_properties_verifier_with_trace_storage.h>

jbmc/unit/java_bytecode/java_bytecode_instrument/module_dependencies.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ansi-c
12
testing-utils
23
java-testing-utils
34
analyses

jbmc/unit/java_bytecode/java_bytecode_instrument/virtual_call_null_checks.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ Author: Diffblue Limited.
88
\*******************************************************************/
99

1010
#include <java-testing-utils/load_java_class.h>
11-
#include <testing-utils/message.h>
12-
#include <testing-utils/use_catch.h>
1311

14-
#include <analyses/local_safe_pointers.h>
15-
#include <goto-programs/goto_convert_functions.h>
1612
#include <util/expr_iterator.h>
1713

14+
#include <analyses/local_safe_pointers.h>
15+
#include <ansi-c/goto-conversion/goto_convert_functions.h>
16+
#include <testing-utils/message.h>
17+
#include <testing-utils/use_catch.h>
18+
1819
// We're expecting a call "something->field . B.virtualmethod()":
1920
static bool is_expected_virtualmethod_call(
2021
const goto_programt::instructiont &instruction)

jbmc/unit/java_bytecode/java_replace_nondet/module_dependencies.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ansi-c
12
goto-programs
23
java_bytecode
34
java-testing-utils

jbmc/unit/java_bytecode/java_replace_nondet/replace_nondet.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ Author: Diffblue Ltd.
88
\*******************************************************************/
99

1010
#include <java-testing-utils/load_java_class.h>
11-
#include <testing-utils/message.h>
12-
#include <testing-utils/use_catch.h>
1311

1412
#include <goto-programs/class_hierarchy.h>
15-
#include <goto-programs/goto_convert_functions.h>
1613
#include <goto-programs/remove_returns.h>
1714
#include <goto-programs/remove_virtual_functions.h>
1815

16+
#include <ansi-c/goto-conversion/goto_convert_functions.h>
1917
#include <java_bytecode/convert_java_nondet.h>
2018
#include <java_bytecode/java_object_factory_parameters.h>
2119
#include <java_bytecode/remove_instanceof.h>
2220
#include <java_bytecode/replace_java_nondet.h>
21+
#include <testing-utils/message.h>
22+
#include <testing-utils/use_catch.h>
2323

2424
void validate_nondet_method_removed(
2525
std::list<goto_programt::instructiont> instructions)

jbmc/unit/java_bytecode/java_virtual_functions/module_dependencies.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ansi-c/goto-conversion
12
goto-instrument
23
goto-programs
34
java_bytecode

jbmc/unit/java_bytecode/java_virtual_functions/virtual_functions.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ Author: Diffblue Ltd.
77
\*******************************************************************/
88

99
#include <java-testing-utils/load_java_class.h>
10-
#include <testing-utils/message.h>
11-
#include <testing-utils/use_catch.h>
1210

13-
#include <goto-programs/goto_convert_functions.h>
14-
#include <goto-programs/remove_virtual_functions.h>
1511
#include <util/config.h>
16-
#include <goto-instrument/cover.h>
1712
#include <util/options.h>
1813

14+
#include <goto-programs/remove_virtual_functions.h>
15+
16+
#include <ansi-c/goto-conversion/goto_convert_functions.h>
17+
#include <goto-instrument/cover.h>
18+
#include <testing-utils/message.h>
19+
#include <testing-utils/use_catch.h>
20+
1921
void check_function_call(
2022
const equal_exprt &eq_expr,
2123
const irep_idt &class_name,

jbmc/unit/java_bytecode/module_dependencies.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
ansi-c
12
java_bytecode
23
linking
34
testing-utils

src/ansi-c/Makefile

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
SRC = anonymous_member.cpp \
1+
SRC = allocate_objects.cpp \
2+
anonymous_member.cpp \
23
ansi_c_convert_type.cpp \
34
ansi_c_declaration.cpp \
45
ansi_c_entry_point.cpp \
@@ -11,6 +12,7 @@ SRC = anonymous_member.cpp \
1112
ansi_c_typecheck.cpp \
1213
ansi_c_y.tab.cpp \
1314
builtin_factory.cpp \
15+
printf_formatter.cpp \
1416
c_expr.cpp \
1517
c_misc.cpp \
1618
c_nondet_symbol_factory.cpp \
@@ -32,7 +34,20 @@ SRC = anonymous_member.cpp \
3234
expr2c.cpp \
3335
gcc_types.cpp \
3436
gcc_version.cpp \
35-
goto_check_c.cpp \
37+
goto-conversion/builtin_functions.cpp \
38+
goto-conversion/goto_asm.cpp \
39+
goto-conversion/destructor.cpp \
40+
goto-conversion/format_strings.cpp \
41+
goto-conversion/goto_convert.cpp \
42+
goto-conversion/goto_check_c.cpp \
43+
goto-conversion/goto_convert_exceptions.cpp \
44+
goto-conversion/goto_clean_expr.cpp \
45+
goto-conversion/goto_convert_functions.cpp \
46+
goto-conversion/goto_convert_function_call.cpp \
47+
goto-conversion/goto_convert_side_effect.cpp \
48+
goto-conversion/link_to_library.cpp \
49+
goto-conversion/scope_tree.cpp \
50+
goto-conversion/string_instrumentation.cpp \
3651
literals/convert_character_literal.cpp \
3752
literals/convert_float_literal.cpp \
3853
literals/convert_integer_literal.cpp \

src/goto-programs/allocate_objects.cpp renamed to src/ansi-c/allocate_objects.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Author: Daniel Kroening, [email protected]
1414
#include <util/pointer_offset_size.h>
1515
#include <util/symbol.h>
1616

17-
#include "goto_instruction_code.h"
17+
#include <goto-programs/goto_instruction_code.h>
1818

1919
/// Allocates a new object, either by creating a local variable with automatic
2020
/// lifetime, a global variable with static lifetime, or by dynamically
File renamed without changes.

src/ansi-c/c_nondet_symbol_factory.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Author: Diffblue Ltd.
2020
#include <util/std_expr.h>
2121
#include <util/symbol.h>
2222

23-
#include <goto-programs/allocate_objects.h>
2423
#include <goto-programs/goto_functions.h>
2524

26-
#include <ansi-c/c_object_factory_parameters.h>
25+
#include "allocate_objects.h"
26+
#include "c_object_factory_parameters.h"
2727

2828
/// Creates a nondet for expr, including calling itself recursively to make
2929
/// appropriate symbols to point to if expr is a pointer.

src/ansi-c/c_nondet_symbol_factory.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Author: Diffblue Ltd.
1212
#ifndef CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
1313
#define CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
1414

15-
#include <set>
15+
#include "allocate_objects.h"
1616

17-
#include <goto-programs/allocate_objects.h>
17+
#include <set>
1818

1919
struct c_object_factory_parameterst;
2020

src/goto-programs/destructor.cpp renamed to src/ansi-c/goto-conversion/destructor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Author: Daniel Kroening, [email protected]
1010
/// Destructor Calls
1111

1212
#include "destructor.h"
13-
#include "goto_instruction_code.h"
13+
14+
#include <goto-programs/goto_instruction_code.h>
1415

1516
#include <util/namespace.h>
1617
#include <util/pointer_expr.h>

src/ansi-c/goto_check_c.cpp renamed to src/ansi-c/goto-conversion/goto_check_c.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Author: Daniel Kroening, [email protected]
3939
#include <langapi/language.h>
4040
#include <langapi/mode.h>
4141

42-
#include "c_expr.h"
42+
#include <ansi-c/c_expr.h>
4343

4444
#include <algorithm>
4545

File renamed without changes.

src/goto-programs/goto_convert.cpp renamed to src/ansi-c/goto-conversion/goto_convert.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
99
/// \file
1010
/// Program Transformation
1111

12+
#include "destructor.h"
1213
#include "goto_convert.h"
1314
#include "goto_convert_class.h"
1415

@@ -24,8 +25,7 @@ Author: Daniel Kroening, [email protected]
2425
#include <util/string_constant.h>
2526
#include <util/symbol_table_builder.h>
2627

27-
#include "destructor.h"
28-
#include "remove_skip.h"
28+
#include <goto-programs/remove_skip.h>
2929

3030
static bool is_empty(const goto_programt &goto_program)
3131
{

src/goto-programs/goto_convert_class.h renamed to src/ansi-c/goto-conversion/goto_convert_class.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ Author: Daniel Kroening, [email protected]
1717
#include <util/replace_expr.h>
1818
#include <util/std_code.h>
1919

20-
#include "allocate_objects.h"
21-
#include "goto_program.h"
22-
#include "scope_tree.h"
20+
#include <ansi-c/allocate_objects.h>
21+
22+
#include <goto-programs/goto_program.h>
2323

2424
#include <list>
2525
#include <unordered_set>
2626
#include <vector>
2727

28+
#include "scope_tree.h"
29+
2830
class side_effect_expr_overflowt;
2931
struct build_declaration_hops_inputst;
3032

src/goto-programs/goto_convert_functions.cpp renamed to src/ansi-c/goto-conversion/goto_convert_functions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Date: June 2003
1515

1616
#include <linking/static_lifetime_init.h>
1717

18-
#include "goto_model.h"
18+
#include <goto-programs/goto_model.h>
1919

2020
goto_convert_functionst::goto_convert_functionst(
2121
symbol_table_baset &_symbol_table,

src/goto-programs/goto_convert_functions.h renamed to src/ansi-c/goto-conversion/goto_convert_functions.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Date: June 2003
1515
#define CPROVER_GOTO_PROGRAMS_GOTO_CONVERT_FUNCTIONS_H
1616

1717
#include "goto_convert_class.h"
18-
#include "goto_functions.h"
18+
19+
#include <goto-programs/goto_functions.h>
1920

2021
class goto_modelt;
2122

src/goto-programs/link_to_library.cpp renamed to src/ansi-c/goto-conversion/link_to_library.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <linking/static_lifetime_init.h>
1515

16-
#include "compute_called_functions.h"
16+
#include <goto-programs/compute_called_functions.h>
17+
#include <goto-programs/goto_model.h>
18+
#include <goto-programs/link_goto_model.h>
19+
1720
#include "goto_convert_functions.h"
18-
#include "goto_model.h"
19-
#include "link_goto_model.h"
2021

2122
/// Try to add \p missing_function from \p library to \p goto_model.
2223
static std::pair<std::optional<replace_symbolt::expr_mapt>, bool>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ansi-c
2+
goto-programs
3+
linking
4+
util

src/goto-programs/string_instrumentation.cpp renamed to src/ansi-c/goto-conversion/string_instrumentation.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ Author: Daniel Kroening, [email protected]
2020
#include <util/std_code.h>
2121
#include <util/string_constant.h>
2222

23-
#include <goto-programs/format_strings.h>
2423
#include <goto-programs/goto_model.h>
2524
#include <goto-programs/remove_skip.h>
2625

26+
#include "format_strings.h"
27+
2728
exprt is_zero_string(const exprt &what, bool write)
2829
{
2930
unary_exprt result{"is_zero_string", what, c_bool_type()};

0 commit comments

Comments
 (0)