Skip to content

Commit 47a8f4e

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 03833b2 commit 47a8f4e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-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
@@ -80,6 +80,14 @@ bool is_clinit_wrapper_function(const irep_idt &function_id)
8080
return has_suffix(id2string(function_id), clinit_wrapper_suffix);
8181
}
8282

83+
/// Check if function_id is a clinit
84+
/// \param function_id: some function identifier
85+
/// \return true if the passed identifier is a clinit
86+
bool is_clinit_function(const irep_idt &function_id)
87+
{
88+
return has_suffix(id2string(function_id), clinit_function_suffix);
89+
}
90+
8391
/// Add a new symbol to the symbol table.
8492
/// Note: assumes that a symbol with this name does not exist.
8593
/// /param name: name of the symbol to be generated

jbmc/src/java_bytecode/java_static_initializers.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ irep_idt clinit_wrapper_name(const irep_idt &class_name);
2525
irep_idt user_specified_clinit_name(const irep_idt &class_name);
2626

2727
bool is_clinit_wrapper_function(const irep_idt &function_id);
28+
bool is_clinit_function(const irep_idt &function_id);
2829

2930
void create_static_initializer_symbols(
3031
symbol_tablet &symbol_table,

0 commit comments

Comments
 (0)