isl_ast_build_get_space: improve error handling
[isl.git] / isl_ast_int.c
blob178c38cf32a2da75d11fbf15c13bbb11cb44ada8
1 #include <isl/deprecated/ast_int.h>
2 #include <isl/deprecated/val_int.h>
3 #include <isl_ast_private.h>
5 int isl_ast_expr_get_int(__isl_keep isl_ast_expr *expr, isl_int *v)
7 if (!expr)
8 return -1;
9 if (expr->type != isl_ast_expr_int)
10 isl_die(isl_ast_expr_get_ctx(expr), isl_error_invalid,
11 "expression not an int", return -1);
12 return isl_val_get_num_isl_int(expr->u.v, v);