Skip to content

Commit a3508a6

Browse files
Clang-format
1 parent cc56c44 commit a3508a6

File tree

3 files changed

+67
-69
lines changed

3 files changed

+67
-69
lines changed

jbmc/src/java_bytecode/lazy_goto_functions_map.h

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,17 @@ class lazy_goto_functions_mapt final
4949
// NOLINTNEXTLINE(readability/identifiers) - name matches those used in STL
5050
typedef std::size_t size_type;
5151

52-
typedef
53-
std::function<void(
54-
const irep_idt &name,
55-
goto_functionst::goto_functiont &function,
56-
journalling_symbol_tablet &function_symbols)>
52+
typedef std::function<void(
53+
const irep_idt &name,
54+
goto_functionst::goto_functiont &function,
55+
journalling_symbol_tablet &function_symbols)>
5756
post_process_functiont;
58-
typedef std::function<bool(const irep_idt &name)>
59-
can_generate_function_bodyt;
60-
typedef std::function<
61-
bool(
62-
const irep_idt &function_name,
63-
symbol_table_baset &symbol_table,
64-
goto_functiont &function,
65-
bool body_available)>
57+
typedef std::function<bool(const irep_idt &name)> can_generate_function_bodyt;
58+
typedef std::function<bool(
59+
const irep_idt &function_name,
60+
symbol_table_baset &symbol_table,
61+
goto_functiont &function,
62+
bool body_available)>
6663
generate_function_bodyt;
6764

6865
private:
@@ -90,15 +87,15 @@ class lazy_goto_functions_mapt final
9087
can_generate_function_bodyt driver_program_can_generate_function_body,
9188
generate_function_bodyt driver_program_generate_function_body,
9289
message_handlert &message_handler)
93-
: goto_functions(goto_functions),
94-
language_files(language_files),
95-
symbol_table(symbol_table),
96-
post_process_function(post_process_function),
97-
driver_program_can_generate_function_body(
98-
driver_program_can_generate_function_body),
99-
driver_program_generate_function_body(
100-
driver_program_generate_function_body),
101-
message_handler(message_handler)
90+
: goto_functions(goto_functions),
91+
language_files(language_files),
92+
symbol_table(symbol_table),
93+
post_process_function(post_process_function),
94+
driver_program_can_generate_function_body(
95+
driver_program_can_generate_function_body),
96+
driver_program_generate_function_body(
97+
driver_program_generate_function_body),
98+
message_handler(message_handler)
10299
{
103100
}
104101

@@ -125,12 +122,14 @@ class lazy_goto_functions_mapt final
125122
/// it a bodyless stub.
126123
bool can_produce_function(const key_type &name) const
127124
{
128-
return
129-
language_files.can_convert_lazy_method(name) ||
130-
driver_program_can_generate_function_body(name);
125+
return language_files.can_convert_lazy_method(name) ||
126+
driver_program_can_generate_function_body(name);
131127
}
132128

133-
void unload(const key_type &name) const { goto_functions.erase(name); }
129+
void unload(const key_type &name) const
130+
{
131+
goto_functions.erase(name);
132+
}
134133

