From 216e74e6e81259afe6c76b7480d5ec88e4d15988 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Thu, 3 Feb 2022 16:47:37 +0000 Subject: [PATCH] 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. --- src/cpp/cpp_name.h | 2 +- src/goto-programs/goto_program.h | 2 +- src/util/expr.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/cpp_name.h b/src/cpp/cpp_name.h index d797efb006d..6d6e7cb5931 100644 --- a/src/cpp/cpp_name.h +++ b/src/cpp/cpp_name.h @@ -73,7 +73,7 @@ class cpp_namet:public irept const source_locationt &source_location() const { if(get_sub().empty()) - return static_cast(get_nil_irep()); + return source_locationt::nil(); else return static_cast( get_sub().front().find(ID_C_source_location)); diff --git a/src/goto-programs/goto_program.h b/src/goto-programs/goto_program.h index d9043e87c15..87be6590b5a 100644 --- a/src/goto-programs/goto_program.h +++ b/src/goto-programs/goto_program.h @@ -497,7 +497,7 @@ class goto_programt explicit instructiont(goto_program_instruction_typet __type) : code(static_cast(get_nil_irep())), - _source_location(static_cast(get_nil_irep())), + _source_location(source_locationt::nil()), _type(__type), guard(true_exprt()) { diff --git a/src/util/expr.cpp b/src/util/expr.cpp index 6bb976a6fdc..a817c4e635a 100644 --- a/src/util/expr.cpp +++ b/src/util/expr.cpp @@ -176,7 +176,7 @@ const source_locationt &exprt::find_source_location() const return op_l; } - return static_cast(get_nil_irep()); + return source_locationt::nil(); } template