cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
goto_trace_storage.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Goto Trace Storage
4
5
Author: Daniel Kroening, Peter Schrammel
6
7
\*******************************************************************/
8
11
12
#include "
goto_trace_storage.h
"
13
14
goto_trace_storaget::goto_trace_storaget
(
const
namespacet
&
ns
) :
ns
(
ns
)
15
{
16
}
17
18
const
goto_tracet
&
goto_trace_storaget::insert
(
goto_tracet
&&trace)
19
{
20
traces
.push_back(std::move(trace));
21
const
auto
&last_step =
traces
.back().get_last_step();
22
DATA_INVARIANT
(
23
last_step.is_assert(),
"last goto trace step expected to be assertion"
);
24
const
auto
emplace_result =
property_id_to_trace_index
.emplace(
25
last_step.property_id,
traces
.size() - 1);
26
INVARIANT
(
27
emplace_result.second,
28
"cannot associate more than one error trace with property "
+
29
id2string
(last_step.property_id));
30
31
for
(
auto
&step :
traces
.back().steps)
32
step.merge_ireps(
merge_ireps
);
33
34
return
traces
.back();
35
}
36
37
const
goto_tracet
&
goto_trace_storaget::insert_all
(
goto_tracet
&&trace)
38
{
39
traces
.push_back(std::move(trace));
40
const
auto
&all_property_ids =
traces
.back().get_failed_property_ids();
41
DATA_INVARIANT
(
42
!all_property_ids.empty(),
"a trace must violate at least one assertion"
);
43
for
(
const
auto
&property_id : all_property_ids)
44
{
45
property_id_to_trace_index
.emplace(property_id,
traces
.size() - 1);
46
}
47
48
for
(
auto
&step :
traces
.back().steps)
49
step.merge_ireps(
merge_ireps
);
50
51
return
traces
.back();
52
}
53
54
const
std::list<goto_tracet> &
goto_trace_storaget::all
()
const
55
{
56
return
traces
;
57
}
58
59
const
goto_tracet
&
goto_trace_storaget::
60
operator[]
(
const
irep_idt
&property_id)
const
61
{
62
const
auto
trace_found =
property_id_to_trace_index
.find(property_id);
63
PRECONDITION
(trace_found !=
property_id_to_trace_index
.end());
64
CHECK_RETURN
(trace_found->second <
traces
.size());
65
66
return
*(std::next(
traces
.begin(), trace_found->second));
67
}
68
69
const
namespacet
&
goto_trace_storaget::get_namespace
()
const
70
{
71
return
ns
;
72
}
goto_trace_storaget::insert
const goto_tracet & insert(goto_tracet &&)
Store trace that ends in a violated assertion.
Definition
goto_trace_storage.cpp:18
goto_trace_storaget::merge_ireps
merge_irept merge_ireps
irep container for shared ireps
Definition
goto_trace_storage.h:51
goto_trace_storaget::ns
const namespacet & ns
the namespace related to the traces
Definition
goto_trace_storage.h:42
goto_trace_storaget::insert_all
const goto_tracet & insert_all(goto_tracet &&)
Store trace that contains multiple violated assertions.
Definition
goto_trace_storage.cpp:37
goto_trace_storaget::property_id_to_trace_index
std::unordered_map< irep_idt, std::size_t > property_id_to_trace_index
Definition
goto_trace_storage.h:48
goto_trace_storaget::operator[]
const goto_tracet & operator[](const irep_idt &property_id) const
Definition
goto_trace_storage.cpp:60
goto_trace_storaget::get_namespace
const namespacet & get_namespace() const
Definition
goto_trace_storage.cpp:69
goto_trace_storaget::all
const std::list< goto_tracet > & all() const
Definition
goto_trace_storage.cpp:54
goto_trace_storaget::traces
std::list< goto_tracet > traces
stores the traces
Definition
goto_trace_storage.h:45
goto_trace_storaget::goto_trace_storaget
goto_trace_storaget(const namespacet &)
Definition
goto_trace_storage.cpp:14
goto_tracet
Trace of a GOTO program.
Definition
goto_trace.h:177
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
goto_trace_storage.h
Goto Trace Storage.
id2string
const std::string & id2string(const irep_idt &d)
Definition
irep.h:44
CHECK_RETURN
#define CHECK_RETURN(CONDITION)
Definition
invariant.h:495
DATA_INVARIANT
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
Definition
invariant.h:534
PRECONDITION
#define PRECONDITION(CONDITION)
Definition
invariant.h:463
INVARIANT
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition
invariant.h:423
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-checker
goto_trace_storage.cpp
Generated by
1.17.0