@@ -127,7 +127,7 @@ class goto_program_templatet
127
127
128
128
// ! is this node a branch target?
129
129
inline bool is_target () const
130
- { return target_number!=std::numeric_limits< unsigned >:: max () ; }
130
+ { return target_number!=nil_target ; }
131
131
132
132
// ! clear the node
133
133
inline void clear (goto_program_instruction_typet _type)
@@ -189,7 +189,7 @@ class goto_program_templatet
189
189
type(NO_INSTRUCTION_TYPE),
190
190
guard(true_exprt()),
191
191
location_number(0 ),
192
- target_number(std::numeric_limits< unsigned >::max() )
192
+ target_number(nil_target )
193
193
{
194
194
}
195
195
@@ -198,7 +198,7 @@ class goto_program_templatet
198
198
type(_type),
199
199
guard(true_exprt()),
200
200
location_number(0 ),
201
- target_number(std::numeric_limits< unsigned >::max() )
201
+ target_number(nil_target )
202
202
{
203
203
}
204
204
@@ -213,6 +213,10 @@ class goto_program_templatet
213
213
instruction.function .swap (function);
214
214
}
215
215
216
+ // ! Uniquely identify an invalid target or location
217
+ static const unsigned nil_target=
218
+ std::numeric_limits<unsigned >::max();
219
+
216
220
// ! A globally unique number to identify a program location.
217
221
// ! It's guaranteed to be ordered in program order within
218
222
// ! one goto_program.
@@ -222,7 +226,7 @@ class goto_program_templatet
222
226
unsigned loop_number;
223
227
224
228
// ! A number to identify branch targets.
225
- // ! This is -1 if it's not a target.
229
+ // ! This is \ref nil_target if it's not a target.
226
230
unsigned target_number;
227
231
228
232
// ! Returns true if the instruction is a backwards branch.
@@ -577,7 +581,7 @@ void goto_program_templatet<codeT, guardT>::compute_target_numbers()
577
581
// reset marking
578
582
579
583
for (auto & i : instructions)
580
- i.target_number =- 1 ;
584
+ i.target_number =instructiont::nil_target ;
581
585
582
586
// mark the goto targets
583
587
@@ -612,7 +616,7 @@ void goto_program_templatet<codeT, guardT>::compute_target_numbers()
612
616
if (t!=instructions.end ())
613
617
{
614
618
assert (t->target_number !=0 );
615
- assert (t->target_number !=std::numeric_limits< unsigned >:: max () );
619
+ assert (t->target_number !=instructiont::nil_target );
616
620
}
617
621
}
618
622
}
0 commit comments