Skip to content

Commit 7545fc5

Browse files
author
Thomas Kiley
authored
Merge pull request diffblue#1409 from thk123/bugfix/lang-args-missing
Verify that language options have been initialised
2 parents 7fb835c + 61c6489 commit 7545fc5

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

src/cbmc/cbmc_parse_options.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,10 @@ int cbmc_parse_optionst::get_goto_program(
634634
{
635635
const std::string &function_id=cmdline.get_value("function");
636636
rebuild_goto_start_functiont start_function_rebuilder(
637-
get_message_handler(),
638-
goto_model.symbol_table,
639-
goto_model.goto_functions);
637+
get_message_handler(),
638+
cmdline,
639+
goto_model.symbol_table,
640+
goto_model.goto_functions);
640641

641642
if(start_function_rebuilder(function_id))
642643
{

src/goto-programs/initialize_goto_model.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ bool initialize_goto_model(
138138
const std::string &function_id=cmdline.get_value("function");
139139
rebuild_goto_start_functiont start_function_rebuilder(
140140
msg.get_message_handler(),
141+
cmdline,
141142
goto_model.symbol_table,
142143
goto_model.goto_functions);
143144

src/goto-programs/rebuild_goto_start_function.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <util/symbol.h>
1414
#include <util/symbol_table.h>
1515
#include <util/prefix.h>
16+
#include <util/cmdline.h>
1617
#include <langapi/mode.h>
1718
#include <memory>
1819

@@ -25,11 +26,13 @@
2526
/// body of the _start function).
2627
rebuild_goto_start_functiont::rebuild_goto_start_functiont(
2728
message_handlert &_message_handler,
29+
const cmdlinet &cmdline,
2830
symbol_tablet &symbol_table,
2931
goto_functionst &goto_functions):
30-
messaget(_message_handler),
31-
symbol_table(symbol_table),
32-
goto_functions(goto_functions)
32+
messaget(_message_handler),
33+
cmdline(cmdline),
34+
symbol_table(symbol_table),
35+
goto_functions(goto_functions)
3336
{
3437
}
3538

@@ -50,6 +53,7 @@ bool rebuild_goto_start_functiont::operator()(
5053
std::unique_ptr<languaget> language=get_language_from_mode(mode);
5154
INVARIANT(language, "No language found for mode: "+id2string(mode));
5255
language->set_message_handler(get_message_handler());
56+
language->get_language_options(cmdline);
5357

5458
// To create a new entry point we must first remove the old one
5559
remove_existing_entry_point();

src/goto-programs/rebuild_goto_start_function.h

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define CPROVER_GOTO_PROGRAMS_REBUILD_GOTO_START_FUNCTION_H
1111

1212
#include <util/message.h>
13+
class cmdlinet;
1314

1415
class symbol_tablet;
1516
class goto_functionst;
@@ -25,6 +26,7 @@ class rebuild_goto_start_functiont: public messaget
2526
public:
2627
rebuild_goto_start_functiont(
2728
message_handlert &_message_handler,
29+
const cmdlinet &cmdline,
2830
symbol_tablet &symbol_table,
2931
goto_functionst &goto_functions);
3032

@@ -35,6 +37,7 @@ class rebuild_goto_start_functiont: public messaget
3537

3638
void remove_existing_entry_point();
3739

40+
const cmdlinet &cmdline;
3841
symbol_tablet &symbol_table;
3942
goto_functionst &goto_functions;
4043
};

src/java_bytecode/java_bytecode_language.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ bool java_bytecode_languaget::generate_start_function(
119119
const irep_idt &entry_function_symbol_id,
120120
symbol_tablet &symbol_table)
121121
{
122+
PRECONDITION(language_options_initialized);
122123
const auto res=
123124
get_main_symbol(
124125
symbol_table, entry_function_symbol_id, get_message_handler());
@@ -202,6 +203,8 @@ bool java_bytecode_languaget::typecheck(
202203
symbol_tablet &symbol_table,
203204
const std::string &module)
204205
{
206+
PRECONDITION(language_options_initialized);
207+
205208
if(string_refinement_enabled)
206209
string_preprocess.initialize_conversion_table();
207210

@@ -387,6 +390,7 @@ void java_bytecode_languaget::replace_string_methods(
387390

388391
bool java_bytecode_languaget::final(symbol_tablet &symbol_table)
389392
{
393+
PRECONDITION(language_options_initialized);
390394
java_internal_additions(symbol_table);
391395

392396
// replace code of String methods calls by code we generate

0 commit comments

Comments
 (0)