17
17
18
18
static std::string get_cprover_library_text (
19
19
const std::set<irep_idt> &functions,
20
- const symbol_tablet &symbol_table)
20
+ const symbol_tablet &symbol_table,
21
+ const bool force_load)
21
22
{
22
23
std::ostringstream library_text;
23
24
@@ -52,14 +53,15 @@ static std::string get_cprover_library_text(
52
53
// / \endcond
53
54
54
55
return get_cprover_library_text (
55
- functions, symbol_table, cprover_library, library_text.str ());
56
+ functions, symbol_table, cprover_library, library_text.str (), force_load );
56
57
}
57
58
58
59
std::string get_cprover_library_text (
59
60
const std::set<irep_idt> &functions,
60
61
const symbol_tablet &symbol_table,
61
62
const struct cprover_library_entryt cprover_library[],
62
- const std::string &prologue)
63
+ const std::string &prologue,
64
+ const bool force_load)
63
65
{
64
66
// the default mode is ios_base::out which means subsequent write to the
65
67
// stream will overwrite the original content
@@ -77,8 +79,9 @@ std::string get_cprover_library_text(
77
79
symbol_tablet::symbolst::const_iterator old=
78
80
symbol_table.symbols .find (id);
79
81
80
- if (old!=symbol_table.symbols .end () &&
81
- old->second .value .is_nil ())
82
+ if (
83
+ force_load ||
84
+ (old != symbol_table.symbols .end () && old->second .value .is_nil ()))
82
85
{
83
86
count++;
84
87
library_text << e->model << ' \n ' ;
@@ -100,17 +103,17 @@ void cprover_c_library_factory(
100
103
if (config.ansi_c .lib ==configt::ansi_ct::libt::LIB_NONE)
101
104
return ;
102
105
103
- std::string library_text;
104
-
105
- library_text=get_cprover_library_text (functions, symbol_table);
106
+ std::string library_text =
107
+ get_cprover_library_text (functions, symbol_table, false );
106
108
107
109
add_library (library_text, symbol_table, message_handler);
108
110
}
109
111
110
112
void add_library (
111
113
const std::string &src,
112
114
symbol_tablet &symbol_table,
113
- message_handlert &message_handler)
115
+ message_handlert &message_handler,
116
+ const std::set<irep_idt> &keep)
114
117
{
115
118
if (src.empty ())
116
119
return ;
@@ -121,5 +124,15 @@ void add_library(
121
124
ansi_c_language.set_message_handler (message_handler);
122
125
ansi_c_language.parse (in, " " );
123
126
124
- ansi_c_language.typecheck (symbol_table, " <built-in-library>" );
127
+ ansi_c_language.typecheck (symbol_table, " <built-in-library>" , true , keep);
128
+ }
129
+
130
+ void cprover_c_library_factory_force_load (
131
+ const std::set<irep_idt> &functions,
132
+ symbol_tablet &symbol_table,
133
+ message_handlert &message_handler)
134
+ {
135
+ std::string library_text =
136
+ get_cprover_library_text (functions, symbol_table, true );
137
+ add_library (library_text, symbol_table, message_handler, functions);
125
138
}
0 commit comments