Skip to content

Commit 509b2c2

Browse files
committed
Fix passes to use var names that are valid in C
1 parent 5ccc09c commit 509b2c2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libasr/pass/arr_slice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class ReplaceArraySection: public ASR::BaseExprReplacer<ReplaceArraySection> {
9898
void replace_ArraySection(ASR::ArraySection_t* x) {
9999
LCOMPILERS_ASSERT(current_scope != nullptr);
100100
ASR::expr_t* x_arr_var = x->m_v;
101-
std::string new_name = "~" + std::to_string(slice_counter) + "_slice";
101+
std::string new_name = "__libasr__created__section__" + std::to_string(slice_counter) + "_slice";
102102
slice_counter += 1;
103103
char* new_var_name = s2c(al, new_name);
104104
ASR::ttype_t* slice_asr_type = get_array_from_slice(x, x_arr_var);

src/libasr/pass/pass_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ namespace LCompilers {
231231
ASR::expr_t* create_var(int counter, std::string suffix, const Location& loc,
232232
ASR::ttype_t* var_type, Allocator& al, SymbolTable*& current_scope) {
233233
ASR::expr_t* idx_var = nullptr;
234-
std::string str_name = "~" + std::to_string(counter) + suffix;
234+
std::string str_name = "__libasr__created__var__" + std::to_string(counter) + suffix;
235235
char* idx_var_name = s2c(al, str_name);
236236

237237
if( current_scope->get_symbol(std::string(idx_var_name)) == nullptr ) {

0 commit comments

Comments
 (0)