Skip to content

Commit 6cfbec2

Browse files
author
Daniel Kroening
authored
Merge pull request #5341 from diffblue/remove-deprecated13
remove two deprecated codet-related constructors/methods
2 parents 87a9673 + 6395675 commit 6cfbec2

File tree

5 files changed

+18
-44
lines changed

5 files changed

+18
-44
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,8 @@ java_bytecode_convert_methodt::convert_instructions(const methodt &method)
17611761
// instruction before the actual instruction:
17621762
if(catch_instruction.has_value())
17631763
{
1764-
c.make_block();
1764+
if(c.get_statement() != ID_block)
1765+
c = code_blockt{{c}};
17651766
c.operands().insert(c.operands().begin(), *catch_instruction);
17661767
}
17671768

@@ -1831,12 +1832,16 @@ java_bytecode_convert_methodt::convert_instructions(const methodt &method)
18311832
}
18321833
else
18331834
{
1834-
c.make_block();
1835+
if(c.get_statement() != ID_block)
1836+
c = code_blockt{{c}};
1837+
18351838
auto &last_statement=to_code_block(c).find_last_statement();
18361839
if(last_statement.get_statement()==ID_goto)
18371840
{
18381841
// Insert stack twiddling before branch:
1839-
last_statement.make_block();
1842+
if(last_statement.get_statement() != ID_block)
1843+
last_statement = code_blockt{{last_statement}};
1844+
18401845
last_statement.operands().insert(
18411846
last_statement.operands().begin(),
18421847
more_code.statements().begin(),

src/cpp/cpp_typecheck_compound_type.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,13 @@ void cpp_typecheckt::typecheck_compound_declarator(
669669
{
670670
expr_call.type()=to_code_type(component.type()).return_type();
671671

672-
func_symb.value =
673-
code_returnt(already_typechecked_exprt{std::move(expr_call)})
674-
.make_block();
672+
func_symb.value = code_blockt{
673+
{code_returnt(already_typechecked_exprt{std::move(expr_call)})}};
675674
}
676675
else
677676
{
678-
func_symb.value =
679-
code_expressiont(already_typechecked_exprt{std::move(expr_call)})
680-
.make_block();
677+
func_symb.value = code_blockt{{code_expressiont(
678+
already_typechecked_exprt{std::move(expr_call)})}};
681679
}
682680

683681
// add this new function to the list of components
@@ -1241,7 +1239,8 @@ void cpp_typecheckt::move_member_initializers(
12411239
throw 0;
12421240
}
12431241

1244-
to_code(value).make_block();
1242+
if(to_code(value).get_statement() != ID_block)
1243+
value = code_blockt{{to_code(value)}};
12451244

12461245
exprt::operandst::iterator o_it=value.operands().begin();
12471246
forall_irep(it, initializers.get_sub())

src/goto-instrument/goto_program2code.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,10 +1257,9 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
12571257
{
12581258
labels_in_use.insert(*it);
12591259

1260-
code_labelt l(*it);
1261-
l.code().swap(b);
1260+
code_labelt l(*it, std::move(b));
12621261
l.add_source_location()=target->source_location;
1263-
b.swap(l);
1262+
b = std::move(l);
12641263
}
12651264

12661265
assert(b.get_statement()==ID_label);
@@ -1323,10 +1322,9 @@ goto_programt::const_targett goto_program2codet::convert_start_thread(
13231322
{
13241323
labels_in_use.insert(*it);
13251324

1326-
code_labelt l(*it);
1327-
l.code().swap(b);
1325+
code_labelt l(*it, std::move(b));
13281326
l.add_source_location()=target->source_location;
1329-
b.swap(l);
1327+
b = std::move(l);
13301328
}
13311329

13321330
assert(b.get_statement()==ID_label);

src/util/std_code.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ Author: Daniel Kroening, [email protected]
1616
#include "std_expr.h"
1717
#include "string_constant.h"
1818

19-
/// If this `codet` is a \ref code_blockt (i.e.\ it represents a block of
20-
/// statements), return the unmodified input. Otherwise (i.e.\ the `codet`
21-
/// represents a single statement), convert it to a \ref code_blockt with the
22-
/// original statement as its only operand and return the result.
23-
code_blockt &codet::make_block()
24-
{
25-
if(get_statement()==ID_block)
26-
return static_cast<code_blockt &>(*this);
27-
28-
exprt tmp;
29-
tmp.swap(*this);
30-
31-
*this = codet(ID_block);
32-
add_to_operands(std::move(tmp));
33-
34-
return static_cast<code_blockt &>(*this);
35-
}
36-
3719
/// In the case of a `codet` type that represents multiple statements, return
3820
/// the first of them. Otherwise return the `codet` itself.
3921
codet &codet::first_statement()

src/util/std_code.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ class codet:public exprt
7878
codet &last_statement();
7979
const codet &last_statement() const;
8080

81-
DEPRECATED(SINCE(2019, 2, 6, "use code_blockt(...) instead"))
82-
class code_blockt &make_block();
83-
8481
/// Check that the code statement is well-formed (shallow checks only, i.e.,
8582
/// enclosed statements, subexpressions, etc. are not checked)
8683
///
@@ -1377,13 +1374,6 @@ inline code_returnt &to_code_return(codet &code)
13771374
class code_labelt:public codet
13781375
{
13791376
public:
1380-
DEPRECATED(SINCE(2019, 2, 6, "use code_labelt(label, _code) instead"))
1381-
explicit code_labelt(const irep_idt &_label):codet(ID_label)
1382-
{
1383-
operands().resize(1);
1384-
set_label(_label);
1385-
}
1386-
13871377
code_labelt(const irep_idt &_label, codet _code)
13881378
: codet(ID_label, {std::move(_code)})
13891379
{

0 commit comments

Comments
 (0)