Skip to content

Commit b64757e

Browse files
author
Thomas Kiley
committed
Pull out function for producing the full_lhs_value
1 parent 9384b91 commit b64757e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/goto-programs/xml_goto_trace.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,19 @@ Author: Daniel Kroening
2323
#include "printf_formatter.h"
2424
#include "xml_expr.h"
2525

26+
xmlt full_lhs_value(const goto_trace_stept &step, const namespacet &ns)
27+
{
28+
xmlt full_lhs_value{"full_lhs_value"};
29+
30+
auto lhs_object = step.get_lhs_object();
31+
irep_idt identifier =
32+
lhs_object.has_value() ? lhs_object->get_identifier() : irep_idt();
33+
34+
if(step.full_lhs_value.is_not_nil())
35+
full_lhs_value.data = from_expr(ns, identifier, step.full_lhs_value);
36+
return full_lhs_value;
37+
}
38+
2639
void convert(
2740
const namespacet &ns,
2841
const goto_tracet &goto_trace,
@@ -88,16 +101,13 @@ void convert(
88101
}
89102
}
90103

91-
std::string full_lhs_string, full_lhs_value_string;
104+
std::string full_lhs_string;
92105

93106
if(step.full_lhs.is_not_nil())
94107
full_lhs_string = from_expr(ns, identifier, step.full_lhs);
95108

96-
if(step.full_lhs_value.is_not_nil())
97-
full_lhs_value_string = from_expr(ns, identifier, step.full_lhs_value);
98-
99109
xml_assignment.new_element("full_lhs").data = full_lhs_string;
100-
xml_assignment.new_element("full_lhs_value").data = full_lhs_value_string;
110+
xml_assignment.new_element(full_lhs_value(step, ns));
101111

102112
xml_assignment.set_attribute_bool("hidden", step.hidden);
103113
xml_assignment.set_attribute("thread", std::to_string(step.thread_nr));

0 commit comments

Comments
 (0)