135134
void ensure_function_loaded(const key_type &name) const
136135
{
@@ -148,9 +147,9 @@ class lazy_goto_functions_mapt final
148147

149148
journalling_symbol_tablet journalling_table =
150149
journalling_symbol_tablet::wrap(symbol_table_builder);
151-
reference named_function=ensure_entry_converted(name, journalling_table);
152-
mapped_type function=named_function.second;
153-
if(processed_functions.count(name)==0)
150+
reference named_function = ensure_entry_converted(name, journalling_table);
151+
mapped_type function = named_function.second;
152+
if(processed_functions.count(name) == 0)
154153
{
155154
// Run function-pass conversions
156155
post_process_function(name, function, journalling_table);
@@ -176,19 +175,18 @@ class lazy_goto_functions_mapt final
176175
// Fill in symbol table entry body if not already done
177176
language_files.convert_lazy_method(name, function_symbol_table);
178177

179-
underlying_mapt::iterator it=goto_functions.find(name);
180-
if(it!=goto_functions.end())
178+
underlying_mapt::iterator it = goto_functions.find(name);
179+
if(it != goto_functions.end())
181180
return *it;
182181

183182
goto_functiont function;
184183

185184
// First chance: see if the driver program wants to provide a replacement:
186-
bool body_provided =
187-
driver_program_generate_function_body(
188-
name,
189-
function_symbol_table,
190-
function,
191-
language_files.can_convert_lazy_method(name));
185+
bool body_provided = driver_program_generate_function_body(
186+
name,
187+
function_symbol_table,
188+
function,
189+
language_files.can_convert_lazy_method(name));
192190

193191
// Second chance: see if language_filest can provide a body:
194192
if(!body_provided)
@@ -204,4 +202,4 @@ class lazy_goto_functions_mapt final
204202
}
205203
};
206204

207-
#endif // CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H
205+
#endif // CPROVER_GOTO_PROGRAMS_LAZY_GOTO_FUNCTIONS_MAP_H

