@@ -1117,17 +1117,17 @@ goto_programt::const_targett goto_program2codet::convert_goto_if(
1117
1117
if (has_else)
1118
1118
{
1119
1119
for (++target; target!=before_else; ++target)
1120
- target= convert_instruction (target, before_else, to_code ( i.then_case () ));
1120
+ target = convert_instruction (target, before_else, i.then_case ());
1121
1121
1122
- convert_labels (before_else, to_code ( i.then_case () ));
1122
+ convert_labels (before_else, i.then_case ());
1123
1123
1124
1124
for (++target; target!=end_if; ++target)
1125
- target= convert_instruction (target, end_if, to_code ( i.else_case () ));
1125
+ target = convert_instruction (target, end_if, i.else_case ());
1126
1126
}
1127
1127
else
1128
1128
{
1129
1129
for (++target; target!=end_if; ++target)
1130
- target= convert_instruction (target, end_if, to_code ( i.then_case () ));
1130
+ target = convert_instruction (target, end_if, i.then_case ());
1131
1131
}
1132
1132
1133
1133
dest.move_to_operands (i);
@@ -1354,12 +1354,12 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
1354
1354
1355
1355
// use pthreads if "code in new thread" is a function call to a function with
1356
1356
// suitable signature
1357
- if (thread_start->is_function_call () &&
1358
- to_code_function_call (to_code (thread_start->code )).arguments ().size ()==1 &&
1359
- after_thread_start==thread_end)
1357
+ if (
1358
+ thread_start->is_function_call () &&
1359
+ to_code_function_call (thread_start->code ).arguments ().size () == 1 &&
1360
+ after_thread_start == thread_end)
1360
1361
{
1361
- const code_function_callt &cf=
1362
- to_code_function_call (to_code (thread_start->code ));
1362
+ const code_function_callt &cf = to_code_function_call (thread_start->code );
1363
1363
1364
1364
system_headers.insert (" pthread.h" );
1365
1365
@@ -1730,14 +1730,15 @@ void goto_program2codet::cleanup_code_ifthenelse(
1730
1730
1731
1731
// assert(false) expands to if(true) assert(false), simplify again (and also
1732
1732
// simplify other cases)
1733
- if (cond.is_true () &&
1734
- (i_t_e.else_case ().is_nil () || !has_labels (to_code (i_t_e.else_case ()))))
1733
+ if (
1734
+ cond.is_true () &&
1735
+ (i_t_e.else_case ().is_nil () || !has_labels (i_t_e.else_case ())))
1735
1736
{
1736
1737
codet tmp;
1737
1738
tmp.swap (i_t_e.then_case ());
1738
1739
code.swap (tmp);
1739
1740
}
1740
- else if (cond.is_false () && !has_labels (to_code ( i_t_e.then_case () )))
1741
+ else if (cond.is_false () && !has_labels (i_t_e.then_case ()))
1741
1742
{
1742
1743
if (i_t_e.else_case ().is_nil ())
1743
1744
code=code_skipt ();
@@ -1750,8 +1751,9 @@ void goto_program2codet::cleanup_code_ifthenelse(
1750
1751
}
1751
1752
else
1752
1753
{
1753
- if (i_t_e.then_case ().is_not_nil () &&
1754
- to_code (i_t_e.then_case ()).get_statement ()==ID_ifthenelse)
1754
+ if (
1755
+ i_t_e.then_case ().is_not_nil () &&
1756
+ i_t_e.then_case ().get_statement () == ID_ifthenelse)
1755
1757
{
1756
1758
// we re-introduce 1-code blocks with if-then-else to avoid dangling-else
1757
1759
// ambiguity
@@ -1760,9 +1762,10 @@ void goto_program2codet::cleanup_code_ifthenelse(
1760
1762
i_t_e.then_case ().swap (b);
1761
1763
}
1762
1764
1763
- if (i_t_e.else_case ().is_not_nil () &&
1764
- to_code (i_t_e.then_case ()).get_statement ()==ID_skip &&
1765
- to_code (i_t_e.else_case ()).get_statement ()==ID_ifthenelse)
1765
+ if (
1766
+ i_t_e.else_case ().is_not_nil () &&
1767
+ i_t_e.then_case ().get_statement () == ID_skip &&
1768
+ i_t_e.else_case ().get_statement () == ID_ifthenelse)
1766
1769
{
1767
1770
// we re-introduce 1-code blocks with if-then-else to avoid dangling-else
1768
1771
// ambiguity
@@ -1795,8 +1798,9 @@ void goto_program2codet::cleanup_code_ifthenelse(
1795
1798
}
1796
1799
1797
1800
// remove empty then/else
1798
- if (code.get_statement ()==ID_ifthenelse &&
1799
- to_code (i_t_e.then_case ()).get_statement ()==ID_skip)
1801
+ if (
1802
+ code.get_statement () == ID_ifthenelse &&
1803
+ i_t_e.then_case ().get_statement () == ID_skip)
1800
1804
{
1801
1805
not_exprt tmp (i_t_e.cond ());
1802
1806
simplify (tmp, ns);
@@ -1805,15 +1809,15 @@ void goto_program2codet::cleanup_code_ifthenelse(
1805
1809
i_t_e.cond ().swap (tmp);
1806
1810
i_t_e.then_case ().swap (i_t_e.else_case ());
1807
1811
}
1808
- if (code. get_statement ()==ID_ifthenelse &&
1809
- i_t_e.else_case ().is_not_nil () &&
1810
- to_code ( i_t_e.else_case ()) .get_statement ()== ID_skip)
1812
+ if (
1813
+ code. get_statement () == ID_ifthenelse && i_t_e.else_case ().is_not_nil () &&
1814
+ i_t_e.else_case ().get_statement () == ID_skip)
1811
1815
i_t_e.else_case ().make_nil ();
1812
1816
// or even remove the if altogether if the then case is now empty
1813
- if (code. get_statement ()==ID_ifthenelse &&
1814
- i_t_e.else_case ().is_nil () &&
1815
- (i_t_e.then_case ().is_nil () ||
1816
- to_code ( i_t_e.then_case ()) .get_statement ()== ID_skip))
1817
+ if (
1818
+ code. get_statement () == ID_ifthenelse && i_t_e.else_case ().is_nil () &&
1819
+ (i_t_e.then_case ().is_nil () ||
1820
+ i_t_e.then_case ().get_statement () == ID_skip))
1817
1821
code=code_skipt ();
1818
1822
}
1819
1823
0 commit comments