@@ -104,7 +104,7 @@ dictionary_builder::clone_instruction(const template_instruction *src_inst) {
104
104
<< template_name_info (src_inst->name ()));
105
105
}
106
106
107
- auto dest = new (alloc_) template_instruction (*src_inst );
107
+ auto dest = src_inst-> clone (alloc_);
108
108
109
109
const char *ns = src_inst->ns ();
110
110
if (is_empty_string (ns)) {
@@ -127,21 +127,21 @@ void dictionary_builder::visit(const template_instruction *src_inst,
127
127
}
128
128
}
129
129
130
- void dictionary_builder::visit (const templateref_instruction * /* src_inst*/ ,
130
+ void dictionary_builder::visit (const templateref_instruction * src_inst,
131
131
void *dest_inst) {
132
132
templateref_instruction *&dest =
133
133
*static_cast <templateref_instruction **>(dest_inst);
134
134
135
135
// this is dynamic templateRef, it can only be binded at decoding time
136
- dest = new (alloc_) templateref_instruction ;
136
+ dest = src_inst-> clone (alloc_);
137
137
}
138
138
139
139
void dictionary_builder::visit (const group_field_instruction *src_inst,
140
140
void *dest_inst) {
141
141
group_field_instruction *&dest =
142
142
*static_cast <group_field_instruction **>(dest_inst);
143
143
144
- dest = new (alloc_) group_field_instruction (*src_inst );
144
+ dest = src_inst-> clone (alloc_);
145
145
146
146
this ->build_group (src_inst, src_inst, dest);
147
147
}
@@ -150,7 +150,7 @@ void dictionary_builder::visit(const sequence_field_instruction *src_inst,
150
150
void *dest_inst) {
151
151
sequence_field_instruction *&dest =
152
152
*static_cast <sequence_field_instruction **>(dest_inst);
153
- dest = new (alloc_) sequence_field_instruction (*src_inst );
153
+ dest = src_inst-> clone (alloc_);
154
154
155
155
this ->build_group (src_inst, src_inst, dest);
156
156
@@ -248,7 +248,7 @@ void dictionary_builder::visit(const int32_field_instruction *src_inst,
248
248
void *dest_inst) {
249
249
int32_field_instruction *&dest =
250
250
*static_cast <int32_field_instruction **>(dest_inst);
251
- dest = new (alloc_) int32_field_instruction (*src_inst );
251
+ dest = src_inst-> clone (alloc_);
252
252
dest->prev_value_ =
253
253
get_dictionary_storage (dest->name (), dest->ns (), dest->op_context_ ,
254
254
field_type_int32, &dest->prev_storage_ , dest);
@@ -258,7 +258,7 @@ void dictionary_builder::visit(const uint32_field_instruction *src_inst,
258
258
void *dest_inst) {
259
259
uint32_field_instruction *&dest =
260
260
*static_cast <uint32_field_instruction **>(dest_inst);
261
- dest = new (alloc_) uint32_field_instruction (*src_inst );
261
+ dest = src_inst-> clone (alloc_);
262
262
dest->prev_value_ =
263
263
get_dictionary_storage (dest->name (), dest->ns (), dest->op_context_ ,
264
264
field_type_uint32, &dest->prev_storage_ , dest);
@@ -268,7 +268,7 @@ void dictionary_builder::visit(const int64_field_instruction *src_inst,
268
268
void *dest_inst) {
269
269
int64_field_instruction *&dest =
270
270
*static_cast <int64_field_instruction **>(dest_inst);
271
- dest = new (alloc_) int64_field_instruction (*src_inst );
271
+ dest = src_inst-> clone (alloc_);
272
272
dest->prev_value_ =
273
273
get_dictionary_storage (dest->name (), dest->ns (), dest->op_context_ ,
274
274
field_type_int64, &dest->prev_storage_ , dest);
@@ -278,7 +278,7 @@ void dictionary_builder::visit(const uint64_field_instruction *src_inst,
278
278
void *dest_inst) {
279
279
uint64_field_instruction *&dest =
280
280
*static_cast <uint64_field_instruction **>(dest_inst);
281
- dest = new (alloc_) uint64_field_instruction (*src_inst );
281
+ dest = src_inst-> clone (alloc_);
282
282
dest->prev_value_ =
283
283
get_dictionary_storage (dest->name (), dest->ns (), dest->op_context_ ,
284
284
field_type_uint64, &dest->prev_storage_ , dest);
@@ -288,7 +288,7 @@ void dictionary_builder::visit(const ascii_field_instruction *src_inst,
288
288
void *dest_inst) {
289
289
ascii_field_instruction *&dest =
290
290
*static_cast <ascii_field_instruction **>(dest_inst);
291
- dest = new (alloc_) ascii_field_instruction (*src_inst );
291
+ dest = src_inst-> clone (alloc_);
292
292
dest->prev_value_ = get_dictionary_storage (
293
293
dest->name (), dest->ns (), dest->op_context_ , field_type_ascii_string,
294
294
&dest->prev_storage_ , dest);
@@ -299,7 +299,7 @@ void dictionary_builder::visit(const unicode_field_instruction *src_inst,
299
299
void *dest_inst) {
300
300
unicode_field_instruction *&dest =
301
301
*static_cast <unicode_field_instruction **>(dest_inst);
302
- dest = new (alloc_) unicode_field_instruction (*src_inst );
302
+ dest = src_inst-> clone (alloc_);
303
303
dest->prev_value_ = get_dictionary_storage (
304
304
dest->name (), dest->ns (), dest->op_context_ , field_type_unicode_string,
305
305
&dest->prev_storage_ , dest);
@@ -311,7 +311,7 @@ void dictionary_builder::visit(const decimal_field_instruction *src_inst,
311
311
void *dest_inst) {
312
312
decimal_field_instruction *&dest =
313
313
*static_cast <decimal_field_instruction **>(dest_inst);
314
- dest = new (alloc_) decimal_field_instruction (*src_inst );
314
+ dest = src_inst-> clone (alloc_);
315
315
316
316
if (src_inst->field_type () == field_type_decimal) {
317
317
dest->prev_value_ =
@@ -341,7 +341,7 @@ void dictionary_builder::visit(const byte_vector_field_instruction *src_inst,
341
341
void *dest_inst) {
342
342
byte_vector_field_instruction *&dest =
343
343
*static_cast <byte_vector_field_instruction **>(dest_inst);
344
- dest = new (alloc_) byte_vector_field_instruction (*src_inst );
344
+ dest = src_inst-> clone (alloc_);
345
345
dest->prev_value_ = get_dictionary_storage (
346
346
dest->name (), dest->ns (), dest->op_context (), field_type_byte_vector,
347
347
&dest->prev_storage_ , dest);
@@ -352,35 +352,35 @@ void dictionary_builder::visit(const int32_vector_field_instruction *src_inst,
352
352
void *dest_inst) {
353
353
int32_vector_field_instruction *&dest =
354
354
*static_cast <int32_vector_field_instruction **>(dest_inst);
355
- dest = new (alloc_) int32_vector_field_instruction (*src_inst );
355
+ dest = src_inst-> clone (alloc_);
356
356
}
357
357
358
358
void dictionary_builder::visit (const uint32_vector_field_instruction *src_inst,
359
359
void *dest_inst) {
360
360
uint32_vector_field_instruction *&dest =
361
361
*static_cast <uint32_vector_field_instruction **>(dest_inst);
362
- dest = new (alloc_) uint32_vector_field_instruction (*src_inst );
362
+ dest = src_inst-> clone (alloc_);
363
363
}
364
364
365
365
void dictionary_builder::visit (const int64_vector_field_instruction *src_inst,
366
366
void *dest_inst) {
367
367
int64_vector_field_instruction *&dest =
368
368
*static_cast <int64_vector_field_instruction **>(dest_inst);
369
- dest = new (alloc_) int64_vector_field_instruction (*src_inst );
369
+ dest = src_inst-> clone (alloc_);
370
370
}
371
371
372
372
void dictionary_builder::visit (const uint64_vector_field_instruction *src_inst,
373
373
void *dest_inst) {
374
374
uint64_vector_field_instruction *&dest =
375
375
*static_cast <uint64_vector_field_instruction **>(dest_inst);
376
- dest = new (alloc_) uint64_vector_field_instruction (*src_inst );
376
+ dest = src_inst-> clone (alloc_);
377
377
}
378
378
379
379
void dictionary_builder::visit (const enum_field_instruction *src_inst,
380
380
void *dest_inst) {
381
381
enum_field_instruction *&dest =
382
382
*static_cast <enum_field_instruction **>(dest_inst);
383
- dest = new (alloc_) enum_field_instruction (*src_inst );
383
+ dest = src_inst-> clone (alloc_);
384
384
dest->prev_value_ =
385
385
get_dictionary_storage (dest->name (), dest->ns (), dest->op_context_ ,
386
386
field_type_uint64, &dest->prev_storage_ , dest);
0 commit comments