@@ -1229,8 +1229,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1229
1229
index .m_step = range_step.get ();
1230
1230
array_section_indices.push_back (al, index );
1231
1231
} else if ( is_all_called ) {
1232
- index .m_left = ASRUtils ::get_bound<SemanticError> (array, i + 1 , " lbound" , al);
1233
- index .m_right = ASRUtils ::get_bound<SemanticError> (array, i + 1 , " ubound" , al);
1232
+ index .m_left = PassUtils ::get_bound (array, i + 1 , " lbound" , al);
1233
+ index .m_right = PassUtils ::get_bound (array, i + 1 , " ubound" , al);
1234
1234
index .m_step = ASRUtils::EXPR (ASR::make_IntegerConstant_t (al, index .loc , 1 ,
1235
1235
ASRUtils::TYPE (ASR::make_Integer_t (al, index .loc , 4 ))));
1236
1236
array_section_indices.push_back (al, index );
@@ -1252,8 +1252,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1252
1252
for ( ; i < rank; i++ ) {
1253
1253
ASR::array_index_t index ;
1254
1254
index .loc = array->base .loc ;
1255
- index .m_left = ASRUtils ::get_bound<SemanticError> (array, i + 1 , " lbound" , al);
1256
- index .m_right = ASRUtils ::get_bound<SemanticError> (array, i + 1 , " ubound" , al);
1255
+ index .m_left = PassUtils ::get_bound (array, i + 1 , " lbound" , al);
1256
+ index .m_right = PassUtils ::get_bound (array, i + 1 , " ubound" , al);
1257
1257
index .m_step = ASRUtils::EXPR (ASR::make_IntegerConstant_t (al, index .loc , 1 ,
1258
1258
ASRUtils::TYPE (ASR::make_Integer_t (al, index .loc , 4 ))));
1259
1259
array_section_indices.push_back (al, index );
@@ -1432,8 +1432,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1432
1432
args.p , args.size (), 0 , ASRUtils::TYPE (ASR::make_Logical_t (
1433
1433
al, Lloc (x), 4 )), nullptr );
1434
1434
} else if ( sf == SpecialFunc::Exp ) {
1435
- tmp = ASRUtils::make_IntrinsicScalarFunction_t_util (al, Lloc (x),
1436
- static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions ::Exp),
1435
+ tmp = ASRUtils::make_IntrinsicElementalFunction_t_util (al, Lloc (x),
1436
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions ::Exp),
1437
1437
args.p , args.size (), 0 , ASRUtils::expr_type (args.p [0 ]), nullptr );
1438
1438
} else if ( sf == SpecialFunc::Pow ) {
1439
1439
if ( args.size () != 2 ) {
@@ -1442,20 +1442,20 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1442
1442
1443
1443
CreateBinOp (args.p [0 ], args.p [1 ], ASR::binopType::Pow, Lloc (x));
1444
1444
} else if ( sf == SpecialFunc::Sqrt ) {
1445
- tmp = ASRUtils::make_IntrinsicScalarFunction_t_util (al, Lloc (x),
1446
- static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions ::Sqrt),
1445
+ tmp = ASRUtils::make_IntrinsicElementalFunction_t_util (al, Lloc (x),
1446
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions ::Sqrt),
1447
1447
args.p , args.size (), 0 , ASRUtils::expr_type (args.p [0 ]), nullptr );
1448
1448
} else if ( sf == SpecialFunc::Abs ) {
1449
- tmp = ASRUtils::make_IntrinsicScalarFunction_t_util (al, Lloc (x),
1450
- static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions ::Abs),
1449
+ tmp = ASRUtils::make_IntrinsicElementalFunction_t_util (al, Lloc (x),
1450
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions ::Abs),
1451
1451
args.p , args.size (), 0 , ASRUtils::expr_type (args.p [0 ]), nullptr );
1452
1452
} else if ( sf == SpecialFunc::Sin ) {
1453
- tmp = ASRUtils::make_IntrinsicScalarFunction_t_util (al, Lloc (x),
1454
- static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions ::Sin),
1453
+ tmp = ASRUtils::make_IntrinsicElementalFunction_t_util (al, Lloc (x),
1454
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions ::Sin),
1455
1455
args.p , args.size (), 0 , ASRUtils::expr_type (args.p [0 ]), nullptr );
1456
1456
} else if ( sf == SpecialFunc::Cos ) {
1457
- tmp = ASRUtils::make_IntrinsicScalarFunction_t_util (al, Lloc (x),
1458
- static_cast <int64_t >(ASRUtils::IntrinsicScalarFunctions ::Cos),
1457
+ tmp = ASRUtils::make_IntrinsicElementalFunction_t_util (al, Lloc (x),
1458
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions ::Cos),
1459
1459
args.p , args.size (), 0 , ASRUtils::expr_type (args.p [0 ]), nullptr );
1460
1460
} else if ( sf == SpecialFunc::AMax ) {
1461
1461
if ( args.size () > 1 && args.p [1 ] != nullptr ) {
@@ -1636,7 +1636,9 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1636
1636
throw std::runtime_error (" std::vector::reserve should be called with only one argument." );
1637
1637
}
1638
1638
1639
- tmp = ASR::make_ListReserve_t (al, Lloc (x), callee, args[0 ]);
1639
+ tmp = ASR::make_Expr_t (al, Lloc (x), ASRUtils::EXPR (ASR::make_IntrinsicElementalFunction_t (al, Lloc (x),
1640
+ static_cast <int64_t >(ASRUtils::IntrinsicElementalFunctions::ListReserve), args.p , args.size (), 0 ,
1641
+ nullptr , nullptr )));
1640
1642
is_stmt_created = true ;
1641
1643
} else {
1642
1644
throw std::runtime_error (" Only printf and exit special functions supported" );
@@ -1676,7 +1678,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
1676
1678
if ( return_type == nullptr ) {
1677
1679
tmp = ASRUtils::make_SubroutineCall_t_util (al, Lloc (x), callee_sym,
1678
1680
callee_sym, call_args.p , call_args.size (), nullptr ,
1679
- nullptr , false );
1681
+ nullptr , false , false );
1680
1682
is_stmt_created = true ;
1681
1683
} else {
1682
1684
tmp = ASRUtils::make_FunctionCall_t_util (al, Lloc (x), callee_sym,
@@ -2741,8 +2743,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
2741
2743
int lkind = ASRUtils::extract_kind_from_ttype_t (left_type);
2742
2744
int rkind = ASRUtils::extract_kind_from_ttype_t (right_type);
2743
2745
if ( left_type->type != right_type->type || lkind != rkind ) {
2744
- throw SemanticError (" Casting for mismatching pointer types not supported yet." ,
2745
- right_type->base .loc );
2746
+ throw std::runtime_error (" Casting for mismatching pointer types not supported yet." );
2746
2747
}
2747
2748
}
2748
2749
@@ -2765,8 +2766,8 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
2765
2766
dest_type_right = ASRUtils::make_Array_t_util (al, dest_type->base .loc ,
2766
2767
dest_type, m_dims, n_dims);
2767
2768
}
2768
- left = CastingUtil::perform_casting (left, left_type, dest_type_left, al, left->base .loc );
2769
- right = CastingUtil::perform_casting (right, right_type, dest_type_right, al, right->base .loc );
2769
+ left = CastingUtil::perform_casting (left, dest_type_left, al, left->base .loc );
2770
+ right = CastingUtil::perform_casting (right, dest_type_right, al, right->base .loc );
2770
2771
return ;
2771
2772
}
2772
2773
@@ -2779,8 +2780,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
2779
2780
return ;
2780
2781
}
2781
2782
src_expr = CastingUtil::perform_casting (
2782
- src_expr, src_type, dest_type, al,
2783
- src_expr->base .loc );
2783
+ src_expr, dest_type, al, src_expr->base .loc );
2784
2784
if ( casted_expression_signal == 0 ) {
2785
2785
left = src_expr;
2786
2786
right = dest_expr;
@@ -3070,7 +3070,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
3070
3070
TraverseStmt (loop_body);
3071
3071
current_body = current_body_copy;
3072
3072
3073
- tmp = ASR::make_WhileLoop_t (al, Lloc (x), nullptr , test, body.p , body.size ());
3073
+ tmp = ASR::make_WhileLoop_t (al, Lloc (x), nullptr , test, body.p , body.size (), nullptr , 0 );
3074
3074
is_stmt_created = true ;
3075
3075
scopes.pop_back ();
3076
3076
inside_loop = inside_loop_copy;
@@ -3104,7 +3104,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
3104
3104
body.push_back (al, ASRUtils::STMT (tmp.get ()));
3105
3105
current_body = current_body_copy;
3106
3106
3107
- tmp = ASR::make_WhileLoop_t (al, Lloc (x), nullptr , test, body.p , body.size ());
3107
+ tmp = ASR::make_WhileLoop_t (al, Lloc (x), nullptr , test, body.p , body.size (), nullptr , 0 );
3108
3108
is_stmt_created = true ;
3109
3109
scopes.pop_back ();
3110
3110
for_loop = for_loop_copy;
@@ -3120,7 +3120,7 @@ class ClangASTtoASRVisitor: public clang::RecursiveASTVisitor<ClangASTtoASRVisit
3120
3120
TraverseStmt (if_cond);
3121
3121
ASR::expr_t * test = ASRUtils::EXPR (tmp.get ());
3122
3122
if ( !ASRUtils::is_logical (*ASRUtils::expr_type (test)) ) {
3123
- test = CastingUtil::perform_casting (test, ASRUtils::expr_type (test),
3123
+ test = CastingUtil::perform_casting (test,
3124
3124
ASRUtils::TYPE (ASR::make_Logical_t (al, Lloc (x), 1 )), al, Lloc (x));
3125
3125
}
3126
3126
0 commit comments