@@ -50,11 +50,6 @@ int goto_harness_parse_optionst::doit()
50
50
51
51
auto factory_options = collect_generate_factory_options ();
52
52
53
- // Initialise harness generator
54
- auto harness_generator =
55
- factory.factory (got_harness_config.harness_type , factory_options);
56
- CHECK_RETURN (harness_generator != nullptr );
57
-
58
53
// This just sets up the defaults (and would interpret options such as --32).
59
54
config.set (cmdline);
60
55
@@ -67,8 +62,28 @@ int goto_harness_parse_optionst::doit()
67
62
got_harness_config.in_file + " '" };
68
63
}
69
64
auto goto_model = std::move (read_goto_binary_result.value ());
65
+
66
+ // This has to be called after the defaults are set up (as per the
67
+ // config.set(cmdline) above) otherwise, e.g. the architecture specification
68
+ // will be unknown.
70
69
config.set_from_symbol_table (goto_model.symbol_table );
71
70
71
+ if (goto_model.symbol_table .has_symbol (
72
+ got_harness_config.harness_function_name ))
73
+ {
74
+ throw invalid_command_line_argument_exceptiont (
75
+ " harness function `" +
76
+ id2string (got_harness_config.harness_function_name ) +
77
+ " ` already in "
78
+ " the symbol table" ,
79
+ " --" GOTO_HARNESS_GENERATOR_HARNESS_FUNCTION_NAME_OPT);
80
+ }
81
+
82
+ // Initialise harness generator
83
+ auto harness_generator = factory.factory (
84
+ got_harness_config.harness_type , factory_options, goto_model);
85
+ CHECK_RETURN (harness_generator != nullptr );
86
+
72
87
harness_generator->generate (
73
88
goto_model, got_harness_config.harness_function_name );
74
89
0 commit comments