Skip to content

Commit f154840

Browse files
committed
Delete copy constructor of class java_bytecode_parse_treet.
This deletes the default copy constructor of `java_bytecode_parse_treet`, but allows move construction. This enforces allowing move semantics only and prevents accidental copying.
1 parent c5cbcec commit f154840

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jbmc/src/java_bytecode/java_bytecode_parse_tree.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ Author: Daniel Kroening, [email protected]
2222
class java_bytecode_parse_treet
2323
{
2424
public:
25+
// Disallow copy construction and copy assignment, but allow move construction
26+
// and move assignment.
27+
#ifndef _MSC_VER // Ommit this on MS VC2013 as move is not supported.
28+
java_bytecode_parse_treet(const java_bytecode_parse_treet &) = delete;
29+
java_bytecode_parse_treet &
30+
operator=(const java_bytecode_parse_treet &) = delete;
31+
java_bytecode_parse_treet(java_bytecode_parse_treet &&) = default;
32+
java_bytecode_parse_treet &operator=(java_bytecode_parse_treet &&) = default;
33+
#endif
34+
2535
virtual ~java_bytecode_parse_treet() = default;
2636
class annotationt
2737
{
@@ -178,6 +188,17 @@ class java_bytecode_parse_treet
178188
class classt
179189
{
180190
public:
191+
classt() = default;
192+
193+
// Disallow copy construction and copy assignment, but allow move
194+
// construction and move assignment.
195+
#ifndef _MSC_VER // Ommit this on MS VC2013 as move is not supported.
196+
classt(const classt &) = delete;
197+
classt &operator=(const classt &) = delete;
198+
classt(classt &&) = default;
199+
classt &operator=(classt &&) = default;
200+
#endif
201+
181202
irep_idt name, extends;
182203
bool is_abstract=false;
183204
bool is_enum=false;

0 commit comments

Comments
 (0)