File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,22 @@ class exprt:public irept
9797 const operandst &operands () const
9898 { return (const operandst &)get_sub (); }
9999
100+ // / Add the source location from \p location, if it is non-nil.
101+ exprt &with_source_location (source_locationt location) &
102+ {
103+ if (location.is_not_nil ())
104+ add_source_location () = std::move (location);
105+ return *this ;
106+ }
107+
108+ // / Add the source location from \p location, if it is non-nil.
109+ exprt &&with_source_location(source_locationt location) &&
110+ {
111+ if (location.is_not_nil ())
112+ add_source_location () = std::move (location);
113+ return std::move (*this );
114+ }
115+
100116 // / Add the source location from \p other, if it has any.
101117 exprt &with_source_location (const exprt &other) &
102118 {
Original file line number Diff line number Diff line change @@ -161,6 +161,38 @@ class symbol_exprt : public nullary_exprt
161161 {
162162 return get (ID_identifier);
163163 }
164+
165+ // / Add the source location from \p location, if it is non-nil.
166+ symbol_exprt &with_source_location (source_locationt location) &
167+ {
168+ if (location.is_not_nil ())
169+ add_source_location () = std::move (location);
170+ return *this ;
171+ }
172+
173+ // / Add the source location from \p location, if it is non-nil.
174+ symbol_exprt &&with_source_location(source_locationt location) &&
175+ {
176+ if (location.is_not_nil ())
177+ add_source_location () = std::move (location);
178+ return std::move (*this );
179+ }
180+
181+ // / Add the source location from \p other, if it has any.
182+ symbol_exprt &with_source_location (const exprt &other) &
183+ {
184+ if (other.source_location ().is_not_nil ())
185+ add_source_location () = other.source_location ();
186+ return *this ;
187+ }
188+
189+ // / Add the source location from \p other, if it has any.
190+ symbol_exprt &&with_source_location(const exprt &other) &&
191+ {
192+ if (other.source_location ().is_not_nil ())
193+ add_source_location () = other.source_location ();
194+ return std::move (*this );
195+ }
164196};
165197
166198// NOLINTNEXTLINE(readability/namespace)
You can’t perform that action at this time.
0 commit comments