CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
verification_result.cpp
Go to the documentation of this file.
1// Copyright (c) 2023 Fotis Koutoulakis for Diffblue Ltd.
2
5// in a structured form.
6
8
9#include <util/exit_codes.h>
10#include <util/invariant.h>
11
13
14#include <algorithm>
15#include <string>
16#include <vector>
17
34
35// Impl
36
42
44 resultt &result)
45{
46 _verifier_result = result;
47}
48
53
54const propertiest &
59
60// Verification_result
61
66
70
75
80{
81 *_impl = *other._impl;
82 return *this;
83}
84
86{
87 _impl->set_properties(properties);
88}
89
91{
92 _impl->set_result(result);
93}
94
96{
97 switch(_impl->get_result())
98 {
99 case resultt::ERROR:
101 case resultt::FAIL:
103 case resultt::PASS:
105 case resultt::UNKNOWN:
107 }
108 // Required to silence compiler warnings that are promoted as errors!
110}
111
112std::vector<std::string> verification_resultt::get_property_ids() const
113{
114 std::vector<std::string> result;
115 for(const auto &props : _impl->get_properties())
116 {
117 result.push_back(id2string(props.first));
118 }
119 return result;
120}
121
123 const std::string &property_id) const
124{
125 auto irepidt_property = irep_idt(property_id);
126 const auto description =
127 _impl->get_properties().at(irepidt_property).description;
128 return description;
129}
130
132verification_resultt::get_property_status(const std::string &property_id) const
133{
134 auto irepidt_property = irep_idt(property_id);
135 switch(_impl->get_properties().at(irepidt_property).status)
136 {
138 return prop_statust::ERROR;
140 return prop_statust::FAIL;
146 return prop_statust::PASS;
149 }
151}
152
153// FOTIS' note: Modelled after `result_to_exit_code` in
154// `src/goto-checker/properties.cpp`.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
verification_result_implt(const verification_result_implt &other)=default
Document and give macros for the exit codes of CPROVER binaries.
#define CPROVER_EXIT_INTERNAL_ERROR
An error has been encountered during processing the requested analysis.
Definition exit_codes.h:45
#define CPROVER_EXIT_VERIFICATION_SAFE
Verification successful indicates the analysis has been performed without error AND the software is s...
Definition exit_codes.h:21
#define CPROVER_EXIT_VERIFICATION_INCONCLUSIVE
Verification inconclusive indicates the analysis has been performed without error AND the software is...
Definition exit_codes.h:30
#define CPROVER_EXIT_VERIFICATION_UNSAFE
Verification successful indicates the analysis has been performed without error AND the software is n...
Definition exit_codes.h:25
const std::string & id2string(const irep_idt &d)
Definition irep.h:44
STL namespace.
Properties.
@ UNKNOWN
The checker was unable to determine the status of the property.
@ NOT_REACHABLE
The property was proven to be unreachable.
@ PASS
The property was not violated.
@ ERROR
An error occurred during goto checking.
@ FAIL
The property was violated.
@ NOT_CHECKED
The property was not checked (also used for initialization)
resultt
The result of goto verifying.
Definition properties.h:45
@ UNKNOWN
No property was violated, neither was there an error.
@ PASS
No properties were violated.
@ ERROR
An error occurred during goto checking.
@ FAIL
Some properties were violated.
#define UNREACHABLE
This should be used to mark dead code.
Definition invariant.h:525
verification_resultt & operator=(verification_resultt &&)
std::vector< std::string > get_property_ids() const
void set_result(resultt &result)
std::unique_ptr< verification_result_implt > _impl
std::string get_property_description(const std::string &property_id) const
void set_properties(propertiest &properties)
prop_statust get_property_status(const std::string &property_id) const
verifier_resultt final_result() const
int verifier_result_to_exit_code(verifier_resultt result)
Interface for the various verification engines providing results.
dstringt irep_idt
verifier_resultt
@ PASS
No properties were violated.
@ ERROR
An error occurred during goto checking.
@ FAIL
Some properties were violated.
@ UNKNOWN
The checker was unable to determine the status of the property.
@ NOT_REACHABLE
The property was proven to be unreachable.
@ PASS
The property was not violated.
@ ERROR
An error occurred during goto checking.
@ FAIL
The property was violated.
@ NOT_CHECKED
The property was not checked (also used for initialization)
std::map< irep_idt, property_infot > propertiest