From ac0c49cf3047091626587c0351abc037cbb58308 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 11 Feb 2024 06:47:50 +0530 Subject: [PATCH 1/4] ASR: Remove Const ttype --- src/libasr/ASR.asdl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libasr/ASR.asdl b/src/libasr/ASR.asdl index d31b2d9..f61430d 100644 --- a/src/libasr/ASR.asdl +++ b/src/libasr/ASR.asdl @@ -200,7 +200,6 @@ ttype | Dict(ttype key_type, ttype value_type) | Pointer(ttype type) | Allocatable(ttype type) - | Const(ttype type) | CPtr() | SymbolicExpression() | TypeParameter(identifier param) From cbd45af7310dae8831918fe06fe90bf03fcc791d Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Sun, 11 Feb 2024 06:48:17 +0530 Subject: [PATCH 2/4] Update all places to remove const Remove more const related code --- src/libasr/asr_utils.h | 71 ++----------------- src/libasr/asr_verify.cpp | 16 +++-- src/libasr/casting_utils.cpp | 9 --- src/libasr/codegen/asr_to_c.cpp | 15 ++-- src/libasr/codegen/asr_to_c_cpp.h | 14 +--- src/libasr/codegen/asr_to_llvm.cpp | 22 ++---- src/libasr/codegen/asr_to_wasm.cpp | 8 +-- src/libasr/codegen/c_utils.h | 9 --- src/libasr/codegen/llvm_utils.cpp | 21 ------ .../intrinsic_func_registry_util_gen.py | 2 +- src/libasr/pass/inline_function_calls.cpp | 4 -- src/libasr/pass/intrinsic_functions.h | 6 +- 12 files changed, 32 insertions(+), 165 deletions(-) diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index 9edf568..b2682d3 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -152,17 +152,6 @@ static inline const ASR::symbol_t *symbol_get_past_external(const ASR::symbol_t } } -static inline ASR::ttype_t *type_get_past_const(ASR::ttype_t *f) -{ - if (ASR::is_a(*f)) { - ASR::Const_t *e = ASR::down_cast(f); - LCOMPILERS_ASSERT(!ASR::is_a(*e->m_type)); - return e->m_type; - } else { - return f; - } -} - static inline ASR::ttype_t *type_get_past_pointer(ASR::ttype_t *f) { if (ASR::is_a(*f)) { @@ -227,9 +216,6 @@ static inline int extract_kind_from_ttype_t(const ASR::ttype_t* type) { case ASR::ttypeType::Allocatable: { return extract_kind_from_ttype_t(ASR::down_cast(type)->m_type); } - case ASR::ttypeType::Const: { - return extract_kind_from_ttype_t(ASR::down_cast(type)->m_type); - } default : { return -1; } @@ -277,10 +263,6 @@ static inline void set_kind_to_ttype_t(ASR::ttype_t* type, int kind) { set_kind_to_ttype_t(ASR::down_cast(type)->m_type, kind); break; } - case ASR::ttypeType::Const: { - set_kind_to_ttype_t(ASR::down_cast(type)->m_type, kind); - break; - } default : { return; } @@ -392,10 +374,6 @@ static inline ASR::ttype_t* get_contained_type(ASR::ttype_t* asr_type, int overl ASR::Allocatable_t* pointer_asr = ASR::down_cast(asr_type); return pointer_asr->m_type; } - case ASR::ttypeType::Const: { - ASR::Const_t* const_asr = ASR::down_cast(asr_type); - return const_asr->m_type; - } default: { return asr_type; } @@ -602,10 +580,6 @@ static inline std::string type_to_str(const ASR::ttype_t *t) encode_dimensions(array_t->n_dims, res, false); return res; } - case ASR::ttypeType::Const: { - return type_to_str(ASRUtils::get_contained_type( - const_cast(t))) + " const"; - } case ASR::ttypeType::TypeParameter: { ASR::TypeParameter_t* tp = ASR::down_cast(t); return tp->m_param; @@ -660,10 +634,6 @@ static inline std::string type_to_str_with_substitution(const ASR::ttype_t *t, encode_dimensions(array_t->n_dims, res, false); return res; } - case ASR::ttypeType::Const: { - return type_to_str_with_substitution(ASRUtils::get_contained_type( - const_cast(t)), subs) + " const"; - } case ASR::ttypeType::FunctionType: { ASR::FunctionType_t* ftp = ASR::down_cast(t); std::string result = "("; @@ -1552,15 +1522,6 @@ static inline std::string get_type_code(const ASR::ttype_t *t, bool use_undersco return "Allocatable[" + get_type_code(p->m_type, use_underscore_sep, encode_dimensions_, set_dimensional_hint) + "]"; } - case ASR::ttypeType::Const: { - ASR::Const_t* p = ASR::down_cast(t); - if( use_underscore_sep ) { - return "Const_" + get_type_code(p->m_type, use_underscore_sep, - encode_dimensions_, set_dimensional_hint) + "_"; - } - return "Const[" + get_type_code(p->m_type, use_underscore_sep, - encode_dimensions_, set_dimensional_hint) + "]"; - } case ASR::ttypeType::SymbolicExpression: { return "S"; } @@ -1694,10 +1655,6 @@ static inline std::string type_to_str_python(const ASR::ttype_t *t, ASR::Allocatable_t* p = ASR::down_cast(t); return "Allocatable[" + type_to_str_python(p->m_type) + "]"; } - case ASR::ttypeType::Const: { - ASR::Const_t* p = ASR::down_cast(t); - return "Const[" + type_to_str_python(p->m_type) + "]"; - } case ASR::ttypeType::TypeParameter: { ASR::TypeParameter_t *p = ASR::down_cast(t); return p->m_param; @@ -2014,11 +1971,9 @@ static inline bool is_pointer(ASR::ttype_t *x) { static inline bool is_integer(ASR::ttype_t &x) { return ASR::is_a( - *type_get_past_const( - type_get_past_array( + *type_get_past_array( type_get_past_allocatable( - type_get_past_pointer( - type_get_past_const(&x)))))); + type_get_past_pointer(&x)))); } static inline bool is_unsigned_integer(ASR::ttype_t &x) { @@ -2165,10 +2120,6 @@ inline size_t extract_dimensions_from_ttype(ASR::ttype_t *x, n_dims = extract_dimensions_from_ttype(ASR::down_cast(x)->m_type, m_dims); break; } - case ASR::ttypeType::Const: { - n_dims = extract_dimensions_from_ttype(ASR::down_cast(x)->m_type, m_dims); - break; - } case ASR::ttypeType::SymbolicExpression: case ASR::ttypeType::Integer: case ASR::ttypeType::UnsignedInteger: @@ -2464,9 +2415,6 @@ inline bool is_array(ASR::ttype_t *x) { } static inline bool is_aggregate_type(ASR::ttype_t* asr_type) { - if( ASR::is_a(*asr_type) ) { - asr_type = ASR::down_cast(asr_type)->m_type; - } return ASRUtils::is_array(asr_type) || !(ASR::is_a(*asr_type) || ASR::is_a(*asr_type) || @@ -2569,12 +2517,6 @@ static inline ASR::ttype_t* duplicate_type(Allocator& al, const ASR::ttype_t* t, ASR::CPtr_t* ptr = ASR::down_cast(t); return ASRUtils::TYPE(ASR::make_CPtr_t(al, ptr->base.base.loc)); } - case ASR::ttypeType::Const: { - ASR::Const_t* c = ASR::down_cast(t); - ASR::ttype_t* dup_type = duplicate_type(al, c->m_type, dims); - return ASRUtils::TYPE(ASR::make_Const_t(al, c->base.base.loc, - dup_type)); - } case ASR::ttypeType::List: { ASR::List_t* l = ASR::down_cast(t); ASR::ttype_t* dup_type = duplicate_type(al, l->m_type); @@ -3428,11 +3370,6 @@ inline bool check_equal_type(ASR::ttype_t* x, ASR::ttype_t* y, bool check_for_di x = ASRUtils::type_get_past_allocatable(x); y = ASRUtils::type_get_past_allocatable(y); return check_equal_type(x, y); - } else if(ASR::is_a(*x) || - ASR::is_a(*y)) { - x = ASRUtils::get_contained_type(x); - y = ASRUtils::get_contained_type(y); - return check_equal_type(x, y); } else if (ASR::is_a(*x) && ASR::is_a(*y)) { x = ASR::down_cast(x)->m_type; y = ASR::down_cast(y)->m_type; @@ -5175,9 +5112,9 @@ static inline void Call_t_body(Allocator& al, ASR::symbol_t* a_name, } if( ASRUtils::is_array(arg_type) && ASRUtils::is_array(orig_arg_type) ) { ASR::Array_t* arg_array_t = ASR::down_cast( - ASRUtils::type_get_past_pointer(ASRUtils::type_get_past_const(arg_type))); + ASRUtils::type_get_past_pointer(arg_type)); ASR::Array_t* orig_arg_array_t = ASR::down_cast( - ASRUtils::type_get_past_pointer(ASRUtils::type_get_past_const(orig_arg_type))); + ASRUtils::type_get_past_pointer(orig_arg_type)); if( (arg_array_t->m_physical_type != orig_arg_array_t->m_physical_type) || (arg_array_t->m_physical_type == ASR::array_physical_typeType::DescriptorArray && arg_array_t->m_physical_type == orig_arg_array_t->m_physical_type && diff --git a/src/libasr/asr_verify.cpp b/src/libasr/asr_verify.cpp index a081f93..3ea117b 100644 --- a/src/libasr/asr_verify.cpp +++ b/src/libasr/asr_verify.cpp @@ -359,13 +359,15 @@ class VerifyVisitor : public BaseWalkVisitor ASR::expr_t* target = x.m_target; if( ASR::is_a(*target) ) { ASR::Var_t* target_Var = ASR::down_cast(target); + bool is_target_const = false; ASR::ttype_t* target_type = nullptr; - if( ASR::is_a(*target_Var->m_v) || - (ASR::is_a(*target_Var->m_v) && - ASR::down_cast(target_Var->m_v)->m_external) ) { - target_type = ASRUtils::expr_type(target); + ASR::symbol_t* target_sym = ASRUtils::symbol_get_past_external(target_Var->m_v); + if( target_sym && ASR::is_a(*target_sym) ) { + ASR::Variable_t* var = ASR::down_cast(target_sym); + target_type = var->m_type; + is_target_const = var->m_storage == ASR::storage_typeType::Parameter; } - if( target_type && ASR::is_a(*target_type) ) { + if( is_target_const ) { std::string variable_name = ASRUtils::symbol_name(target_Var->m_v); require(const_assigned.find(std::make_pair(current_symtab->counter, variable_name)) == const_assigned.end(), @@ -1159,14 +1161,14 @@ class VerifyVisitor : public BaseWalkVisitor void visit_dimension(const dimension_t &x) { if (x.m_start) { require_with_loc(ASRUtils::is_integer( - *ASRUtils::type_get_past_const(ASRUtils::expr_type(x.m_start))), + *ASRUtils::expr_type(x.m_start)), "Start dimension must be a signed integer", x.loc); visit_expr(*x.m_start); } if (x.m_length) { require_with_loc(ASRUtils::is_integer( - *ASRUtils::type_get_past_const(ASRUtils::expr_type(x.m_length))), + *ASRUtils::expr_type(x.m_length)), "Length dimension must be a signed integer", x.loc); visit_expr(*x.m_length); } diff --git a/src/libasr/casting_utils.cpp b/src/libasr/casting_utils.cpp index 44ea0d2..c2ac43e 100644 --- a/src/libasr/casting_utils.cpp +++ b/src/libasr/casting_utils.cpp @@ -58,12 +58,6 @@ namespace LCompilers::CastingUtil { bool is_assign, bool allow_int_to_float) { ASR::ttype_t* left_type = ASRUtils::expr_type(left_expr); ASR::ttype_t* right_type = ASRUtils::expr_type(right_expr); - if( ASR::is_a(*left_type) ) { - left_type = ASRUtils::get_contained_type(left_type); - } - if( ASR::is_a(*right_type) ) { - right_type = ASRUtils::get_contained_type(right_type); - } left_type = ASRUtils::type_get_past_pointer(left_type); right_type = ASRUtils::type_get_past_pointer(right_type); if( ASRUtils::check_equal_type(left_type, right_type) || @@ -120,9 +114,6 @@ namespace LCompilers::CastingUtil { ASR::ttype_t* dest, Allocator& al, const Location& loc) { ASR::ttype_t* src = ASRUtils::expr_type(expr); - if( ASR::is_a(*src) ) { - src = ASRUtils::get_contained_type(src); - } ASR::ttypeType src_type = ASRUtils::extract_type(src)->type; ASR::ttypeType dest_type = ASRUtils::extract_type(dest)->type; ASR::cast_kindType cast_kind; diff --git a/src/libasr/codegen/asr_to_c.cpp b/src/libasr/codegen/asr_to_c.cpp index 8df1f9d..36631db 100644 --- a/src/libasr/codegen/asr_to_c.cpp +++ b/src/libasr/codegen/asr_to_c.cpp @@ -275,11 +275,6 @@ class ASRToCVisitor : public BaseCCPPVisitor ASR::dimension_t* m_dims = nullptr; size_t n_dims = ASRUtils::extract_dimensions_from_ttype(v.m_type, m_dims); ASR::ttype_t* v_m_type = v.m_type; - if (ASR::is_a(*v_m_type)) { - if( is_array ) { - v_m_type = ASR::down_cast(v_m_type)->m_type; - } - } v_m_type = ASRUtils::type_get_past_array(ASRUtils::type_get_past_allocatable(v_m_type)); if (ASRUtils::is_pointer(v_m_type)) { ASR::ttype_t *t2 = ASR::down_cast(v_m_type)->m_type; @@ -546,10 +541,8 @@ class ASRToCVisitor : public BaseCCPPVisitor ASR::Enum_t* enum_ = ASR::down_cast(v_m_type); ASR::EnumType_t* enum_type = ASR::down_cast(enum_->m_enum_type); sub = format_type_c("", "enum " + std::string(enum_type->m_name), v.m_name, false, false); - } else if (ASR::is_a(*v_m_type)) { - std::string const_underlying_type = CUtils::get_c_type_from_ttype_t( - ASRUtils::type_get_past_const(v_m_type)); - sub = format_type_c("", "const " + const_underlying_type, + } else if (v.m_storage == ASR::storage_typeType::Parameter) { + sub = format_type_c("", "const " + CUtils::get_c_type_from_ttype_t(v_m_type), v.m_name, false, false); } else if (ASR::is_a(*v_m_type)) { // Ignore type variables @@ -565,7 +558,7 @@ class ASRToCVisitor : public BaseCCPPVisitor } if (dims.size() == 0 && v.m_symbolic_value && !do_not_initialize) { ASR::expr_t* init_expr = v.m_symbolic_value; - if( !ASR::is_a(*v.m_type) ) { + if( v.m_storage != ASR::storage_typeType::Parameter ) { for( size_t i = 0; i < v.n_dependencies; i++ ) { std::string variable_name = v.m_dependencies[i]; ASR::symbol_t* dep_sym = current_scope->resolve_symbol(variable_name); @@ -1367,7 +1360,7 @@ R"( // Initialise Numpy } ASR::ttype_t* x_mv_type_ = ASRUtils::type_get_past_allocatable( - ASRUtils::type_get_past_pointer(ASRUtils::type_get_past_const(x_mv_type))); + ASRUtils::type_get_past_pointer(x_mv_type)); LCOMPILERS_ASSERT(ASR::is_a(*x_mv_type_)); ASR::Array_t* array_t = ASR::down_cast(x_mv_type_); std::vector diminfo; diff --git a/src/libasr/codegen/asr_to_c_cpp.h b/src/libasr/codegen/asr_to_c_cpp.h index cd8d0cb..682d877 100644 --- a/src/libasr/codegen/asr_to_c_cpp.h +++ b/src/libasr/codegen/asr_to_c_cpp.h @@ -311,7 +311,7 @@ R"(#include ASR::Variable_t *v = ASR::down_cast(var_sym); std::string decl = self().convert_variable_decl(*v); decl = check_tmp_buffer() + decl; - bool used_define_for_const = (ASR::is_a(*v->m_type) && + bool used_define_for_const = (v->m_storage == ASR::storage_typeType::Parameter && v->m_intent == ASRUtils::intent_local); if (used_define_for_const) { contains += decl + "\n"; @@ -496,10 +496,8 @@ R"(#include } else if (ASR::is_a(*return_var->m_type)) { ASR::Tuple_t* tup_type = ASR::down_cast(return_var->m_type); sub = c_ds_api->get_tuple_type(tup_type) + " "; - } else if (ASR::is_a(*return_var->m_type)) { - ASR::Const_t* const_type = ASR::down_cast(return_var->m_type); - std::string const_type_str = CUtils::get_c_type_from_ttype_t(const_type->m_type); - sub = "const " + const_type_str + " "; + } else if (return_var->m_storage == ASR::storage_typeType::Parameter) { + sub = "const " + CUtils::get_c_type_from_ttype_t(return_var->m_type) + " "; } else if (ASR::is_a(*return_var->m_type)) { ASR::Pointer_t* ptr_type = ASR::down_cast(return_var->m_type); std::string pointer_type_str = CUtils::get_c_type_from_ttype_t(ptr_type->m_type); @@ -721,8 +719,6 @@ R"(#include } } case ASR::ttypeType::Logical : { return "p"; - } case ASR::ttypeType::Const : { - return get_type_format(ASR::down_cast(type)->m_type); } case ASR::ttypeType::Array : { return "O"; } default: { @@ -1252,10 +1248,6 @@ PyMODINIT_FUNC PyInit_lpython_module_)" + fn_name + R"((void) { void visit_Assignment(const ASR::Assignment_t &x) { std::string target; ASR::ttype_t* m_target_type = ASRUtils::expr_type(x.m_target); - if( ASR::is_a(*m_target_type) ) { - src = ""; - return ; - } ASR::ttype_t* m_value_type = ASRUtils::expr_type(x.m_value); bool is_target_list = ASR::is_a(*m_target_type); bool is_value_list = ASR::is_a(*m_value_type); diff --git a/src/libasr/codegen/asr_to_llvm.cpp b/src/libasr/codegen/asr_to_llvm.cpp index 4f9f34d..e758a60 100644 --- a/src/libasr/codegen/asr_to_llvm.cpp +++ b/src/libasr/codegen/asr_to_llvm.cpp @@ -1730,7 +1730,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } void visit_ListCount(const ASR::ListCount_t& x) { - ASR::ttype_t *asr_el_type = ASRUtils::get_contained_type(ASRUtils::type_get_past_const(ASRUtils::expr_type(x.m_arg))); + ASR::ttype_t *asr_el_type = ASRUtils::get_contained_type(ASRUtils::expr_type(x.m_arg)); int64_t ptr_loads_copy = ptr_loads; ptr_loads = 0; this->visit_expr(*x.m_arg); @@ -1745,7 +1745,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor void generate_ListIndex(ASR::expr_t* m_arg, ASR::expr_t* m_ele, ASR::expr_t* m_start=nullptr, ASR::expr_t* m_end=nullptr) { - ASR::ttype_t *asr_el_type = ASRUtils::get_contained_type(ASRUtils::type_get_past_const(ASRUtils::expr_type(m_arg))); + ASR::ttype_t *asr_el_type = ASRUtils::get_contained_type(ASRUtils::expr_type(m_arg)); int64_t ptr_loads_copy = ptr_loads; ptr_loads = 0; this->visit_expr(*m_arg); @@ -2320,7 +2320,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } ASR::ttype_t* x_mv_type_ = ASRUtils::type_get_past_allocatable( - ASRUtils::type_get_past_pointer(ASRUtils::type_get_past_const(x_mv_type))); + ASRUtils::type_get_past_pointer(x_mv_type)); LCOMPILERS_ASSERT(ASR::is_a(*x_mv_type_)); ASR::Array_t* array_t = ASR::down_cast(x_mv_type_); bool is_bindc_array = ASRUtils::expr_abi(x.m_v) == ASR::abiType::BindC; @@ -3547,7 +3547,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor is_malloc_array_type, is_array_type, is_list, v->m_type); } ASR::expr_t* init_expr = v->m_symbolic_value; - if( !ASR::is_a(*v->m_type) ) { + if( v->m_storage != ASR::storage_typeType::Parameter ) { for( size_t i = 0; i < v->n_dependencies; i++ ) { std::string variable_name = v->m_dependencies[i]; ASR::symbol_t* dep_sym = x.m_symtab->resolve_symbol(variable_name); @@ -3642,7 +3642,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor throw CodeGenError("Unsupported len value in ASR " + std::to_string(strlen)); } } else if (is_list) { - ASR::List_t* asr_list = ASR::down_cast(ASRUtils::type_get_past_const(v->m_type)); + ASR::List_t* asr_list = ASR::down_cast(v->m_type); std::string type_code = ASRUtils::get_type_code(asr_list->m_type); list_api->list_init(type_code, ptr, *module); } @@ -6653,8 +6653,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor this->visit_expr_wrapper(x->m_value, true); return; } - ASR::ttype_t *t2_ = ASRUtils::type_get_past_const( - ASRUtils::type_get_past_array(x->m_type)); + ASR::ttype_t *t2_ = ASRUtils::type_get_past_array(x->m_type); switch( t2_->type ) { case ASR::ttypeType::Pointer: case ASR::ttypeType::Allocatable: { @@ -7824,9 +7823,6 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } load_non_array_non_character_pointers(v, ASRUtils::expr_type(v), tmp); - if( ASR::is_a(*t) ) { - t = ASRUtils::get_contained_type(t); - } t = ASRUtils::type_get_past_allocatable(ASRUtils::type_get_past_pointer(t)); int a_kind = ASRUtils::extract_kind_from_ttype_t(t); @@ -8153,7 +8149,7 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor } } else if ( x_abi == ASR::abiType::BindC ) { if (orig_arg->m_abi == ASR::abiType::BindC && orig_arg->m_value_attr) { - ASR::ttype_t* arg_type = ASRUtils::type_get_past_const(arg->m_type); + ASR::ttype_t* arg_type = arg->m_type; if (ASR::is_a(*arg_type)) { int c_kind = ASRUtils::extract_kind_from_ttype_t(arg_type); if (c_kind == 4) { @@ -8406,10 +8402,6 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor target_type = llvm_utils->get_type_from_ttype_t_util(arg_type_, module.get()); break; } - case (ASR::ttypeType::Const): { - target_type = llvm_utils->get_type_from_ttype_t_util(ASRUtils::get_contained_type(arg_type), module.get()); - break; - } default : throw CodeGenError("Type " + ASRUtils::type_to_str(arg_type) + " not implemented yet."); } diff --git a/src/libasr/codegen/asr_to_wasm.cpp b/src/libasr/codegen/asr_to_wasm.cpp index 8ca62ff..1056262 100644 --- a/src/libasr/codegen/asr_to_wasm.cpp +++ b/src/libasr/codegen/asr_to_wasm.cpp @@ -653,9 +653,8 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { using namespace wasm; uint32_t global_var_idx = UINT_MAX; - ASR::ttype_t* ttype = ASRUtils::type_get_past_const(v->m_type); - ASR::ttype_t* v_m_type = ASRUtils::type_get_past_array(ttype); - int kind = ASRUtils::extract_kind_from_ttype_t(ttype); + ASR::ttype_t* v_m_type = ASRUtils::type_get_past_array(v->m_type); + int kind = ASRUtils::extract_kind_from_ttype_t(v->m_type); switch (v_m_type->type){ case ASR::ttypeType::Integer: { uint64_t init_val = 0; @@ -881,7 +880,6 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { } } else { ASR::ttype_t* ttype = v->m_type; - ttype = ASRUtils::type_get_past_const(ttype); if (ASRUtils::is_integer(*ttype)) { ASR::Integer_t *v_int = ASR::down_cast(ASRUtils::type_get_past_array(ttype)); @@ -2148,7 +2146,6 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { const ASR::symbol_t *s = ASRUtils::symbol_get_past_external(x.m_v); auto v = ASR::down_cast(s); ASR::ttype_t* ttype = ASRUtils::type_get_past_array(v->m_type); - ttype = ASRUtils::type_get_past_const(ttype); switch (ttype->type) { case ASR::ttypeType::Integer: case ASR::ttypeType::Logical: @@ -2957,7 +2954,6 @@ class ASRToWASMVisitor : public ASR::BaseVisitor { } ASR::expr_t *v = x.m_values[i]; ASR::ttype_t *t = ASRUtils::expr_type(v); - t = ASRUtils::type_get_past_const(t); int a_kind = ASRUtils::extract_kind_from_ttype_t(t); if (ASRUtils::is_integer(*t) || ASRUtils::is_logical(*t)) { diff --git a/src/libasr/codegen/c_utils.h b/src/libasr/codegen/c_utils.h index b21d7b2..feff3ac 100644 --- a/src/libasr/codegen/c_utils.h +++ b/src/libasr/codegen/c_utils.h @@ -290,11 +290,6 @@ namespace CUtils { type_src = get_c_type_from_ttype_t(ptr_type->m_type) + "*"; break; } - case ASR::ttypeType::Const: { - ASR::Const_t* ptr_type = ASR::down_cast(t); - type_src = "const " + get_c_type_from_ttype_t(ptr_type->m_type); - break; - } case ASR::ttypeType::CPtr: { type_src = "void*"; break; @@ -532,10 +527,6 @@ class CCPPDSUtils { ASR::ttype_t* enum_underlying_type = ASRUtils::get_contained_type(t); return get_print_type(enum_underlying_type, deref_ptr); } - case ASR::ttypeType::Const: { - ASR::ttype_t* const_underlying_type = ASRUtils::get_contained_type(t); - return get_print_type(const_underlying_type, deref_ptr); - } default : throw LCompilersException("Not implemented"); } } diff --git a/src/libasr/codegen/llvm_utils.cpp b/src/libasr/codegen/llvm_utils.cpp index 61e19a6..74d65ed 100644 --- a/src/libasr/codegen/llvm_utils.cpp +++ b/src/libasr/codegen/llvm_utils.cpp @@ -692,13 +692,6 @@ namespace LCompilers { handle_llvm_pointers2() break; } - case (ASR::ttypeType::Const) : { - ASR::ttype_t *t2 = ASRUtils::get_contained_type(asr_type); - type = get_arg_type_from_ttype_t(t2, nullptr, m_abi, arg_m_abi, - m_storage, arg_m_value_attr, n_dims, a_kind, - is_array_type, arg_intent, module, get_pointer); - break; - } case (ASR::ttypeType::Real) : { ASR::Real_t* v_type = ASR::down_cast(asr_type); a_kind = v_type->m_kind; @@ -1016,10 +1009,6 @@ namespace LCompilers { case (ASR::ttypeType::CPtr) : return_type = llvm::Type::getVoidTy(context)->getPointerTo(); break; - case (ASR::ttypeType::Const) : { - return_type = get_type_from_ttype_t_util(ASRUtils::get_contained_type(return_var_type0), module); - break; - } case (ASR::ttypeType::Pointer) : { return_type = get_type_from_ttype_t_util(ASRUtils::get_contained_type(return_var_type0), module)->getPointerTo(); break; @@ -1218,10 +1207,6 @@ namespace LCompilers { case (ASR::ttypeType::CPtr) : return_type = llvm::Type::getVoidTy(context)->getPointerTo(); break; - case (ASR::ttypeType::Const) : { - return_type = get_type_from_ttype_t_util(ASRUtils::get_contained_type(return_var_type0), module); - break; - } case (ASR::ttypeType::Pointer) : { return_type = get_type_from_ttype_t_util(ASRUtils::get_contained_type(return_var_type0), module)->getPointerTo(); break; @@ -1525,12 +1510,6 @@ namespace LCompilers { llvm_type = llvm::Type::getInt32Ty(context); break ; } - case (ASR::ttypeType::Const) : { - llvm_type = get_type_from_ttype_t(ASRUtils::get_contained_type(asr_type), - nullptr, m_storage, is_array_type, is_malloc_array_type, is_list, - m_dims, n_dims, a_kind, module, m_abi); - break; - } case (ASR::ttypeType::FunctionType) : { if( type_declaration ) { ASR::Function_t* fn = ASR::down_cast( diff --git a/src/libasr/intrinsic_func_registry_util_gen.py b/src/libasr/intrinsic_func_registry_util_gen.py index 32a9f49..0024918 100644 --- a/src/libasr/intrinsic_func_registry_util_gen.py +++ b/src/libasr/intrinsic_func_registry_util_gen.py @@ -551,7 +551,7 @@ def compute_arg_types(indent, no_of_args, args_arr): global src for i in range(no_of_args): - src += indent + f"ASR::ttype_t *arg_type{i} = ASRUtils::type_get_past_const(ASRUtils::expr_type({args_arr}[{i}]));\n" + src += indent + f"ASR::ttype_t *arg_type{i} = ASRUtils::expr_type({args_arr}[{i}]);\n" def compute_arg_condition(no_of_args, args_lists): condition = [] diff --git a/src/libasr/pass/inline_function_calls.cpp b/src/libasr/pass/inline_function_calls.cpp index cb223e6..8454cfa 100644 --- a/src/libasr/pass/inline_function_calls.cpp +++ b/src/libasr/pass/inline_function_calls.cpp @@ -335,10 +335,6 @@ class InlineFunctionCall : public ASR::BaseExprReplacer break; } ASR::ttype_t* local_var_type = func_var->m_type; - if( ASR::is_a(*local_var_type) ) { - local_var_type = ASR::down_cast(local_var_type)->m_type; - } - LCOMPILERS_ASSERT(!ASR::is_a(*local_var_type)); ASR::symbol_t* local_var = (ASR::symbol_t*) ASR::make_Variable_t( al, func_var->base.base.loc, current_scope, s2c(al, local_var_name), nullptr, 0, ASR::intentType::Local, diff --git a/src/libasr/pass/intrinsic_functions.h b/src/libasr/pass/intrinsic_functions.h index af48083..ad4a1ff 100644 --- a/src/libasr/pass/intrinsic_functions.h +++ b/src/libasr/pass/intrinsic_functions.h @@ -2486,8 +2486,6 @@ namespace FloorDiv { ASR::ttype_t* t1, Vec &args, diag::Diagnostics& diag) { ASR::ttype_t *type1 = ASRUtils::expr_type(args[0]); ASR::ttype_t *type2 = ASRUtils::expr_type(args[1]); - type1 = ASRUtils::type_get_past_const(type1); - type2 = ASRUtils::type_get_past_const(type2); bool is_real1 = is_real(*type1); bool is_real2 = is_real(*type2); bool is_int1 = is_integer(*type1); @@ -4499,7 +4497,7 @@ namespace ListIndex { static inline void verify_args(const ASR::IntrinsicElementalFunction_t& x, diag::Diagnostics& diagnostics) { ASRUtils::require_impl(x.n_args <= 4, "Call to list.index must have at most four arguments", x.base.base.loc, diagnostics); - ASR::ttype_t* arg0_type = ASRUtils::type_get_past_const(ASRUtils::expr_type(x.m_args[0])); + ASR::ttype_t* arg0_type = ASRUtils::expr_type(x.m_args[0]); ASRUtils::require_impl(ASR::is_a(*arg0_type) && ASRUtils::check_equal_type(ASRUtils::expr_type(x.m_args[1]), ASRUtils::get_contained_type(arg0_type)), "First argument to list.index must be of list type and " @@ -4535,7 +4533,7 @@ static inline ASR::asr_t* create_ListIndex(Allocator& al, const Location& loc, int64_t overload_id = 0; ASR::expr_t* list_expr = args[0]; ASR::ttype_t *type = ASRUtils::expr_type(list_expr); - ASR::ttype_t *list_type = ASR::down_cast(ASRUtils::type_get_past_const(type))->m_type; + ASR::ttype_t *list_type = ASR::down_cast(type)->m_type; ASR::ttype_t *ele_type = ASRUtils::expr_type(args[1]); if (!ASRUtils::check_equal_type(ele_type, list_type)) { std::string fnd = ASRUtils::get_type_code(ele_type); From 51b42491af9973a58b19c4084e92594dbeb9b6f0 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 29 Mar 2024 21:36:27 +0530 Subject: [PATCH 3/4] Libasr changes for LC --- src/libasr/asr_utils.h | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/libasr/asr_utils.h b/src/libasr/asr_utils.h index b2682d3..18b398f 100644 --- a/src/libasr/asr_utils.h +++ b/src/libasr/asr_utils.h @@ -1985,10 +1985,9 @@ static inline bool is_unsigned_integer(ASR::ttype_t &x) { static inline bool is_real(ASR::ttype_t &x) { return ASR::is_a( - *type_get_past_const( - type_get_past_array( - type_get_past_allocatable( - type_get_past_pointer(&x))))); + *type_get_past_array( + type_get_past_allocatable( + type_get_past_pointer(&x)))); } static inline bool is_character(ASR::ttype_t &x) { @@ -2149,10 +2148,9 @@ inline size_t extract_dimensions_from_ttype(ASR::ttype_t *x, } static inline ASR::ttype_t *extract_type(ASR::ttype_t *type) { - return type_get_past_const( - type_get_past_array( - type_get_past_allocatable( - type_get_past_pointer(type)))); + return type_get_past_array( + type_get_past_allocatable( + type_get_past_pointer(type))); } static inline bool is_fixed_size_array(ASR::dimension_t* m_dims, size_t n_dims) { @@ -2980,12 +2978,10 @@ inline bool types_equal(ASR::ttype_t *a, ASR::ttype_t *b, if( a == nullptr && b == nullptr ) { return true; } - a = ASRUtils::type_get_past_const( - ASRUtils::type_get_past_allocatable( - ASRUtils::type_get_past_pointer(a))); - b = ASRUtils::type_get_past_const( - ASRUtils::type_get_past_allocatable( - ASRUtils::type_get_past_pointer(b))); + a = ASRUtils::type_get_past_allocatable( + ASRUtils::type_get_past_pointer(a)); + b = ASRUtils::type_get_past_allocatable( + ASRUtils::type_get_past_pointer(b)); if( !check_for_dimensions ) { a = ASRUtils::type_get_past_array(a); b = ASRUtils::type_get_past_array(b); From 0e01882e6b16b7887a7e055cf6c4cc81b69a334e Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Fri, 29 Mar 2024 21:37:14 +0530 Subject: [PATCH 4/4] Remove const from frontend --- src/lc/clang_ast_to_asr.cpp | 90 ++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/src/lc/clang_ast_to_asr.cpp b/src/lc/clang_ast_to_asr.cpp index f7d6677..2e187ee 100644 --- a/src/lc/clang_ast_to_asr.cpp +++ b/src/lc/clang_ast_to_asr.cpp @@ -357,7 +357,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor* xshape_result=nullptr, + bool &is_const, Vec* xshape_result=nullptr, ThirdPartyCPPArrayTypes* array_type=nullptr, bool* is_third_party_cpp_array=nullptr) { const clang::SplitQualType& split_qual_type = qual_type.split(); @@ -383,7 +383,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorisFloatingType() ) { type = ASRUtils::TYPE(ASR::make_Real_t(al, l, 8)); } else if( clang_type->isPointerType() ) { - type = ClangTypeToASRType(qual_type->getPointeeType()); + type = ClangTypeToASRType(qual_type->getPointeeType(), is_const); if( !ASRUtils::is_character(*type) ) { type = ASRUtils::TYPE(ASR::make_Pointer_t(al, l, type)); } @@ -391,7 +391,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetAsArrayTypeUnsafe(); const clang::ConstantArrayType* fixed_size_array_type = reinterpret_cast(array_type); - type = ClangTypeToASRType(array_type->getElementType()); + type = ClangTypeToASRType(array_type->getElementType(), is_const); llvm::APInt ap_int = fixed_size_array_type->getSize(); uint64_t size = ap_int.getZExtValue(); Vec vec; vec.reserve(al, 1); @@ -408,7 +408,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetAsArrayTypeUnsafe(); const clang::VariableArrayType* variable_array_type = reinterpret_cast(array_type); - type = ClangTypeToASRType(array_type->getElementType()); + type = ClangTypeToASRType(array_type->getElementType(), is_const); clang::Expr* expr = variable_array_type->getSizeExpr(); TraverseStmt(expr); Vec vec; vec.reserve(al, 1); @@ -422,11 +422,11 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetTypeClass() == clang::Type::LValueReference ) { const clang::LValueReferenceType* lvalue_reference_type = clang_type->getAs(); clang::QualType pointee_type = lvalue_reference_type->getPointeeType(); - type = ClangTypeToASRType(pointee_type, xshape_result, array_type, is_third_party_cpp_array); + type = ClangTypeToASRType(pointee_type, is_const, xshape_result, array_type, is_third_party_cpp_array); } else if( clang_type->getTypeClass() == clang::Type::TypeClass::Elaborated ) { const clang::ElaboratedType* elaborated_type = clang_type->getAs(); clang::QualType desugared_type = elaborated_type->desugar(); - type = ClangTypeToASRType(desugared_type, xshape_result, array_type, is_third_party_cpp_array); + type = ClangTypeToASRType(desugared_type, is_const, xshape_result, array_type, is_third_party_cpp_array); } else if( clang_type->getTypeClass() == clang::Type::TypeClass::TemplateSpecialization ) { const clang::TemplateSpecializationType* template_specialization = clang_type->getAs(); std::string template_name = template_specialization->getTemplateName().getAsTemplateDecl()->getNameAsString(); @@ -456,7 +456,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor xtensor_fixed_dims; xtensor_fixed_dims.reserve(al, 1); - ClangTypeToASRType(shape_type, &xtensor_fixed_dims, array_type, is_third_party_cpp_array); + ClangTypeToASRType(shape_type, is_const, &xtensor_fixed_dims, array_type, is_third_party_cpp_array); // Only allocatables are made for Kokkos::mdspan if( array_type && is_third_party_cpp_array ) { *is_third_party_cpp_array = true; @@ -476,7 +476,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorfrom_pointer_n(xtensor_fixed_dims.p, xtensor_fixed_dims.size()); } type = ASRUtils::TYPE(ASR::make_Array_t(al, l, - ClangTypeToASRType(qual_type), + ClangTypeToASRType(qual_type, is_const), xtensor_fixed_dims.p, xtensor_fixed_dims.size(), ASR::array_physical_typeType::DescriptorArray)); type = ASRUtils::TYPE(ASR::make_Allocatable_t(al, l, type)); @@ -488,9 +488,9 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor xtensor_fixed_dims; xtensor_fixed_dims.reserve(al, 1); - ClangTypeToASRType(shape_type, &xtensor_fixed_dims, array_type, is_third_party_cpp_array); + ClangTypeToASRType(shape_type, is_const, &xtensor_fixed_dims, array_type, is_third_party_cpp_array); type = ASRUtils::TYPE(ASR::make_Array_t(al, l, - ClangTypeToASRType(qual_type), + ClangTypeToASRType(qual_type, is_const), xtensor_fixed_dims.p, xtensor_fixed_dims.size(), ASR::array_physical_typeType::FixedSizeArray)); } else if( template_name == "xshape" ) { @@ -522,7 +522,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(*index_type) || ASRUtils::extract_kind_from_ttype_t(index_type) != 4 ) { throw std::runtime_error("Only int32_t should be used for index type in Kokkos::dextents."); @@ -551,9 +551,10 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(*ClangTypeToASRType(index_type)) || - ASRUtils::extract_kind_from_ttype_t(ClangTypeToASRType(index_type)) != 4 ) { + const clang::QualType& qual_type = template_arguments.at(0).getAsType(); + ASR::ttype_t* index_type = ClangTypeToASRType(qual_type, is_const); + if( !ASR::is_a(*index_type) || + ASRUtils::extract_kind_from_ttype_t(index_type) != 4 ) { throw std::runtime_error("Only int32_t should be used for index type in Kokkos::dextents."); } clang::Expr* clang_rank = template_arguments.at(1).getAsExpr(); @@ -576,7 +577,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetTypeClass() == clang::Type::TypeClass::Using ) { const clang::UsingType* using_type = clang_type->getAs(); - return ClangTypeToASRType(using_type->getUnderlyingType(), xshape_result, + return ClangTypeToASRType(using_type->getUnderlyingType(), is_const, xshape_result, array_type, is_third_party_cpp_array); } else if( clang_type->getTypeClass() == clang::Type::TypeClass::SubstTemplateTypeParm || clang_type->getTypeClass() == clang::Type::TypeClass::Typedef ) { @@ -638,7 +639,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetType()); + bool is_const = false; + ASR::ttype_t *asr_type = ClangTypeToASRType(x->getType(), is_const); ASR::symbol_t *v = ASR::down_cast(ASR::make_Variable_t(al, Lloc(x), current_scope, s2c(al, name), nullptr, 0, ASR::intentType::Local, nullptr, nullptr, - ASR::storage_typeType::Default, asr_type, nullptr, ASR::abiType::Source, + (is_const ? ASR::storage_typeType::Parameter : ASR::storage_typeType::Default), + asr_type, nullptr, ASR::abiType::Source, ASR::accessType::Public, ASR::presenceType::Required, false)); current_scope->add_symbol(name, v); is_stmt_created = false; @@ -806,7 +809,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor shape_result; shape_result.reserve(al, 1); - ASR::ttype_t* type = ClangTypeToASRType(x->getType(), &shape_result, + bool is_const = false; + ASR::ttype_t* type = ClangTypeToASRType(x->getType(), is_const, &shape_result, &array_type, &is_third_party_array_type); if( is_third_party_array_type && array_type == ThirdPartyCPPArrayTypes::PyTorchArray ) { @@ -815,9 +819,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(*type) ) { + if( is_const ) { intent_type = ASR::intentType::In; - type = ASRUtils::type_get_past_const(type); } if( ASRUtils::is_allocatable(type) ) { type = ASRUtils::type_get_past_allocatable(type); @@ -828,7 +831,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(tmp.get()); current_scope->add_symbol(name, tmp_sym); @@ -878,8 +881,9 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetSubExpr(); TraverseStmt(sub_expr); ASR::expr_t* arg = ASRUtils::EXPR(tmp.get()); + bool is_const = false; tmp = ASRUtils::make_Cast_t_value(al, Lloc(x), arg, asr_cast_kind, - ClangTypeToASRType(x->getType())); + ClangTypeToASRType(x->getType(), is_const)); is_stmt_created = false; return true; } @@ -1692,7 +1696,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(callee); ASR::symbol_t* callee_sym = callee_Var->m_v; const clang::QualType& qual_type = x->getCallReturnType(*Context); - ASR::ttype_t* return_type = ClangTypeToASRType(qual_type); + bool is_const = false; + ASR::ttype_t* return_type = ClangTypeToASRType(qual_type, is_const); if( return_type == nullptr ) { tmp = ASRUtils::make_SubroutineCall_t_util(al, Lloc(x), callee_sym, callee_sym, call_args.p, call_args.size(), nullptr, @@ -1722,7 +1727,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetReturnType()); + bool is_const = false; + ASR::ttype_t* return_type = ClangTypeToASRType(x->getReturnType(), is_const); ASR::symbol_t* return_sym = nullptr; ASR::expr_t* return_var = nullptr; if (return_type != nullptr) { @@ -1797,7 +1803,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor shape_result; shape_result.reserve(al, 1); - ASR::ttype_t* constructor_type = ClangTypeToASRType(x->getType(), &shape_result, + bool is_const = false; + ASR::ttype_t* constructor_type = ClangTypeToASRType(x->getType(), is_const, &shape_result, &third_party_array_type, &is_third_party_array_type); if( is_third_party_array_type && third_party_array_type == ThirdPartyCPPArrayTypes::MDSpanArray ) { if( x->getNumArgs() == 0 ) { @@ -1975,8 +1982,9 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetType()), nullptr); + struct_constructor_args.size(), ClangTypeToASRType(x->getType(), is_const), nullptr); return true; } @@ -2004,7 +2012,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitorgetKind() ) { case clang::APValue::Struct: { - ASR::ttype_t* v_type = ASRUtils::type_get_past_const(ASRUtils::symbol_type(v)); + ASR::ttype_t* v_type = ASRUtils::symbol_type(v); if( !ASR::is_a(*v_type) ) { // throw std::runtime_error("Expected ASR::Struct_t type found, " + // ASRUtils::type_to_str(v_type)); @@ -2045,8 +2053,9 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor xshape_result; xshape_result.reserve(al, 0); - ThirdPartyCPPArrayTypes array_type; bool is_third_party_array_type = false; - ASR::ttype_t *asr_type = ClangTypeToASRType(x->getType(), &xshape_result, + ThirdPartyCPPArrayTypes array_type; + bool is_third_party_array_type = false, is_const = false; + ASR::ttype_t *asr_type = ClangTypeToASRType(x->getType(), is_const, &xshape_result, &array_type, &is_third_party_array_type); if( is_third_party_array_type && array_type == ThirdPartyCPPArrayTypes::PyTorchArray ) { @@ -2056,7 +2065,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(ASR::make_Variable_t(al, Lloc(x), current_scope, s2c(al, name), nullptr, 0, ASR::intentType::Local, nullptr, nullptr, - ASR::storage_typeType::Default, asr_type, nullptr, ASR::abiType::Source, + (is_const ? ASR::storage_typeType::Parameter : ASR::storage_typeType::Default), + asr_type, nullptr, ASR::abiType::Source, ASR::accessType::Public, ASR::presenceType::Required, false)); current_scope->add_symbol(name, v); is_stmt_created = false; @@ -2072,7 +2082,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor(*asr_type) ) { + if( is_const ) { if( !ASRUtils::is_value_constant(ASRUtils::expr_value(init_val)) && !ASR::is_a(*init_val) ) { throw std::runtime_error("Initialisation expression of " @@ -2181,8 +2191,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor( ASRUtils::type_get_past_allocatable( - ASRUtils::type_get_past_pointer( - ASRUtils::type_get_past_const(array_type)))); + ASRUtils::type_get_past_pointer(array_type))); for( int i = 0; i < array_t->n_dims; i++ ) { alloc_dims.push_back(al, array_t->m_dims[i]); } @@ -2346,7 +2355,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor