Skip to content

Commit 7f1830e

Browse files
Add function that checks if function id represents a clinit.
A utility for checking whether the supplied function id corresponds to a clinit.
1 parent 32e5d4f commit 7f1830e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

jbmc/src/java_bytecode/java_static_initializers.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ bool is_clinit_wrapper_function(const irep_idt &function_id)
7373
return has_suffix(id2string(function_id), clinit_wrapper_suffix);
7474
}
7575

76+
/// Check if function_id is a clinit
77+
/// \param function_id: some function identifier
78+
/// \return true if the passed identifier is a clinit
79+
bool is_clinit_function(const irep_idt &function_id)
80+
{
81+
return has_suffix(id2string(function_id), clinit_function_suffix);
82+
}
83+
7684
/// Add a new symbol to the symbol table.
7785
/// Note: assumes that a symbol with this name does not exist.
7886
/// /param name: name of the symbol to be generated

jbmc/src/java_bytecode/java_static_initializers.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ irep_idt clinit_wrapper_name(const irep_idt &class_name);
2323

2424
bool is_clinit_wrapper_function(const irep_idt &function_id);
2525

26+
bool is_clinit_function(const irep_idt &function_id);
27+
2628
void create_static_initializer_wrappers(
2729
symbol_tablet &symbol_table,
2830
synthetic_methods_mapt &synthetic_methods,

0 commit comments

Comments
 (0)