Skip to content

Commit

Permalink
move goto_convert from goto-programs/ to ansi-c/
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kroening committed Mar 27, 2024
1 parent 08b2f2f commit 40b2f25
Show file tree
Hide file tree
Showing 98 changed files with 1,412 additions and 1,457 deletions.
3 changes: 2 additions & 1 deletion jbmc/src/java_bytecode/assignments_from_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Author: Diffblue Ltd.
#include <util/symbol_table_base.h>
#include <util/unicode.h>

#include <goto-programs/allocate_objects.h>
#include <goto-programs/class_identifier.h>
#include <goto-programs/goto_instruction_code.h>

#include <ansi-c/allocate_objects.h>

#include "ci_lazy_methods_needed.h"
#include "code_with_references.h"
#include "java_static_initializers.h"
Expand Down
3 changes: 2 additions & 1 deletion jbmc/src/java_bytecode/convert_java_nondet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ Author: Reuben Thomas, [email protected]

#include "convert_java_nondet.h"

#include <goto-programs/goto_convert.h>
#include <goto-programs/goto_model.h>
#include <goto-programs/remove_skip.h>

#include <ansi-c/goto-conversion/goto_convert.h>

#include "java_object_factory.h" // gen_nondet_init
#include "java_object_factory_parameters.h"
#include "java_utils.h"
Expand Down
6 changes: 3 additions & 3 deletions jbmc/src/java_bytecode/java_object_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ Author: Daniel Kroening, [email protected]
#ifndef CPROVER_JAVA_BYTECODE_JAVA_OBJECT_FACTORY_H
#define CPROVER_JAVA_BYTECODE_JAVA_OBJECT_FACTORY_H

#include "nondet.h"
#include <util/std_code.h>

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

#include <util/std_code.h>
#include "nondet.h"

class message_handlert;
class select_pointer_typet;
Expand Down
3 changes: 2 additions & 1 deletion jbmc/src/java_bytecode/java_string_library_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ Date: April 2017
#include <util/string_expr.h>
#include <util/symbol_table_base.h>

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

#include <ansi-c/allocate_objects.h>

#include "java_types.h"
#include "java_utils.h"

Expand Down
11 changes: 6 additions & 5 deletions jbmc/src/java_bytecode/lazy_goto_functions_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@
#ifndef CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H
#define CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H

#include <unordered_set>
#include <util/journalling_symbol_table.h>
#include <util/message.h>
#include <util/symbol_table_builder.h>

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

#include <ansi-c/goto-conversion/goto_convert_functions.h>
#include <langapi/language_file.h>
#include <util/journalling_symbol_table.h>
#include <util/message.h>
#include <util/symbol_table_builder.h>

#include <unordered_set>

/// Provides a wrapper for a map of lazily loaded goto_functiont.
/// This incrementally builds a goto-functions object, while permitting
Expand Down
4 changes: 2 additions & 2 deletions jbmc/src/java_bytecode/nondet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Author: Diffblue Ltd.

#include "nondet.h"

#include <goto-programs/allocate_objects.h>

#include <util/arith_tools.h>

#include <ansi-c/allocate_objects.h>