jbmc/src/java_bytecode/lazy_goto_model.cpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ lazy_goto_modelt::lazy_goto_modelt(
3333
goto_model->goto_functions.function_map,
3434
language_files,
3535
symbol_table,
36-
[this] (
36+
[this](
3737
const irep_idt &function_name,
3838
goto_functionst::goto_functiont &function,
39-
journalling_symbol_tablet &journalling_symbol_table) -> void
40-
{
39+
journalling_symbol_tablet &journalling_symbol_table) -> void {
4140
goto_model_functiont model_function(
4241
journalling_symbol_table,
4342
goto_model->goto_functions,
@@ -66,11 +65,10 @@ lazy_goto_modelt::lazy_goto_modelt(lazy_goto_modelt &&other)
6665
goto_model->goto_functions.function_map,
6766
language_files,
6867
symbol_table,
69-
[this] (
68+
[this](
7069
const irep_idt &function_name,
7170
goto_functionst::goto_functiont &function,
72-
journalling_symbol_tablet &journalling_symbol_table) -> void
73-
{
71+
journalling_symbol_tablet &journalling_symbol_table) -> void {
7472
goto_model_functiont model_function(
7573
journalling_symbol_table,
7674
goto_model->goto_functions,
@@ -151,16 +149,16 @@ void lazy_goto_modelt::initialize(
151149
"failed to open input file '" + filename + '\'');
152150
}
153151

154-
language_filet &lf=add_language_file(filename);
155-
lf.language=get_language_from_filename(filename);
152+
language_filet &lf = add_language_file(filename);
153+
lf.language = get_language_from_filename(filename);
156154

157-
if(lf.language==nullptr)
155+
if(lf.language == nullptr)
158156
{
159157
throw invalid_source_file_exceptiont(
160158
"failed to figure out type of file '" + filename + '\'');
161159
}
162160

163-
languaget &language=*lf.language;
161+
languaget &language = *lf.language;
164162
language.set_message_handler(message_handler);
165163
language.set_language_options(options);
166164

@@ -198,7 +196,7 @@ void lazy_goto_modelt::initialize(
198196
bool binaries_provided_start =
199197
symbol_table.has_symbol(goto_functionst::entry_point());
200198

201-
bool entry_point_generation_failed=false;
199+
bool entry_point_generation_failed = false;
202200

203201
if(binaries_provided_start && options.is_set("function"))
204202
{
@@ -226,7 +224,7 @@ void lazy_goto_modelt::initialize(
226224
{
227225
// Allow all language front-ends to try to provide the user-specified
228226
// (--function) entry-point, or some language-specific default:
229-
entry_point_generation_failed=
227+
entry_point_generation_failed =
230228
language_files.generate_support_functions(symbol_table);
231229
}
232230

@@ -243,10 +241,11 @@ void lazy_goto_modelt::initialize(
243241
void lazy_goto_modelt::load_all_functions() const
244242
{
245243
symbol_tablet::symbolst::size_type table_size;
246-
symbol_tablet::symbolst::size_type new_table_size=symbol_table.symbols.size();
244+
symbol_tablet::symbolst::size_type new_table_size =
245+
symbol_table.symbols.size();
247246
do
248247
{
249-
table_size=new_table_size;
248+
table_size = new_table_size;
250249

251250
// Find symbols that correspond to functions
252251
std::vector<irep_idt> fn_ids_to_convert;
@@ -262,8 +261,8 @@ void lazy_goto_modelt::load_all_functions() const
262261
// Repeat while new symbols are being added in case any of those are
263262
// stubbed functions. Even stubs can create new stubs while being
264263
// converted if they are special stubs (e.g. string functions)
265-
new_table_size=symbol_table.symbols.size();
266-
} while(new_table_size!=table_size);
264+
new_table_size = symbol_table.symbols.size();
265+
} while(new_table_size != table_size);
267266

268267
goto_model->goto_functions.compute_location_numbers();
269268
}

jbmc/src/java_bytecode/lazy_goto_model.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class lazy_goto_modelt : public abstract_goto_modelt
149149
/// \param message_handler: The message_handler to use for logging
150150
/// \tparam THandler: a type that defines methods process_goto_function and
151151
/// process_goto_functions
152-
template<typename THandler>
152+
template <typename THandler>
153153
static lazy_goto_modelt from_handler_object(
154154
THandler &handler,
155155
const optionst &options,
@@ -166,15 +166,13 @@ class lazy_goto_modelt : public abstract_goto_modelt
166166
[&handler](const irep_idt &name) -> bool {
167167
return handler.can_generate_function_body(name);
168168
},
169-
[&handler]
170-
(const irep_idt &function_name,
171-
symbol_table_baset &symbol_table,
172-
goto_functiont &function,
173-
bool is_first_chance)
174-
{
175-
return
176-
handler.generate_function_body(
177-
function_name, symbol_table, function, is_first_chance);
169+
[&handler](
170+
const irep_idt &function_name,
171+
symbol_table_baset &symbol_table,
172+
goto_functiont &function,
173+
bool is_first_chance) {
174+
return handler.generate_function_body(
175+
function_name, symbol_table, function, is_first_chance);
178176
},
179177
message_handler);
180178
}
@@ -185,7 +183,10 @@ class lazy_goto_modelt : public abstract_goto_modelt
185183
/// Eagerly loads all functions from the symbol table.
186184
void load_all_functions() const;
187185

188-
void unload(const irep_idt &name) const { goto_functions.unload(name); }
186+
void unload(const irep_idt &name) const
187+
{
188+
goto_functions.unload(name);
189+
}
189190

190191
language_filet &add_language_file(const std::string &filename)
191192
{
@@ -198,8 +199,8 @@ class lazy_goto_modelt : public abstract_goto_modelt
198199
/// Before freezing the functions all module-level passes are run
199200
/// \param model: The lazy_goto_modelt to freeze
200201
/// \return The frozen goto_modelt or an empty optional if freezing fails
201-
static std::unique_ptr<goto_modelt> process_whole_model_and_freeze(
202-
lazy_goto_modelt &&model)
202+
static std::unique_ptr<goto_modelt>
203+
process_whole_model_and_freeze(lazy_goto_modelt &&model)
203204
{
204205
if(model.finalize())
205206
return nullptr;
@@ -238,8 +239,8 @@ class lazy_goto_modelt : public abstract_goto_modelt
238239
/// `languaget::convert_lazy_method` function. If that results in a `codet`
239240
/// representation of the function stored in the symbol table, convert it
240241
/// to GOTO and return it as in step (3).
241-
const goto_functionst::goto_functiont &get_goto_function(const irep_idt &id)
242-
override
242+
const goto_functionst::goto_functiont &
243+
get_goto_function(const irep_idt &id) override
243244
{
244245
return goto_functions.at(id);
245246
}

0 commit comments

Comments
 (0)