From 99ce20cc22fd924a97a473e877895cbcd14540c9 Mon Sep 17 00:00:00 2001 From: Daniel Kroening Date: Thu, 13 Oct 2022 11:18:54 +0100 Subject: [PATCH] deprecate source_locationt::get/set_function Following #2149, this deprecates source_locationt::get/set_function; the reason is given as a comment. --- src/util/source_location.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/util/source_location.h b/src/util/source_location.h index bb3d79cdc49..340644fef29 100644 --- a/src/util/source_location.h +++ b/src/util/source_location.h @@ -10,6 +10,7 @@ Author: Daniel Kroening, kroening@kroening.com #ifndef CPROVER_UTIL_SOURCE_LOCATION_H #define CPROVER_UTIL_SOURCE_LOCATION_H +#include "deprecate.h" #include "irep.h" #include "optional.h" @@ -52,6 +53,14 @@ class source_locationt:public irept return get(ID_column); } + // This method is problematic for the following reasons: + // 1) There is ambiguity whether + // the returned string is an identifier or human-readable. + // 2) Furthermore, the linker renames functions, and is unable + // to adjust all source locations. + // 3) The name of the function is not strictly a source location. + // It will be removed. + DEPRECATED(SINCE(2022, 10, 13, "use identifier of containing function")) const irep_idt &get_function() const { return get(ID_function); @@ -117,6 +126,7 @@ class source_locationt:public irept set(ID_column, column); } + DEPRECATED(SINCE(2022, 10, 13, "use identifier of containing function")) void set_function(const irep_idt &function) { set(ID_function, function);