10 #ifndef CPROVER_UTIL_SOURCE_LOCATION_H
11 #define CPROVER_UTIL_SOURCE_LOCATION_H
43 return get(ID_working_directory);
53 return get(ID_column);
63 DEPRECATED(
SINCE(2022, 10, 13,
"use identifier of containing function"))
66 return get(ID_function);
71 return get(ID_property_id);
76 return get(ID_property_class);
81 return get(ID_comment);
86 return get(ID_switch_case_number);
91 return get(ID_java_bytecode_index);
96 return find(ID_basic_block_source_lines);
111 set(ID_working_directory, cwd);
126 set(ID_column, column);
131 set(ID_column, column);
134 DEPRECATED(
SINCE(2022, 10, 13,
"use identifier of containing function"))
137 set(ID_function,
function);
142 set(ID_property_id, property_id);
147 set(ID_property_class, property_class);
158 set(ID_switch_case_number, number);
163 set(ID_java_bytecode_index, index);
168 add(ID_basic_block_source_lines, std::move(source_lines));
174 set(ID_property_fatal,
true);
176 remove(ID_property_fatal);
205 std::optional<std::string>
full_path()
const;
209 add(ID_pragma).
add(pragma);
218 std::string
as_string(
bool print_cwd)
const;
229 return "source location: " + source_location.
as_string();
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
There are a large number of kinds of tree structured or tree-like data in CPROVER.
bool get_bool(const irep_idt &name) const
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
named_subt & get_named_sub()
void remove(const irep_idt &name)
void set(const irep_idt &name, const irep_idt &value)
irept & add(const irep_idt &name)
typename dt::named_subt named_subt
void merge(const source_locationt &from)
Set all unset source-location fields in this object to their values in 'from'.
const irep_idt & get_function() const
const irep_idt & get_working_directory() const
void set_column(const irep_idt &column)
void property_fatal(bool _property_fatal)
void set_comment(const irep_idt &comment)
const irep_idt & get_column() const
void set_property_id(const irep_idt &property_id)
bool property_fatal() const
void set_basic_block_source_lines(irept source_lines)
void set_line(unsigned line)
void set_working_directory(const irep_idt &cwd)
const irep_idt & get_property_id() const
static const source_locationt & nil()
const irep_idt & get_java_bytecode_index() const
const irep_idt & get_comment() const
void set_property_class(const irep_idt &property_class)
const irept::named_subt & get_pragmas() const
const irep_idt & get_property_class() const
void set_case_number(const irep_idt &number)
void set_java_bytecode_index(const irep_idt &index)
const irep_idt & get_line() const
const irep_idt & get_case_number() const
const irep_idt & get_file() const
void add_pragma(const irep_idt &pragma)
std::string as_string() const
std::string as_string_with_cwd() const
void set_column(unsigned column)
void set_file(const irep_idt &file)
void set_line(const irep_idt &line)
std::optional< std::string > full_path() const
Get a path to the file, including working directory.
const irept & get_basic_block_source_lines() const
void set_function(const irep_idt &function)
#define SINCE(year, month, day, msg)
const irept & get_nil_irep()
const std::string & id2string(const irep_idt &d)
static std::string comment(const rw_set_baset::entryt &entry, bool write)
std::ostream & operator<<(std::ostream &, const source_locationt &)
static std::string diagnostics_as_string(const source_locationt &source_location)
Helper to give us some diagnostic in a usable form on assertion failure.