File tree 6 files changed +31
-10
lines changed 6 files changed +31
-10
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ void java_bytecode_languaget::initialize_class_loader()
318
318
319
319
static void throwMainClassLoadingError (const std::string &main_class)
320
320
{
321
- throw invalid_source_file_exceptiont (
321
+ throw system_exceptiont (
322
322
" Error: Could not find or load main class " + main_class);
323
323
}
324
324
@@ -392,8 +392,7 @@ bool java_bytecode_languaget::parse(
392
392
std::ifstream jar_file (path);
393
393
if (!jar_file.good ())
394
394
{
395
- throw invalid_source_file_exceptiont (
396
- " Error: Unable to access jarfile " + path);
395
+ throw system_exceptiont (" Error: Unable to access jarfile " + path);
397
396
}
398
397
399
398
// build an object to potentially limit which classes are loaded
Original file line number Diff line number Diff line change @@ -152,14 +152,14 @@ void lazy_goto_modelt::initialize(
152
152
153
153
if (dynamic_cast <java_bytecode_languaget &>(language).parse ())
154
154
{
155
- throw invalid_source_file_exceptiont (" PARSING ERROR" );
155
+ throw invalid_input_exceptiont (" PARSING ERROR" );
156
156
}
157
157
158
158
msg.status () << " Converting" << messaget::eom;
159
159
160
160
if (language_files.typecheck (symbol_table))
161
161
{
162
- throw invalid_source_file_exceptiont (" CONVERSION ERROR" );
162
+ throw invalid_input_exceptiont (" CONVERSION ERROR" );
163
163
}
164
164
}
165
165
else
Original file line number Diff line number Diff line change @@ -339,7 +339,7 @@ exprt gdb_value_extractort::get_pointer_to_function_value(
339
339
const auto function_symbol = symbol_table.lookup (function_name);
340
340
if (function_symbol == nullptr )
341
341
{
342
- throw invalid_source_file_exceptiont {
342
+ throw invalid_input_exceptiont {
343
343
" input source code does not contain function: " + function_name};
344
344
}
345
345
CHECK_RETURN (function_symbol->type .id () == ID_code);
Original file line number Diff line number Diff line change @@ -95,6 +95,16 @@ std::string analysis_exceptiont::what() const
95
95
return reason;
96
96
}
97
97
98
+ invalid_input_exceptiont::invalid_input_exceptiont (std::string reason)
99
+ : m_reason(std::move(reason))
100
+ {
101
+ }
102
+
103
+ std::string invalid_input_exceptiont::what () const
104
+ {
105
+ return m_reason;
106
+ }
107
+
98
108
invalid_source_file_exceptiont::invalid_source_file_exceptiont (
99
109
std::string reason)
100
110
: reason(std::move(reason))
Original file line number Diff line number Diff line change @@ -164,6 +164,19 @@ class analysis_exceptiont : public cprover_exception_baset
164
164
std::string reason;
165
165
};
166
166
167
+ // / Thrown when user-provided input cannot be processed. Use
168
+ // / \ref invalid_source_file_exceptiont when the precise location of erroneous
169
+ // / input is known.
170
+ class invalid_input_exceptiont : public cprover_exception_baset
171
+ {
172
+ public:
173
+ explicit invalid_input_exceptiont (std::string reason);
174
+ std::string what () const override ;
175
+
176
+ protected:
177
+ std::string m_reason;
178
+ };
179
+
167
180
// / Thrown when we can't handle something in an input source file.
168
181
// / For example, if we get C source code that is not syntactically valid
169
182
// / or that has type errors.
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ goto_modelt get_goto_model_from_c(std::istream &in)
58
58
const bool error = language.parse (in, " " );
59
59
60
60
if (error)
61
- throw invalid_source_file_exceptiont (" parsing failed" );
61
+ throw invalid_input_exceptiont (" parsing failed" );
62
62
}
63
63
64
64
language_file.get_modules ();
@@ -69,16 +69,15 @@ goto_modelt get_goto_model_from_c(std::istream &in)
69
69
const bool error = language_files.typecheck (goto_model.symbol_table );
70
70
71
71
if (error)
72
- throw invalid_source_file_exceptiont (" typechecking failed" );
72
+ throw invalid_input_exceptiont (" typechecking failed" );
73
73
}
74
74
75
75
{
76
76
const bool error =
77
77
language_files.generate_support_functions (goto_model.symbol_table );
78
78
79
79
if (error)
80
- throw invalid_source_file_exceptiont (
81
- " support function generation failed" );
80
+ throw invalid_input_exceptiont (" support function generation failed" );
82
81
}
83
82
84
83
goto_convert (
You can’t perform that action at this time.
0 commit comments