cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
exception_utils.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Exception helper utilities
4
5
Author: Fotis Koutoulakis, fotis.koutoulakis@diffblue.com
6
7
\*******************************************************************/
8
9
#ifndef CPROVER_UTIL_EXCEPTION_UTILS_H
10
#define CPROVER_UTIL_EXCEPTION_UTILS_H
11
12
#include <string>
13
14
#include "
invariant.h
"
15
#include "
source_location.h
"
16
24
class
cprover_exception_baset
25
{
26
public
:
30
virtual
std::string
what
()
const
;
31
virtual
~cprover_exception_baset
() =
default
;
32
33
protected
:
37
explicit
cprover_exception_baset
(std::string
reason
)
38
:
reason
(
std
::move(
reason
))
39
{
40
}
41
44
std::string
reason
;
45
};
46
50
class
invalid_command_line_argument_exceptiont
:
public
cprover_exception_baset
51
{
54
std::string
option
;
56
std::string
correct_input
;
57
58
public
:
59
invalid_command_line_argument_exceptiont
(
60
std::string
reason
,
61
std::string
option
,
62
std::string
correct_input
=
""
);
63
64
std::string
what
()
const override
;
65
};
66
71
class
system_exceptiont
:
public
cprover_exception_baset
72
{
73
public
:
74
explicit
system_exceptiont
(std::string message);
75
};
76
79
class
deserialization_exceptiont
:
public
cprover_exception_baset
80
{
81
public
:
82
explicit
deserialization_exceptiont
(std::string message);
83
};
84
91
class
incorrect_goto_program_exceptiont
:
public
cprover_exception_baset
92
{
93
public
:
94
explicit
incorrect_goto_program_exceptiont
(std::string message);
95
96
template
<
typename
Diagnostic,
typename
... Diagnostics>
97
incorrect_goto_program_exceptiont
(
98
std::string message,
99
Diagnostic &&diagnostic,
100
Diagnostics &&...
diagnostics
);
101
102
template
<
typename
... Diagnostics>
103
incorrect_goto_program_exceptiont
(
104
std::string message,
105
source_locationt
source_location
,
106
Diagnostics &&...
diagnostics
);
107
108
std::string
what
()
const override
;
109
110
private
:
111
source_locationt
source_location
;
112
113
std::string
diagnostics
;
114
};
115
116
template
<
typename
Diagnostic,
typename
... Diagnostics>
117
incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont
(
118
std::string message,
119
Diagnostic &&diagnostic,
120
Diagnostics &&...
diagnostics
)
121
:
cprover_exception_baset
(
std
::move(message)),
122
source_location
(
source_locationt
::nil()),
123
diagnostics
(
detail
::assemble_diagnostics(
124
std
::forward<Diagnostic>(diagnostic),
125
std
::forward<Diagnostics>(
diagnostics
)...))
126
{
127
}
128
129
template
<
typename
... Diagnostics>
130
incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont
(
131
std::string message,
132
source_locationt
source_location
,
133
Diagnostics &&...
diagnostics
)
134
:
cprover_exception_baset
(
std
::move(message)),
135
source_location
(
std
::move(
source_location
)),
136
diagnostics
(
137
detail
::assemble_diagnostics(
std
::forward<Diagnostics>(
diagnostics
)...))
138
{
139
}
140
144
class
unsupported_operation_exceptiont
:
public
cprover_exception_baset
145
{
146
public
:
148
explicit
unsupported_operation_exceptiont
(std::string message);
149
};
150
153
class
analysis_exceptiont
:
public
cprover_exception_baset
154
{
155
public
:
156
explicit
analysis_exceptiont
(std::string
reason
);
157
};
158
162
class
invalid_input_exceptiont
:
public
cprover_exception_baset
163
{
164
public
:
165
explicit
invalid_input_exceptiont
(std::string
reason
);
166
};
167
171
class
invalid_source_file_exceptiont
:
public
invalid_input_exceptiont
172
{
173
public
:
174
invalid_source_file_exceptiont
(
175
std::string
reason
,
176
source_locationt
source_location
);
177
std::string
what
()
const override
;
178
179
const
std::string &
get_reason
()
const
180
{
181
return
reason
;
182
}
183
184
const
source_locationt
&
get_source_location
()
const
185
{
186
return
source_location
;
187
}
188
189
private
:
190
source_locationt
source_location
;
191
};
192
193
#endif
// CPROVER_UTIL_EXCEPTION_UTILS_H
analysis_exceptiont::analysis_exceptiont
analysis_exceptiont(std::string reason)
Definition
exception_utils.cpp:78
cprover_exception_baset
Base class for exceptions thrown in the cprover project.
Definition
c_errors.h:64
cprover_exception_baset::what
virtual std::string what() const
A human readable description of what went wrong.
cprover_exception_baset::~cprover_exception_baset
virtual ~cprover_exception_baset()=default
cprover_exception_baset::cprover_exception_baset
cprover_exception_baset(std::string reason)
This constructor is marked protected to ensure this class isn't used directly.
Definition
exception_utils.h:37
cprover_exception_baset::reason
std::string reason
The reason this exception was generated.
Definition
c_errors.h:83
deserialization_exceptiont::deserialization_exceptiont
deserialization_exceptiont(std::string message)
Definition
exception_utils.cpp:47
incorrect_goto_program_exceptiont::source_location
source_locationt source_location
Definition
exception_utils.h:111
incorrect_goto_program_exceptiont::incorrect_goto_program_exceptiont
incorrect_goto_program_exceptiont(std::string message)
Definition
exception_utils.cpp:52
incorrect_goto_program_exceptiont::diagnostics
std::string diagnostics
Definition
exception_utils.h:113
incorrect_goto_program_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:59
invalid_command_line_argument_exceptiont::invalid_command_line_argument_exceptiont
invalid_command_line_argument_exceptiont(std::string reason, std::string option, std::string correct_input="")
Definition
exception_utils.cpp:32
invalid_command_line_argument_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:17
invalid_command_line_argument_exceptiont::correct_input
std::string correct_input
In case we have samples of correct input to the option.
Definition
exception_utils.h:56
invalid_command_line_argument_exceptiont::option
std::string option
The full command line option (not the argument) that got erroneous input.
Definition
exception_utils.h:54
invalid_input_exceptiont::invalid_input_exceptiont
invalid_input_exceptiont(std::string reason)
Definition
exception_utils.cpp:83
invalid_source_file_exceptiont::get_source_location
const source_locationt & get_source_location() const
Definition
exception_utils.h:184
invalid_source_file_exceptiont::what
std::string what() const override
A human readable description of what went wrong.
Definition
exception_utils.cpp:96
invalid_source_file_exceptiont::invalid_source_file_exceptiont
invalid_source_file_exceptiont(std::string reason, source_locationt source_location)
Definition
exception_utils.cpp:88
invalid_source_file_exceptiont::get_reason
const std::string & get_reason() const
Definition
exception_utils.h:179
invalid_source_file_exceptiont::source_location
source_locationt source_location
Definition
exception_utils.h:190
source_locationt
Definition
source_location.h:20
system_exceptiont::system_exceptiont
system_exceptiont(std::string message)
Definition
exception_utils.cpp:42
unsupported_operation_exceptiont::unsupported_operation_exceptiont
unsupported_operation_exceptiont(std::string message)
message is the unsupported operation causing this fault to occur.
Definition
exception_utils.cpp:72
detail
Definition
expr_cast.h:52
std
STL namespace.
source_location.h
invariant.h
util
exception_utils.h
Generated by
1.17.0