@@ -151,6 +151,19 @@ require_goto_statements::pointer_assignment_locationt
151
151
require_goto_statements::find_pointer_assignments (
152
152
const irep_idt &pointer_name,
153
153
const std::vector<codet> &instructions)
154
+ {
155
+ INFO (" Looking for symbol: " << pointer_name);
156
+ std::regex special_chars{R"( [-[\]{}()*+?.,\^$|#\s])" };
157
+ std::string sanitized =
158
+ std::regex_replace (id2string (pointer_name), special_chars, R"( \$&)" );
159
+ return find_pointer_assignments (
160
+ std::regex (" ^" + sanitized + " $" ), instructions);
161
+ }
162
+
163
+ require_goto_statements::pointer_assignment_locationt
164
+ require_goto_statements::find_pointer_assignments (
165
+ const std::regex &pointer_name_match,
166
+ const std::vector<codet> &instructions)
154
167
{
155
168
pointer_assignment_locationt locations;
156
169
bool found_assignment = false ;
@@ -164,7 +177,9 @@ require_goto_statements::find_pointer_assignments(
164
177
{
165
178
const symbol_exprt &symbol_expr = to_symbol_expr (code_assign.lhs ());
166
179
all_symbols.push_back (symbol_expr.get_identifier ());
167
- if (symbol_expr.get_identifier () == pointer_name)
180
+ if (
181
+ std::regex_search (
182
+ id2string (symbol_expr.get_identifier ()), pointer_name_match))
168
183
{
169
184
if (
170
185
code_assign.rhs () ==
@@ -181,7 +196,7 @@ require_goto_statements::find_pointer_assignments(
181
196
}
182
197
}
183
198
}
184
- INFO ( " Looking for symbol: " << pointer_name);
199
+
185
200
std::ostringstream found_symbols;
186
201
for (const auto entry : all_symbols)
187
202
{
0 commit comments