Skip to content

Commit 81fb35f

Browse files
committed
clang-format switch statements touched in this PR
1 parent 87e86bb commit 81fb35f

17 files changed

+440
-476
lines changed

jbmc/src/java_bytecode/java_bytecode_language.cpp

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

792792
// Now incrementally elaborate methods
793793
// that are reachable from this entry point.
794-
// clang-format off
795794
switch(lazy_methods_mode)
796795
{
797-
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
798-
// ci = context-insensitive
799-
if(do_ci_lazy_method_conversion(symbol_table))
800-
return true;
801-
break;
802-
case LAZY_METHODS_MODE_EAGER:
803-
{
804-
symbol_table_buildert symbol_table_builder =
805-
symbol_table_buildert::wrap(symbol_table);
796+
case LAZY_METHODS_MODE_CONTEXT_INSENSITIVE:
797+
// ci = context-insensitive
798+
if(do_ci_lazy_method_conversion(symbol_table))
799+
return true;
800+
break;
801+
case LAZY_METHODS_MODE_EAGER:
802+
{
803+
symbol_table_buildert symbol_table_builder =
804+
symbol_table_buildert::wrap(symbol_table);
806805

807-
journalling_symbol_tablet journalling_symbol_table =
808-
journalling_symbol_tablet::wrap(symbol_table_builder);
806+
journalling_symbol_tablet journalling_symbol_table =
807+
journalling_symbol_tablet::wrap(symbol_table_builder);
809808

810-
// Convert all synthetic methods:
811-
for(const auto &function_id_and_type : synthetic_methods)
812-
{
813-
convert_single_method(
814-
function_id_and_type.first, journalling_symbol_table);
815-
}
816-
// Convert all methods for which we have bytecode now
817-
for(const auto &method_sig : method_bytecode)
818-
{
819-
convert_single_method(method_sig.first, journalling_symbol_table);
820-
}
821-
// Now convert all newly added string methods
822-
for(const auto &fn_name : journalling_symbol_table.get_inserted())
823-
{
824-
if(string_preprocess.implements_function(fn_name))
825-
convert_single_method(fn_name, symbol_table);
826-
}
827-
}
828-
break;
829-
case LAZY_METHODS_MODE_EXTERNAL_DRIVER:
830-
// Our caller is in charge of elaborating methods on demand.
831-
break;
809+
// Convert all synthetic methods:
810+
for(const auto &function_id_and_type : synthetic_methods)
811+
{
812+
convert_single_method(
813+
function_id_and_type.first, journalling_symbol_table);
814+
}
815+
// Convert all methods for which we have bytecode now
816+
for(const auto &method_sig : method_bytecode)
817+
{
818+
convert_single_method(method_sig.first, journalling_symbol_table);
819+
}
820+
// Now convert all newly added string methods
821+
for(const auto &fn_name : journalling_symbol_table.get_inserted())
822+
{
823+
if(string_preprocess.implements_function(fn_name))
824+
convert_single_method(fn_name, symbol_table);
825+
}
826+
}
827+
break;
828+
case LAZY_METHODS_MODE_EXTERNAL_DRIVER:
829+
// Our caller is in charge of elaborating methods on demand.
830+
break;
832831
}
833-
// clang-format on
834832

835833
// now instrument runtime exceptions
836834
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)