File tree 1 file changed +32
-0
lines changed 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,38 @@ void convert(
95
95
step.full_lhs .is_not_nil (),
96
96
" full_lhs in assignment must not be nil" );
97
97
exprt simplified=simplify_expr (step.full_lhs , ns);
98
+
99
+ class comment_base_name_visitort : public expr_visitort
100
+ {
101
+ private:
102
+ const namespacet &ns;
103
+
104
+ public:
105
+ explicit comment_base_name_visitort (const namespacet &ns) : ns(ns)
106
+ {
107
+ }
108
+
109
+ void operator ()(exprt &expr) override
110
+ {
111
+ if (expr.id () == ID_symbol)
112
+ {
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 ));
124
+ }
125
+ }
126
+ };
127
+ comment_base_name_visitort comment_base_name_visitor (ns);
128
+ simplified.visit (comment_base_name_visitor);
129
+
98
130
full_lhs_string=from_expr (ns, identifier, simplified);
99
131
100
132
const symbolt *symbol;
You can’t perform that action at this time.
0 commit comments