Skip to content

Commit 5727624

Browse files
committed
clang-format switch statements touched in this PR
1 parent 7fd404d commit 5727624

18 files changed

+506
-543
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -777,46 +777,44 @@ bool java_bytecode_languaget::typecheck(
777777

778778
// Now incrementally elaborate methods
779779
// that are reachable from this entry point.
780-
// clang-format off
781780
switch(lazy_methods_mode)
782781
{
783-
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
784-
// ci = context-insensitive
785-
if(do_ci_lazy_method_conversion(symbol_table))
786-
return true;
787-
break;
788-
case LAZY_METHODS_MODE_EAGER:
789-
{
790-
symbol_table_buildert symbol_table_builder =
791-
symbol_table_buildert::wrap(symbol_table);
782+
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
783+
// ci = context-insensitive
784+
if(do_ci_lazy_method_conversion(symbol_table))
785+
return true;
786+
break;
787+
case LAZY_METHODS_MODE_EAGER:
788+
{
789+
symbol_table_buildert symbol_table_builder =
790+
symbol_table_buildert::wrap(symbol_table);
792791

793-
journalling_symbol_tablet journalling_symbol_table =
794-
journalling_symbol_tablet::wrap(symbol_table_builder);
792+
journalling_symbol_tablet journalling_symbol_table =
793+
journalling_symbol_tablet::wrap(symbol_table_builder);
795794

796-
// Convert all synthetic methods:
797-
for(const auto &function_id_and_type : synthetic_methods)
798-
{
799-
convert_single_method(
800-
function_id_and_type.first, journalling_symbol_table);
801-
}
802-
// Convert all methods for which we have bytecode now
803-
for(const auto &method_sig : method_bytecode)
804-
{
805-
convert_single_method(method_sig.first, journalling_symbol_table);
806-
}
807-
// Now convert all newly added string methods
808-
for(const auto &fn_name : journalling_symbol_table.get_inserted())
809-
{
810-
if(string_preprocess.implements_function(fn_name))
811-
convert_single_method(fn_name, symbol_table);
812-
}
813-
}
814-
break;
815-
case LAZY_METHODS_MODE_EXTERNAL_DRIVER:
816-
// Our caller is in charge of elaborating methods on demand.
817-
break;
795+
// Convert all synthetic methods:
796+
for(const auto &function_id_and_type : synthetic_methods)
797+
{
798+
convert_single_method(
799+
function_id_and_type.first, journalling_symbol_table);
800+
}
801+
// Convert all methods for which we have bytecode now
802+
for(const auto &method_sig : method_bytecode)
803+
{
804+
convert_single_method(method_sig.first, journalling_symbol_table);
805+
}
806+
// Now convert all newly added string methods
807+
for(const auto &fn_name : journalling_symbol_table.get_inserted())
808+
{
809+
if(string_preprocess.implements_function(fn_name))
810+
convert_single_method(fn_name, symbol_table);
811+
}
812+
}
813+
break;
814+
case LAZY_METHODS_MODE_EXTERNAL_DRIVER:
815+
// Our caller is in charge of elaborating methods on demand.
816+
break;
818817
}
819-
// clang-format on
820818

821819
// now instrument runtime exceptions
822820
java_bytecode_instrument(

src/analyses/escape_analysis.cpp

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -457,72 +457,60 @@ void escape_analysist::instrument(
457457

458458
const goto_programt::instructiont &instruction=*i_it;
459459

460-
// clang-format off
461460
if(instruction.type == ASSIGN)
462-
{
463-
const code_assignt &code_assign=to_code_assign(instruction.code);
464-
465-
std::set<irep_idt> cleanup_functions;
466-
operator[](i_it).check_lhs(code_assign.lhs(), cleanup_functions);
467-
insert_cleanup(
468-
f_it->second,
469-
i_it,
470-
code_assign.lhs(),
471-
cleanup_functions,
472-
false,
473-
ns);
474-
}
461+
{
462+
const code_assignt &code_assign = to_code_assign(instruction.code);
463+
464+
std::set<irep_idt> cleanup_functions;
465+
operator[](i_it).check_lhs(code_assign.lhs(), cleanup_functions);
466+
insert_cleanup(
467+
f_it->second, i_it, code_assign.lhs(), cleanup_functions, false, ns);
468+
}
475469
else if(instruction.type == DEAD)
476-
{
477-
const code_deadt &code_dead=to_code_dead(instruction.code);
470+
{
471+
const code_deadt &code_dead = to_code_dead(instruction.code);
478472

479-
std::set<irep_idt> cleanup_functions1;
473+
std::set<irep_idt> cleanup_functions1;
480474

481-
escape_domaint &d=operator[](i_it);
475+
escape_domaint &d = operator[](i_it);
482476

483-
const escape_domaint::cleanup_mapt::const_iterator m_it=
484-
d.cleanup_map.find("&"+id2string(code_dead.get_identifier()));
477+
const escape_domaint::cleanup_mapt::const_iterator m_it =
478+
d.cleanup_map.find("&" + id2string(code_dead.get_identifier()));
485479

486-
// does it have a cleanup function for the object?
487-
if(m_it!=d.cleanup_map.end())
488-
{
489-
cleanup_functions1.insert(
490-
m_it->second.cleanup_functions.begin(),
491-
m_it->second.cleanup_functions.end());
492-
}
480+
// does it have a cleanup function for the object?
481+
if(m_it != d.cleanup_map.end())
482+
{
483+
cleanup_functions1.insert(
484+
m_it->second.cleanup_functions.begin(),
485+
m_it->second.cleanup_functions.end());
486+
}
493487

494-
std::set<irep_idt> cleanup_functions2;
495-
496-
d.check_lhs(code_dead.symbol(), cleanup_functions2);
497-
498-
insert_cleanup(
499-
f_it->second,
500-
i_it,
501-
code_dead.symbol(),
502-
cleanup_functions1,
503-
true,
504-
ns);
505-
insert_cleanup(
506-
f_it->second,
507-
i_it,
508-
code_dead.symbol(),
509-
cleanup_functions2,
510-
false,
511-
ns);
512-
513-
for(const auto &c : cleanup_functions1)
514-
{
515-
(void)c;
516-
i_it++;
517-
}
488+
std::set<irep_idt> cleanup_functions2;
518489

519-
for(const auto &c : cleanup_functions2)
520-
{
521-
(void)c;
522-
i_it++;
523-
}
490+
d.check_lhs(code_dead.symbol(), cleanup_functions2);
491+
492+
insert_cleanup(
493+
f_it->second, i_it, code_dead.symbol(), cleanup_functions1, true, ns);
494+
insert_cleanup(
495+
f_it->second,
496+
i_it,
497+
code_dead.symbol(),
498+
cleanup_functions2,
499+
false,
500+
ns);
501+
502+
for(const auto &c : cleanup_functions1)
503+
{
504+
(void)c;
505+
i_it++;
524506
}
525-
// clang-format on
507+
508+
for(const auto &c : cleanup_functions2)
509+
{
510+
(void)c;
511+
i_it++;
512+
}
513+
}
526514
}
527515

528516
Forall_goto_program_instructions(i_it, f_it->second.body)

src/analyses/global_may_alias.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,32 +103,31 @@ void global_may_alias_domaint::transform(
103103

104104
const goto_programt::instructiont &instruction=*from;
105105

106-
// clang-format off
107106
switch(instruction.type)
108107
{
109108
case ASSIGN:
110-
{
111-
const code_assignt &code_assign=to_code_assign(instruction.code);
109+
{
110+
const code_assignt &code_assign = to_code_assign(instruction.code);
112111

113-
std::set<irep_idt> rhs_aliases;
114-
get_rhs_aliases(code_assign.rhs(), rhs_aliases);
115-
assign_lhs_aliases(code_assign.lhs(), rhs_aliases);
116-
}
112+
std::set<irep_idt> rhs_aliases;
113+
get_rhs_aliases(code_assign.rhs(), rhs_aliases);
114+
assign_lhs_aliases(code_assign.lhs(), rhs_aliases);
117115
break;
116+
}
118117

119118
case DECL:
120-
{
121-
const code_declt &code_decl=to_code_decl(instruction.code);
122-
aliases.isolate(code_decl.get_identifier());
123-
}
119+
{
120+
const code_declt &code_decl = to_code_decl(instruction.code);
121+
aliases.isolate(code_decl.get_identifier());
124122
break;
123+
}
125124

126125
case DEAD:
127-
{
128-
const code_deadt &code_dead=to_code_dead(instruction.code);
129-
aliases.isolate(code_dead.get_identifier());
130-
}
126+
{
127+
const code_deadt &code_dead = to_code_dead(instruction.code);
128+
aliases.isolate(code_dead.get_identifier());
131129
break;
130+
}
132131

133132
case FUNCTION_CALL:
134133
case GOTO:
@@ -149,7 +148,6 @@ void global_may_alias_domaint::transform(
149148
case NO_INSTRUCTION_TYPE:
150149
break;
151150
}
152-
// clang-format on
153151
}
154152

155153
void global_may_alias_domaint::output(

src/analyses/interval_domain.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ void interval_domaint::transform(
6464
ai_baset &,
6565
const namespacet &ns)
6666
{
67-
// clang-format off
6867
const goto_programt::instructiont &instruction=*from;
6968
switch(instruction.type)
7069
{
@@ -81,33 +80,33 @@ void interval_domaint::transform(
8180
break;
8281

8382
case GOTO:
83+
{
84+
// Comparing iterators is safe as the target must be within the same list
85+
// of instructions because this is a GOTO.
86+
locationt next = from;
87+
next++;
88+
if(from->get_target() != next) // If equal then a skip
8489
{
85-
// Comparing iterators is safe as the target must be within the same list
86-
// of instructions because this is a GOTO.
87-
locationt next=from;
88-
next++;
89-
if(from->get_target() != next) // If equal then a skip
90-
{
91-
if(next == to)
92-
assume(not_exprt(instruction.get_condition()), ns);
93-
else
94-
assume(instruction.get_condition(), ns);
95-
}
90+
if(next == to)
91+
assume(not_exprt(instruction.get_condition()), ns);
92+
else
93+
assume(instruction.get_condition(), ns);
9694
}
9795
break;
96+
}
9897

9998
case ASSUME:
10099
assume(instruction.get_condition(), ns);
101100
break;
102101

103102
case FUNCTION_CALL:
104-
{
105-
const code_function_callt &code_function_call=
106-
to_code_function_call(instruction.code);
107-
if(code_function_call.lhs().is_not_nil())
108-
havoc_rec(code_function_call.lhs());
109-
}
103+
{
104+
const code_function_callt &code_function_call =
105+
to_code_function_call(instruction.code);
106+
if(code_function_call.lhs().is_not_nil())
107+
havoc_rec(code_function_call.lhs());
110108
break;
109+
}
111110

112111
case CATCH:
113112
case THROW:
@@ -125,7 +124,6 @@ void interval_domaint::transform(
125124
case NO_INSTRUCTION_TYPE:
126125
break;
127126
}
128-
// clang-format on
129127
}
130128

131129
/// Sets *this to the mathematical join between the two domains. This can be

0 commit comments

Comments
 (0)