@@ -30,7 +30,8 @@ Author: Daniel Kroening
3030void convert (
3131 const namespacet &ns,
3232 const goto_tracet &goto_trace,
33- jsont &dest)
33+ jsont &dest,
34+ trace_optionst trace_options)
3435{
3536 json_arrayt &dest_array=dest.make_array ();
3637
@@ -96,36 +97,39 @@ void convert(
9697 " full_lhs in assignment must not be nil" );
9798 exprt simplified=simplify_expr (step.full_lhs , ns);
9899
99- class comment_base_name_visitort : public expr_visitort
100+ if (trace_options. json_full_lhs )
100101 {
101- private:
102- const namespacet &ns;
103-
104- public:
105- explicit comment_base_name_visitort (const namespacet &ns) : ns(ns)
102+ class comment_base_name_visitort : public expr_visitort
106103 {
107- }
104+ private:
105+ const namespacet &ns;
108106
109- void operator ()(exprt &expr) override
110- {
111- if (expr.id () == ID_symbol)
107+ public:
108+ explicit comment_base_name_visitort (const namespacet &ns) : ns(ns)
109+ {
110+ }
111+
112+ void operator ()(exprt &expr) override
112113 {
113- const symbolt &symbol = ns.lookup (expr.get (ID_identifier));
114- // Don't break sharing unless need to write to it
115- const irept::named_subt &comments =
116- static_cast <const exprt &>(expr).get_comments ();
117- if (comments.count (ID_C_base_name) != 0 )
118- INVARIANT (
119- comments.at (ID_C_base_name).id () == symbol.base_name ,
120- " base_name comment does not match symbol's base_name" );
121- else
122- expr.get_comments ().emplace (
123- ID_C_base_name, irept (symbol.base_name ));
114+ if (expr.id () == ID_symbol)
115+ {
116+ const symbolt &symbol = ns.lookup (expr.get (ID_identifier));
117+ // Don't break sharing unless need to write to it
118+ const irept::named_subt &comments =
119+ static_cast <const exprt &>(expr).get_comments ();
120+ if (comments.count (ID_C_base_name) != 0 )
121+ INVARIANT (
122+ comments.at (ID_C_base_name).id () == symbol.base_name ,
123+ " base_name comment does not match symbol's base_name" );
124+ else
125+ expr.get_comments ().emplace (
126+ ID_C_base_name, irept (symbol.base_name ));
127+ }
124128 }
125- }
126- } ;
127- comment_base_name_visitort comment_base_name_visitor (ns );
128- simplified. visit (comment_base_name_visitor);
129+ };
130+ comment_base_name_visitort comment_base_name_visitor (ns) ;
131+ simplified. visit (comment_base_name_visitor );
132+ }
129133
130134 full_lhs_string=from_expr (ns, identifier, simplified);
131135
@@ -154,9 +158,12 @@ void convert(
154158
155159 json_assignment[" value" ]=full_lhs_value;
156160 json_assignment[" lhs" ]=json_stringt (full_lhs_string);
157- // Not language specific, still mangled, fully-qualified name of lhs:
158- json_assignment[" rawLhs" ] =
159- json_irept (true ).convert_from_irep (simplified);
161+ if (trace_options.json_full_lhs )
162+ {
163+ // Not language specific, still mangled, fully-qualified name of lhs
164+ json_assignment[" rawLhs" ] =
165+ json_irept (true ).convert_from_irep (simplified);
166+ }
160167 json_assignment[" hidden" ]=jsont::json_boolean (step.hidden );
161168 json_assignment[" internal" ]=jsont::json_boolean (step.internal );
162169 json_assignment[" thread" ]=json_numbert (std::to_string (step.thread_nr ));
0 commit comments