Skip to content

Commit 216e74e

Browse files
committed
Use source_locationt::nil() instead of local static_cast
Cleanup, no change in behaviour: just use the existing (and previously already used in multiple places) static nil() member of source_locationt instead of repeating its implementation in several places.
1 parent 3da0d96 commit 216e74e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/cpp/cpp_name.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class cpp_namet:public irept
7373
const source_locationt &source_location() const
7474
{
7575
if(get_sub().empty())
76-
return static_cast<const source_locationt &>(get_nil_irep());
76+
return source_locationt::nil();
7777
else
7878
return static_cast<const source_locationt &>(
7979
get_sub().front().find(ID_C_source_location));

src/goto-programs/goto_program.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class goto_programt
497497

498498
explicit instructiont(goto_program_instruction_typet __type)
499499
: code(static_cast<const codet &>(get_nil_irep())),
500-
_source_location(static_cast<const source_locationt &>(get_nil_irep())),
500+
_source_location(source_locationt::nil()),
501501
_type(__type),
502502
guard(true_exprt())
503503
{

src/util/expr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ const source_locationt &exprt::find_source_location() const
176176
return op_l;
177177
}
178178

179-
return static_cast<const source_locationt &>(get_nil_irep());
179+
return source_locationt::nil();
180180
}
181181

182182
template <typename T>

0 commit comments

Comments
 (0)