20 static std::optional<std::string>
24 if(abstract_state->is_top())
27 if(loc->source_location().get_line().empty())
30 return loc->source_location().full_path();
34 static std::set<std::string>
37 std::set<std::string> files;
45 files.insert(file.value());
54 const std::string &src,
55 const std::string &indent_line,
58 const std::size_t p = indent_line.find_first_not_of(
" \t");
59 const std::string indent =
60 p == std::string::npos ? std::string() : std::string(indent_line, 0, p);
61 std::istringstream in(src);
63 while(std::getline(in, src_line))
64 out << indent << src_line <<
'\n';
69 const std::string &source_file,
80 message.
warning() <<
"Failed to open '" << source_file <<
"'"
85 std::map<std::size_t, ai_baset::locationt> line_map;
94 if(file.has_value() && file.value() == source_file)
96 const std::size_t line_no =
97 stoull(
id2string(i_it->source_location().get_line()));
98 if(line_map.find(line_no) == line_map.end())
99 line_map[line_no] = i_it;
108 for(std::size_t line_no = 1; std::getline(in, line); line_no++)
110 const auto map_it = line_map.find(line_no);
111 if(map_it != line_map.end())
114 std::ostringstream state_str;
115 abstract_state->output(state_str, ai, ns);
116 if(!state_str.str().empty())
138 for(
const auto &source_file : source_files)
This is the basic interface of the abstract interpreter with default implementations of the core func...
goto_programt::const_targett locationt
virtual cstate_ptrt abstract_state_before(locationt l) const
Get a copy of the abstract state before the given instruction, without needing to know what kind of d...
function_mapt function_map
symbol_tablet symbol_table
Symbol table.
goto_functionst goto_functions
GOTO functions.
Class that provides messages with a built-in verbosity 'level'.
mstreamt & warning() const
static const commandt reset
return to default formatting, as defined by the terminal
mstreamt & result() const
static const commandt blue
render text with blue foreground color
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
#define forall_goto_program_instructions(it, program)
const std::string & id2string(const irep_idt &d)
void show_on_source(const std::string &source_file, const goto_modelt &goto_model, const ai_baset &ai, message_handlert &message_handler)
output source code annotated with abstract states for given file
static std::optional< std::string > show_location(const ai_baset &ai, ai_baset::locationt loc)
get the name of the file referred to at a location loc, if any
static void print_with_indent(const std::string &src, const std::string &indent_line, std::ostream &out)
print a string with indent to match given sample line
static std::set< std::string > get_source_files(const goto_modelt &goto_model, const ai_baset &ai)
get the source files with non-top abstract states
#define widen_if_needed(s)