Skip to content

Commit adab366

Browse files
committed
Move construction of identifier into constructor
This makes it possible to find the code for constructing the identifier for a `class_method_descriptor_exprt` by looking at `class_method_descriptor_exprt` only. Where as previously it would have been neccessary to search for all places where the contructor was used.
1 parent e720271 commit adab366

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,11 +760,8 @@ void java_bytecode_parsert::rconstant_pool()
760760

761761
irep_idt class_id = class_tag.get_identifier();
762762

763-
irep_idt identifier =
764-
id2string(class_id) + "." + id2string(mangled_method_name);
765-
766763
entry.expr = class_method_descriptor_exprt{
767-
type, mangled_method_name, class_id, name_entry.s, identifier};
764+
type, mangled_method_name, class_id, name_entry.s};
768765
}
769766
break;
770767

jbmc/unit/java_bytecode/goto-programs/remove_virtual_functions_without_fallback.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,8 @@ SCENARIO(
133133
const symbolt &callee_symbol =
134134
symbol_table.lookup_ref("java::VirtualFunctionsTestParent.f:()V");
135135

136-
class_method_descriptor_exprt callee{callee_symbol.type,
137-
"f:()V",
138-
"java::VirtualFunctionsTestParent",
139-
"f",
140-
callee_symbol.name};
136+
class_method_descriptor_exprt callee{
137+
callee_symbol.type, "f:()V", "java::VirtualFunctionsTestParent", "f"};
141138

142139
const code_function_callt call(
143140
callee,

src/util/std_expr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4609,14 +4609,14 @@ class class_method_descriptor_exprt : public nullary_exprt
46094609
typet _type,
46104610
irep_idt mangled_method_name,
46114611
irep_idt class_id,
4612-
irep_idt base_method_name,
4613-
irep_idt identifier)
4612+
irep_idt base_method_name)
46144613
: nullary_exprt(ID_virtual_function, std::move(_type))
46154614
{
4615+
irep_idt id = id2string(class_id) + "." + id2string(mangled_method_name);
46164616
set(ID_component_name, std::move(mangled_method_name));
46174617
set(ID_C_class, std::move(class_id));
46184618
set(ID_C_base_name, std::move(base_method_name));
4619-
set(ID_identifier, std::move(identifier));
4619+
set(ID_identifier, std::move(id));
46204620
}
46214621

46224622
/// The method name after mangling it by combining it with the descriptor.

0 commit comments

Comments
 (0)