Skip to content

Commit 4d3072a

Browse files
committed
Add validate options method
1 parent 0a21465 commit 4d3072a

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

src/goto-harness/function_call_harness_generator.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,11 @@ void function_call_harness_generatort::generate(
124124
function_found->mode);
125125
body.add(goto_programt::make_end_function());
126126
}
127+
128+
void function_call_harness_generatort::validate_options()
129+
{
130+
if(p_impl->function == ID_empty)
131+
throw invalid_command_line_argument_exceptiont{
132+
"required parameter entry function not set",
133+
"--" FUNCTION_HARNESS_GENERATOR_FUNCTION_OPT};
134+
}

src/goto-harness/function_call_harness_generator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ class function_call_harness_generatort : public goto_harness_generatort
3131
void
3232
handle_option(const std::string &option, const std::string &value) override;
3333

34+
void validate_options() override;
35+
3436
private:
3537
struct implt;
3638
std::unique_ptr<implt> p_impl;

src/goto-harness/goto_harness_generator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class goto_harness_generatort
2929
/// immediately performing work
3030
virtual void
3131
handle_option(const std::string &option, const std::string &value) = 0;
32+
33+
/// Check if options are in a sane state, throw otherwise
34+
virtual void validate_options() = 0;
3235
};
3336

3437
#endif // CPROVER_GOTO_HARNESS_GOTO_HARNESS_GENERATOR_H

src/goto-harness/goto_harness_generator_factory.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ goto_harness_generator_factoryt::factory(
4242
{
4343
generator->handle_option(option.first, option.second);
4444
}
45+
generator->validate_options();
46+
4547
return generator;
4648
}
4749
else

0 commit comments

Comments
 (0)