CBMC
java_entry_point.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #ifndef CPROVER_JAVA_BYTECODE_JAVA_ENTRY_POINT_H
11 #define CPROVER_JAVA_BYTECODE_JAVA_ENTRY_POINT_H
12 
13 #include <util/irep.h>
14 #include <util/symbol.h>
15 
16 class code_blockt; // IWYU pragma: keep
18 class symbol_table_baset;
20 
21 #define JAVA_ENTRY_POINT_RETURN_SYMBOL "return'"
22 #define JAVA_ENTRY_POINT_EXCEPTION_SYMBOL "uncaught_exception'"
23 
25  std::function<std::pair<code_blockt, std::vector<exprt>>(
26  const symbolt &function,
27  symbol_table_baset &symbol_table)>;
28 
77 bool java_entry_point(
78  class symbol_table_baset &symbol_table,
79  const irep_idt &main_class,
80  class message_handlert &message_handler,
81  bool assume_init_pointers_not_null,
82  bool assert_uncaught_exceptions,
83  const java_object_factory_parameterst &object_factory_parameters,
84  const select_pointer_typet &pointer_type_selector,
85  bool string_refinement_enabled,
86  const build_argumentst &build_arguments);
87 
89 {
90  enum statust
91  {
94  NotFound
95  } status;
97 
98  // Implicit conversion doesn't lose information and allows return of status
99  // NOLINTNEXTLINE(runtime/explicit)
101  {
102  }
103 
104  // Implicit conversion doesn't lose information and allows return of symbol
105  // NOLINTNEXTLINE(runtime/explicit)
108  {
109  }
110 
111  bool is_success() const
112  {
113  return status == Success;
114  }
115  bool is_error() const
116  {
117  return status == Error;
118  }
119 };
120 
138 
141  const symbol_table_baset &symbol_table,
142  const irep_idt &main_class,
143  message_handlert &);
144 
157  const symbolt &symbol,
158  class symbol_table_baset &symbol_table,
159  class message_handlert &message_handler,
160  bool assert_uncaught_exceptions,
161  const java_object_factory_parameterst &object_factory_parameters,
162  const select_pointer_typet &pointer_type_selector,
163  const build_argumentst &build_arguments);
164 
183 std::pair<code_blockt, std::vector<exprt>> java_build_arguments(
184  const symbolt &function,
185  symbol_table_baset &symbol_table,
186  bool assume_init_pointers_not_null,
187  java_object_factory_parameterst object_factory_parameters,
188  const select_pointer_typet &pointer_type_selector,
189  message_handlert &message_handler);
190 
193 void create_java_initialize(symbol_table_baset &symbol_table);
194 
197  symbol_table_baset &symbol_table,
198  const source_locationt &source_location,
199  bool assume_init_pointers_not_null,
200  java_object_factory_parameterst object_factory_parameters,
201  const select_pointer_typet &pointer_type_selector,
202  bool string_refinement_enabled,
203  message_handlert &message_handler);
204 
205 #endif // CPROVER_JAVA_BYTECODE_JAVA_ENTRY_POINT_H
A codet representing sequential composition of program statements.
Definition: std_code.h:130
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
The symbol table base class interface.
Symbol table entry.
Definition: symbol.h:28
bool generate_java_start_function(const symbolt &symbol, class symbol_table_baset &symbol_table, class message_handlert &message_handler, bool assert_uncaught_exceptions, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, const build_argumentst &build_arguments)
Generate a _start function for a specific function.
bool java_entry_point(class symbol_table_baset &symbol_table, const irep_idt &main_class, class message_handlert &message_handler, bool assume_init_pointers_not_null, bool assert_uncaught_exceptions, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, const build_argumentst &build_arguments)
Given the symbol_table and the main_class to test, this function generates a new function __CPROVER__...
void create_java_initialize(symbol_table_baset &symbol_table)
Adds __cprover_initialize to the symbol_table but does not generate code for it yet.
std::function< std::pair< code_blockt, std::vector< exprt > >(const symbolt &function, symbol_table_baset &symbol_table)> build_argumentst
void java_static_lifetime_init(symbol_table_baset &symbol_table, const source_locationt &source_location, bool assume_init_pointers_not_null, java_object_factory_parameterst object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, message_handlert &message_handler)
Adds the body to __CPROVER_initialize.
main_function_resultt get_main_symbol(const symbol_table_baset &symbol_table, const irep_idt &main_class, message_handlert &)
Figures out the entry point of the code to verify.
std::pair< code_blockt, std::vector< exprt > > java_build_arguments(const symbolt &function, symbol_table_baset &symbol_table, bool assume_init_pointers_not_null, java_object_factory_parameterst object_factory_parameters, const select_pointer_typet &pointer_type_selector, message_handlert &message_handler)
irep_idt get_java_class_literal_initializer_signature()
Get the symbol name of java.lang.Class' initializer method.
main_function_resultt(const symbolt &main_function)
enum main_function_resultt::statust status
main_function_resultt(statust status)
Symbol table entry.