Skip to content

Commit ba15087

Browse files
committed
flag_resett: use source_locationt, no need for full instruction
There isn't any use of fields other than the instruction's source location, so take just that. Also use `as_string()` instead of `pretty()` for more nicely formatted error reporting.
1 parent 2668409 commit ba15087

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/analyses/goto_check_c.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ class goto_check_ct
350350
class flag_resett
351351
{
352352
public:
353-
explicit flag_resett(const goto_programt::instructiont &_instruction)
354-
: instruction(_instruction)
353+
explicit flag_resett(const source_locationt &source_location)
354+
: source_location(source_location)
355355
{
356356
}
357357

@@ -370,7 +370,7 @@ class flag_resett
370370
INVARIANT(
371371
flags_to_reset.find(&flag) == flags_to_reset.end(),
372372
"Flag " + id2string(flag_name) + " set twice at \n" +
373-
instruction.source_location().pretty());
373+
source_location.as_string());
374374
if(flag != new_value)
375375
{
376376
flags_to_reset[&flag] = flag;
@@ -387,7 +387,7 @@ class flag_resett
387387
INVARIANT(
388388
disabled_flags.find(&flag) == disabled_flags.end(),
389389
"Flag " + id2string(flag_name) + " disabled twice at \n" +
390-
instruction.source_location().pretty());
390+
source_location.as_string());
391391

392392
disabled_flags.insert(&flag);
393393

@@ -411,7 +411,7 @@ class flag_resett
411411
}
412412

413413
private:
414-
const goto_programt::instructiont &instruction;
414+
const source_locationt &source_location;
415415
std::map<bool *, bool> flags_to_reset;
416416
std::set<bool *> disabled_flags;
417417
};
@@ -2030,7 +2030,7 @@ void goto_check_ct::goto_check(
20302030
current_target = it;
20312031
goto_programt::instructiont &i = *it;
20322032

2033-
flag_resett resetter(i);
2033+
flag_resett resetter(i.source_location());
20342034
const auto &pragmas = i.source_location().get_pragmas();
20352035
for(const auto &d : pragmas)
20362036
{
@@ -2113,7 +2113,7 @@ void goto_check_ct::goto_check(
21132113
// Reset the no_enum_check with the flag reset for exception
21142114
// safety
21152115
{
2116-
flag_resett resetter(i);
2116+
flag_resett resetter(i.source_location());
21172117
resetter.set_flag(no_enum_check, true, "no_enum_check");
21182118
check(assign_lhs);
21192119
}

0 commit comments

Comments
 (0)