@@ -127,7 +127,7 @@ class goto_program_templatet
127127
128128 // ! is this node a branch target?
129129 inline bool is_target () const
130- { return target_number!=std::numeric_limits< unsigned >:: max () ; }
130+ { return target_number!=nil_target ; }
131131
132132 // ! clear the node
133133 inline void clear (goto_program_instruction_typet _type)
@@ -189,7 +189,7 @@ class goto_program_templatet
189189 type(NO_INSTRUCTION_TYPE),
190190 guard(true_exprt()),
191191 location_number(0 ),
192- target_number(std::numeric_limits< unsigned >::max() )
192+ target_number(nil_target )
193193 {
194194 }
195195
@@ -198,7 +198,7 @@ class goto_program_templatet
198198 type(_type),
199199 guard(true_exprt()),
200200 location_number(0 ),
201- target_number(std::numeric_limits< unsigned >::max() )
201+ target_number(nil_target )
202202 {
203203 }
204204
@@ -213,6 +213,10 @@ class goto_program_templatet
213213 instruction.function .swap (function);
214214 }
215215
216+ // ! Uniquely identify an invalid target or location
217+ static const unsigned nil_target=
218+ std::numeric_limits<unsigned >::max();
219+
216220 // ! A globally unique number to identify a program location.
217221 // ! It's guaranteed to be ordered in program order within
218222 // ! one goto_program.
@@ -222,7 +226,7 @@ class goto_program_templatet
222226 unsigned loop_number;
223227
224228 // ! 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.
226230 unsigned target_number;
227231
228232 // ! Returns true if the instruction is a backwards branch.
@@ -577,7 +581,7 @@ void goto_program_templatet<codeT, guardT>::compute_target_numbers()
577581 // reset marking
578582
579583 for (auto & i : instructions)
580- i.target_number =- 1 ;
584+ i.target_number =instructiont::nil_target ;
581585
582586 // mark the goto targets
583587
@@ -612,7 +616,7 @@ void goto_program_templatet<codeT, guardT>::compute_target_numbers()
612616 if (t!=instructions.end ())
613617 {
614618 assert (t->target_number !=0 );
615- assert (t->target_number !=std::numeric_limits< unsigned >:: max () );
619+ assert (t->target_number !=instructiont::nil_target );
616620 }
617621 }
618622 }
0 commit comments