cprover
java_utils.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #ifndef CPROVER_JAVA_BYTECODE_JAVA_UTILS_H
10 #define CPROVER_JAVA_BYTECODE_JAVA_UTILS_H
11 
12 #include <unordered_set>
13 
14 #include <util/message.h>
15 #include <util/std_expr.h>
16 #include <util/symbol_table.h>
17 
19 
20 bool java_is_array_type(const typet &type);
21 
23  const irep_idt &class_name,
24  symbol_table_baset &symbol_table,
26  const struct_union_typet::componentst &componentst);
27 
30 unsigned java_local_variable_slots(const typet &t);
31 
34 unsigned java_method_parameter_slots(const code_typet &t);
35 
36 const std::string java_class_to_package(const std::string &canonical_classname);
37 
48  exprt &expr,
49  const source_locationt &source_location);
50 
51 #define JAVA_STRING_LITERAL_PREFIX "java::java.lang.String.Literal"
52 
55 bool is_java_string_literal_id(const irep_idt &id);
56 
65  const std::string &friendly_name,
66  const symbol_table_baset &symbol_table,
67  std::string &error);
68 
72 dereference_exprt checked_dereference(const exprt &expr, const typet &type);
73 
79  symbolt &class_symbol,
80  const struct_union_typet::componentst &components_to_add);
81 
83  const std::string &src,
84  size_t position,
85  char open_char,
86  char close_char);
87 
88 void declare_function(
89  irep_idt function_name,
90  const typet &type,
91  symbol_table_baset &symbol_table);
92 
94  const irep_idt &function_name,
95  const exprt::operandst &arguments,
96  const typet &type,
97  symbol_table_baset &symbol_table);
98 
100 
101 std::string pretty_print_java_type(const std::string &fqn_java_type);
102 
104  const irep_idt &component_class_id,
105  const irep_idt &component_name,
106  const irep_idt &user_class_id,
107  const symbol_tablet &symbol_table,
108  const class_hierarchyt &class_hierarchy,
109  bool include_interfaces);
110 
112 
113 extern const std::unordered_set<std::string> cprover_methods_to_ignore;
114 
115 #endif // CPROVER_JAVA_BYTECODE_JAVA_UTILS_H
The type of an expression.
Definition: type.h:22
bool is_java_string_literal_id(const irep_idt &id)
Definition: java_utils.cpp:116
void generate_class_stub(const irep_idt &class_name, symbol_table_baset &symbol_table, message_handlert &message_handler, const struct_union_typet::componentst &componentst)
Definition: java_utils.cpp:66
Base type of functions.
Definition: std_types.h:764
const std::string java_class_to_package(const std::string &canonical_classname)
Definition: java_utils.cpp:61
irep_idt strip_java_namespace_prefix(const irep_idt &to_strip)
Strip java:: prefix from given identifier.
Definition: java_utils.cpp:301
std::vector< componentt > componentst
Definition: std_types.h:243
exprt make_function_application(const irep_idt &function_name, const exprt::operandst &arguments, const typet &type, symbol_table_baset &symbol_table)
Create a function application expression.
Definition: java_utils.cpp:280
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
Definition: symbol.h:30
std::string pretty_print_java_type(const std::string &fqn_java_type)
Strip the package name from a java type, for the type to be pretty printed (java::java.lang.Integer -> Integer).
Definition: java_utils.cpp:315
const std::unordered_set< std::string > cprover_methods_to_ignore
Methods belonging to the class org.cprover.CProver that should be ignored (not converted), leaving the driver program to stub them if it wishes.
Definition: java_utils.cpp:433
Operator to dereference a pointer.
Definition: std_expr.h:3284
API to expression classes.
The symbol table.
Definition: symbol_table.h:19
Given a class and a component (either field or method), find the closest parent that defines that com...
unsigned java_method_parameter_slots(const code_typet &t)
Returns the the number of JVM local variables (slots) used by the JVM to pass, upon call...
Definition: java_utils.cpp:51
void merge_source_location_rec(exprt &expr, const source_locationt &source_location)
Attaches a source location to an expression and all of its subexpressions.
Definition: java_utils.cpp:107
Author: Diffblue Ltd.
bool is_non_null_library_global(const irep_idt &)
Check if a symbol is a well-known non-null global.
Definition: java_utils.cpp:421
std::vector< exprt > operandst
Definition: expr.h:45
size_t find_closing_delimiter(const std::string &src, size_t position, char open_char, char close_char)
Finds the corresponding closing delimiter to the given opening delimiter.
Definition: java_utils.cpp:200
resolve_inherited_componentt::inherited_componentt get_inherited_component(const irep_idt &component_class_id, const irep_idt &component_name, const irep_idt &user_class_id, const symbol_tablet &symbol_table, const class_hierarchyt &class_hierarchy, bool include_interfaces)
Finds an inherited component (method or field), taking component visibility into account.
Definition: java_utils.cpp:345
unsigned java_local_variable_slots(const typet &t)
Returns the number of JVM local variables (slots) taken by a local variable that, when translated to ...
Definition: java_utils.cpp:30
bool java_is_array_type(const typet &type)
Definition: java_utils.cpp:23
Base class for all expressions.
Definition: expr.h:42
The symbol table base class interface.
void java_add_components_to_class(symbolt &class_symbol, const struct_union_typet::componentst &components_to_add)
Add the components in components_to_add to the class denoted by class symbol.
Definition: java_utils.cpp:239
dereference_exprt checked_dereference(const exprt &expr, const typet &type)
Dereference an expression and flag it for a null-pointer check.
Definition: java_utils.cpp:179
goto_programt coverage_criteriont message_handlert & message_handler
Definition: cover.cpp:66
irep_idt resolve_friendly_method_name(const std::string &friendly_name, const symbol_table_baset &symbol_table, std::string &error)
Resolves a user-friendly method name (like packagename.Class.method) into an internal name (like java...
Definition: java_utils.cpp:121
void declare_function(irep_idt function_name, const typet &type, symbol_table_baset &symbol_table)
Declare a function with the given name and type.
Definition: java_utils.cpp:258