Skip to content

Commit 06afe80

Browse files
authored
Merge pull request #6220 from martin-cs/refactor/virtual_register_languages
Refactor/virtual register languages
2 parents e6f6970 + 021116b commit 06afe80

16 files changed

+84
-34
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class optionst;
154154
class janalyzer_parse_optionst : public parse_options_baset
155155
{
156156
public:
157-
virtual int doit() override;
158-
virtual void help() override;
157+
int doit() override;
158+
void help() override;
159159

160160
janalyzer_parse_optionst(int argc, const char **argv);
161161

@@ -177,7 +177,7 @@ class janalyzer_parse_optionst : public parse_options_baset
177177
protected:
178178
std::unique_ptr<class_hierarchyt> class_hierarchy;
179179

180-
void register_languages();
180+
void register_languages() override;
181181

182182
void get_command_line_options(optionst &options);
183183

jbmc/src/jdiff/jdiff_parse_options.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class goto_modelt;
4242
class jdiff_parse_optionst : public parse_options_baset
4343
{
4444
public:
45-
virtual int doit();
46-
virtual void help();
45+
int doit() override;
46+
void help() override;
4747

4848
jdiff_parse_optionst(int argc, const char **argv);
4949

5050
protected:
51-
void register_languages();
51+
void register_languages() override;
5252

5353
void get_command_line_options(optionst &options);
5454

src/cbmc/cbmc_parse_options.h

Lines changed: 1 addition & 1 deletion
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/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
SRC = goto_analyzer_main.cpp \
1+
SRC = goto_analyzer_languages.cpp \
2+
goto_analyzer_main.cpp \
23
goto_analyzer_parse_options.cpp \
34
taint_analysis.cpp \
45
taint_parser.cpp \
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*******************************************************************\
2+
3+
Module: Language Registration
4+
5+
Author: Martin Brain, [email protected]
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Language Registration
11+
12+
#include "goto_analyzer_parse_options.h"
13+
14+
#include <langapi/mode.h>
15+
16+
#include <ansi-c/ansi_c_language.h>
17+
#include <cpp/cpp_language.h>
18+
19+
#ifdef HAVE_JSIL
20+
# include <jsil/jsil_language.h>
21+
#endif
22+
23+
void goto_analyzer_parse_optionst::register_languages()
24+
{
25+
register_language(new_ansi_c_language);
26+
register_language(new_cpp_language);
27+
28+
#ifdef HAVE_JSIL
29+
register_language(new_jsil_language);
30+
#endif
31+
}

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ Author: Daniel Kroening, [email protected]
1616
#include <iostream>
1717
#include <memory>
1818

19-
#include <ansi-c/ansi_c_language.h>
2019
#include <ansi-c/cprover_library.h>
2120

2221
#include <assembler/remove_asm.h>
2322

24-
#include <cpp/cpp_language.h>
2523
#include <cpp/cprover_library.h>
2624

27-
#include <jsil/jsil_language.h>
28-
2925
#include <goto-programs/add_malloc_may_fail_variable_initializations.h>
3026
#include <goto-programs/initialize_goto_model.h>
3127
#include <goto-programs/link_to_library.h>
@@ -37,9 +33,6 @@ Author: Daniel Kroening, [email protected]
3733
#include <analyses/ai.h>
3834
#include <analyses/local_may_alias.h>
3935

40-
#include <langapi/mode.h>
41-
#include <langapi/language.h>
42-
4336
#include <util/config.h>
4437
#include <util/exception_utils.h>
4538
#include <util/exit_codes.h>
@@ -65,13 +58,6 @@ goto_analyzer_parse_optionst::goto_analyzer_parse_optionst(
6558
{
6659
}
6760

68-
void goto_analyzer_parse_optionst::register_languages()
69-
{
70-
register_language(new_ansi_c_language);
71-
register_language(new_cpp_language);
72-
register_language(new_jsil_language);
73-
}
74-
7561
void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
7662
{
7763
if(config.set(cmdline))

src/goto-analyzer/goto_analyzer_parse_options.h

Lines changed: 1 addition & 1 deletion
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-cc/goto_cc_languages.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ Author: CM Wintersteiger
1515

1616
#include <ansi-c/ansi_c_language.h>
1717
#include <cpp/cpp_language.h>
18-
#include <jsil/jsil_language.h>
18+
19+
#ifdef HAVE_JSIL
20+
# include <jsil/jsil_language.h>
21+
#endif
1922

2023
void goto_cc_modet::register_languages()
2124
{
2225
register_language(new_ansi_c_language);
2326
register_language(new_cpp_language);
27+
28+
#ifdef HAVE_JSIL
2429
register_language(new_jsil_language);
30+
#endif
2531
}

src/goto-diff/goto_diff_parse_options.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ class optionst;
4343
class goto_diff_parse_optionst : public parse_options_baset
4444
{
4545
public:
46-
virtual int doit();
47-
virtual void help();
46+
int doit() override;
47+
void help() override;
4848

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

Lines changed: 3 additions & 0 deletions
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);

0 commit comments

Comments
 (0)