Skip to content

Commit 0db3ac7

Browse files
author
martin
committed
register_languages is now an interface not just a convention
1 parent a93e43f commit 0db3ac7

10 files changed

+32
-6
lines changed

src/cbmc/cbmc_parse_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class cbmc_parse_optionst : public parse_options_baset
114114
protected:
115115
goto_modelt goto_model;
116116

117-
void register_languages();
117+
void register_languages() override;
118118
void get_command_line_options(optionst &);
119119
void preprocessing(const optionst &);
120120
bool set_properties();

src/goto-analyzer/goto_analyzer_parse_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class goto_analyzer_parse_optionst: public parse_options_baset
183183
protected:
184184
goto_modelt goto_model;
185185

186-
virtual void register_languages();
186+
void register_languages() override;
187187

188188
virtual void get_command_line_options(optionst &options);
189189

src/goto-diff/goto_diff_parse_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class goto_diff_parse_optionst : public parse_options_baset
4949
goto_diff_parse_optionst(int argc, const char **argv);
5050

5151
protected:
52-
void register_languages();
52+
void register_languages() override;
5353

5454
void get_command_line_options(optionst &options);
5555

src/goto-harness/goto_harness_parse_options.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ int goto_harness_parse_optionst::doit()
108108
// This just sets up the defaults (and would interpret options such as --32).
109109
config.set(cmdline);
110110

111+
// Normally we would register language front-ends here but as goto-harness
112+
// only works on goto binaries, we don't need to
113+
111114
// Read goto binary into goto-model
112115
auto read_goto_binary_result =
113116
read_goto_binary(got_harness_config.in_file, ui_message_handler);

src/goto-instrument/goto_instrument_parse_options.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class goto_instrument_parse_optionst : public parse_options_baset
145145
}
146146

147147
protected:
148-
void register_languages();
148+
void register_languages() override;
149149

150150
void get_goto_program();
151151
void instrument_goto_program();

src/memory-analyzer/memory_analyzer_parse_options.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ memory_analyzer_parse_optionst::memory_analyzer_parse_optionst(
4242
{
4343
}
4444

45+
void memory_analyzer_parse_optionst::register_languages()
46+
{
47+
// For now only C is supported due to the additional challenges of
48+
// mapping source code to debugging symbols in other languages.
49+
register_language(new_ansi_c_language);
50+
}
51+
4552
int memory_analyzer_parse_optionst::doit()
4653
{
4754
if(cmdline.isset("version"))
@@ -91,7 +98,7 @@ int memory_analyzer_parse_optionst::doit()
9198
"--symtab-snapshot");
9299
}
93100

94-
register_language(new_ansi_c_language);
101+
register_languages();
95102

96103
std::string binary = cmdline.args.front();
97104

src/memory-analyzer/memory_analyzer_parse_options.h

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class memory_analyzer_parse_optionst : public parse_options_baset
3737

3838
protected:
3939
messaget message;
40+
41+
void register_languages() override;
4042
};
4143

4244
#endif // CPROVER_MEMORY_ANALYZER_MEMORY_ANALYZER_PARSE_OPTIONS_H

src/symtab2gb/symtab2gb_parse_options.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ static void run_symtab2gb(
9494
}
9595
}
9696

97+
void symtab2gb_parse_optionst::register_languages()
98+
{
99+
// As this is a converter and linker it only really needs to support
100+
// the JSON symtab front-end.
101+
register_language(new_json_symtab_language);
102+
}
103+
97104
int symtab2gb_parse_optionst::doit()
98105
{
99106
if(cmdline.isset("version"))
@@ -112,7 +119,7 @@ int symtab2gb_parse_optionst::doit()
112119
{
113120
gb_filename = cmdline.get_value(SYMTAB2GB_OUT_FILE_OPT);
114121
}
115-
register_language(new_json_symtab_language);
122+
register_languages();
116123
config.set(cmdline);
117124
run_symtab2gb(symtab_filenames, gb_filename);
118125
return CPROVER_EXIT_SUCCESS;

src/symtab2gb/symtab2gb_parse_options.h

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class symtab2gb_parse_optionst : public parse_options_baset
2727
symtab2gb_parse_optionst(int argc, const char *argv[]);
2828
void help() override;
2929
int doit() override;
30+
31+
protected:
32+
void register_languages() override;
3033
};
3134

3235
#endif // CPROVER_SYMTAB2GB_SYMTAB2GB_PARSE_OPTIONS_H

src/util/parse_options.h

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class parse_options_baset
4545
ui_message_handlert ui_message_handler;
4646
messaget log;
4747

48+
virtual void register_languages()
49+
{
50+
}
51+
4852
private:
4953
void unknown_option_msg();
5054
};

0 commit comments

Comments
 (0)