@@ -94,11 +94,6 @@ class BaseCCPPVisitor : public ASR::BaseVisitor<Struct>
94
94
template_number{0 }, c_ds_api{std::make_unique<CCPPDSUtils>()},
95
95
const_name{" constname" },
96
96
const_list_count{0 }, is_string_concat_present{false } {
97
- if ( is_c ) {
98
- c_ds_api->set_deepcopy_function (&CUtils::deepcopy);
99
- } else {
100
- c_ds_api->set_deepcopy_function (&CPPUtils::deepcopy);
101
- }
102
97
}
103
98
104
99
void visit_TranslationUnit (const ASR::TranslationUnit_t &x) {
@@ -706,9 +701,9 @@ R"(#include <stdio.h>
706
701
alloc = indent + target + " = " + " (char *) malloc((strlen(" +
707
702
value + " ) + 1 ) * sizeof(char));\n " ;
708
703
}
709
- src += alloc + indent + CUtils::deepcopy (target , value, m_target_type ) + " \n " ;
704
+ src += alloc + indent + c_ds_api-> get_deepcopy (m_target_type , value, target ) + " \n " ;
710
705
} else {
711
- src += indent + CPPUtils::deepcopy (target , value, m_target_type ) + " \n " ;
706
+ src += indent + c_ds_api-> get_deepcopy (m_target_type , value, target ) + " \n " ;
712
707
}
713
708
}
714
709
from_std_vector_helper.clear ();
@@ -779,11 +774,8 @@ R"(#include <stdio.h>
779
774
if ( ASR::is_a<ASR::Character_t>(*t->m_type ) ) {
780
775
src_tmp += const_name + " .data[" + std::to_string (i) +" ] = (char*) malloc(40 * sizeof(char));\n " ;
781
776
}
782
- if ( is_c ) {
783
- src_tmp += indent + CUtils::deepcopy (const_name + " .data[" + std::to_string (i) +" ]" , src, t->m_type ) + " \n " ;
784
- } else {
785
- src_tmp += indent + CPPUtils::deepcopy (const_name + " .data[" + std::to_string (i) +" ]" , src, t->m_type ) + " \n " ;
786
- }
777
+ src_tmp += indent + c_ds_api->get_deepcopy (t->m_type , src,
778
+ const_name + " .data[" + std::to_string (i) +" ]" ) + " \n " ;
787
779
}
788
780
src_tmp += indent + const_name + " .current_end_point = " + std::to_string (x.n_args ) + " ;\n " ;
789
781
src = src_tmp;
@@ -805,11 +797,7 @@ R"(#include <stdio.h>
805
797
if (ASR::is_a<ASR::Character_t>(*t->m_type [i])) {
806
798
src_tmp += indent + const_name + ele + " = (char*) malloc(40 * sizeof(char));\n " ;
807
799
}
808
- if (is_c) {
809
- src_tmp += indent + CUtils::deepcopy (const_name + ele , src, t->m_type [i]) + " \n " ;
810
- } else {
811
- src_tmp += indent + CPPUtils::deepcopy (const_name + ele, src, t->m_type [i]) + " \n " ;
812
- }
800
+ src_tmp += indent + c_ds_api->get_deepcopy (t->m_type [i], src, const_name + ele) + " \n " ;
813
801
}
814
802
src_tmp += indent + const_name + " .length" + " = " + std::to_string (x.n_elements ) + " ;\n " ;
815
803
src = src_tmp;
0 commit comments