Skip to content

Commit a1eeb59

Browse files
committed
Move nil check to top of function
So that the filtering is done first and we avoid building temporaries which aren't going to be used.
1 parent 9827dc9 commit a1eeb59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/goto-programs/xml_goto_trace.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ xmlt full_lhs_value(const goto_trace_stept &step, const namespacet &ns)
2929
{
3030
xmlt value_xml{"full_lhs_value"};
3131

32-
const auto &lhs_object = step.get_lhs_object();
33-
const irep_idt identifier =
34-
lhs_object.has_value() ? lhs_object->get_identifier() : irep_idt();
35-
3632
const exprt &value = step.full_lhs_value;
3733
if(value.is_nil())
3834
return value_xml;
35+
36+
const auto &lhs_object = step.get_lhs_object();
37+
const irep_idt identifier =
38+
lhs_object.has_value() ? lhs_object->get_identifier() : irep_idt();
3939
value_xml.data = from_expr(ns, identifier, value);
4040

4141
const auto &bv_type = type_try_dynamic_cast<bitvector_typet>(value.type());

0 commit comments

Comments
 (0)