symbol_exprt generate_nondet_int(
const exprt &min_value_expr,
const exprt &max_value_expr,
Expand Down
3 changes: 2 additions & 1 deletion jbmc/src/java_bytecode/remove_java_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Author: Peter Schrammel
#include <util/std_code.h>

#include <goto-programs/class_identifier.h>
#include <goto-programs/goto_convert.h>
#include <goto-programs/goto_model.h>

#include <ansi-c/goto-conversion/goto_convert.h>

#include "java_types.h"
#include "java_utils.h"

Expand Down
2 changes: 1 addition & 1 deletion jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Author: Daniel Kroening, [email protected]

#include <goto-programs/adjust_float_expressions.h>
#include <goto-programs/goto_check.h>
#include <goto-programs/goto_convert_functions.h>
#include <goto-programs/instrument_preconditions.h>
#include <goto-programs/loop_ids.h>
#include <goto-programs/remove_returns.h>
Expand All @@ -33,6 +32,7 @@ Author: Daniel Kroening, [email protected]
#include <goto-programs/show_symbol_table.h>

#include <ansi-c/ansi_c_language.h>
#include <ansi-c/goto-conversion/goto_convert_functions.h>
#include <goto-checker/all_properties_verifier.h>
#include <goto-checker/all_properties_verifier_with_fault_localization.h>
#include <goto-checker/all_properties_verifier_with_trace_storage.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ansi-c
testing-utils
java-testing-utils
analyses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ Author: Diffblue Limited.
\*******************************************************************/

#include <java-testing-utils/load_java_class.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

#include <analyses/local_safe_pointers.h>
#include <goto-programs/goto_convert_functions.h>
#include <util/expr_iterator.h>

#include <analyses/local_safe_pointers.h>
#include <ansi-c/goto-conversion/goto_convert_functions.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

// We're expecting a call "something->field . B.virtualmethod()":
static bool is_expected_virtualmethod_call(
const goto_programt::instructiont &instruction)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ansi-c
goto-programs
java_bytecode
java-testing-utils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Author: Diffblue Ltd.
\*******************************************************************/

#include <java-testing-utils/load_java_class.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

#include <goto-programs/class_hierarchy.h>
#include <goto-programs/goto_convert_functions.h>
#include <goto-programs/remove_returns.h>
#include <goto-programs/remove_virtual_functions.h>

#include <ansi-c/goto-conversion/goto_convert_functions.h>
#include <java_bytecode/convert_java_nondet.h>
#include <java_bytecode/java_object_factory_parameters.h>
#include <java_bytecode/remove_instanceof.h>
#include <java_bytecode/replace_java_nondet.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

void validate_nondet_method_removed(
std::list<goto_programt::instructiont> instructions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ Author: Diffblue Ltd.
\*******************************************************************/

#include <java-testing-utils/load_java_class.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

#include <goto-programs/goto_convert_functions.h>
#include <goto-programs/remove_virtual_functions.h>
#include <util/config.h>
#include <goto-instrument/cover.h>
#include <util/options.h>

#include <goto-programs/remove_virtual_functions.h>

#include <ansi-c/goto-conversion/goto_convert_functions.h>
#include <goto-instrument/cover.h>
#include <testing-utils/message.h>
#include <testing-utils/use_catch.h>

void check_function_call(
const equal_exprt &eq_expr,
const irep_idt &class_name,
Expand Down
1 change: 1 addition & 0 deletions jbmc/unit/java_bytecode/module_dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ansi-c
java_bytecode
linking
testing-utils
Expand Down
19 changes: 17 additions & 2 deletions src/ansi-c/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SRC = anonymous_member.cpp \
SRC = allocate_objects.cpp \
anonymous_member.cpp \
ansi_c_convert_type.cpp \
ansi_c_declaration.cpp \
ansi_c_entry_point.cpp \
Expand All @@ -11,6 +12,7 @@ SRC = anonymous_member.cpp \
ansi_c_typecheck.cpp \
ansi_c_y.tab.cpp \
builtin_factory.cpp \
printf_formatter.cpp \
c_expr.cpp \
c_misc.cpp \
c_nondet_symbol_factory.cpp \
Expand All @@ -32,7 +34,20 @@ SRC = anonymous_member.cpp \
expr2c.cpp \
gcc_types.cpp \
gcc_version.cpp \
goto_check_c.cpp \
goto-conversion/builtin_functions.cpp \
goto-conversion/goto_asm.cpp \
goto-conversion/destructor.cpp \
goto-conversion/format_strings.cpp \
goto-conversion/goto_convert.cpp \
goto-conversion/goto_check_c.cpp \
goto-conversion/goto_convert_exceptions.cpp \
goto-conversion/goto_clean_expr.cpp \
goto-conversion/goto_convert_functions.cpp \
goto-conversion/goto_convert_function_call.cpp \
goto-conversion/goto_convert_side_effect.cpp \
goto-conversion/link_to_library.cpp \
goto-conversion/scope_tree.cpp \
goto-conversion/string_instrumentation.cpp \
literals/convert_character_literal.cpp \
literals/convert_float_literal.cpp \
literals/convert_integer_literal.cpp \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Author: Daniel Kroening, [email protected]
#include <util/pointer_offset_size.h>
#include <util/symbol.h>

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

/// Allocates a new object, either by creating a local variable with automatic
/// lifetime, a global variable with static lifetime, or by dynamically
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Author: Daniel Kroening, [email protected]
\*******************************************************************/

#ifndef CPROVER_UTIL_ALLOCATE_OBJECTS_H
#define CPROVER_UTIL_ALLOCATE_OBJECTS_H
#ifndef CPROVER_ANSI_C_ALLOCATE_OBJECTS_H
#define CPROVER_ANSI_C_ALLOCATE_OBJECTS_H

#include <util/namespace.h>
#include <util/std_code.h>
Expand Down
4 changes: 2 additions & 2 deletions src/ansi-c/c_nondet_symbol_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Author: Diffblue Ltd.
#include <util/std_expr.h>
#include <util/symbol.h>

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

#include <ansi-c/c_object_factory_parameters.h>
#include "allocate_objects.h"
#include "c_object_factory_parameters.h"

/// Creates a nondet for expr, including calling itself recursively to make
/// appropriate symbols to point to if expr is a pointer.
Expand Down
4 changes: 2 additions & 2 deletions src/ansi-c/c_nondet_symbol_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Author: Diffblue Ltd.
#ifndef CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
#define CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H

#include <set>
#include "allocate_objects.h"

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

struct c_object_factory_parameterst;

Expand Down
Loading

0 comments on commit 40b2f25

Please sign in to comment.