Skip to content

Commit 85a1e8b

Browse files
author
svorenova
committed
Move and reuse source_location.function
If the assignment to the method.source_location.function is done first, we can reuse it when assigning instruction.source_location.function
1 parent 07587bc commit 85a1e8b

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

jbmc/src/java_bytecode/java_bytecode_parser.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,11 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
12381238
for(std::size_t j=0; j<attributes_count; j++)
12391239
rcode_attribute(method);
12401240

1241+
// method name
1242+
method.source_location.set_function(
1243+
"java::" + id2string(parse_tree.parsed_class.name) + "." +
1244+
id2string(method.name) + ":" + method.descriptor);
1245+
12411246
irep_idt line_number;
12421247

12431248
// add missing line numbers
@@ -1250,10 +1255,7 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
12501255
line_number=it->source_location.get_line();
12511256
else if(!line_number.empty())
12521257
it->source_location.set_line(line_number);
1253-
it->source_location
1254-
.set_function(
1255-
"java::"+id2string(parse_tree.parsed_class.name)+"."+
1256-
id2string(method.name)+":"+method.descriptor);
1258+
it->source_location.set_function(method.source_location.get_function());
12571259
}
12581260

12591261
// line number of method (the first line number available)
@@ -1265,11 +1267,6 @@ void java_bytecode_parsert::rmethod_attribute(methodt &method)
12651267
});
12661268
if(it != method.instructions.end())
12671269
method.source_location.set_line(it->source_location.get_line());
1268-
1269-
// method name
1270-
method.source_location.set_function(
1271-
"java::" + id2string(parse_tree.parsed_class.name) + "." +
1272-
id2string(method.name) + ":" + method.descriptor);
12731270
}
12741271
else if(attribute_name=="Signature")
12751272
{

0 commit comments

Comments
 (0)