cgen: fix autofree inserting string declarations for multiple functions calls #18723
+33
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #17768
🤖 Generated by Copilot at cc2b0b5
Improved the autofree feature for string operations and function calls in the V compiler. Renamed a variable and a comment, updated the statement positions, and added a valgrind test.
🤖 Generated by Copilot at cc2b0b5
last_stmt_pos
tostmt_before_call_expr_pos
incgen.v
to avoid confusion withGen.last_stmt_pos
and clarify its role in autofree feature (link)stmt_before_call_expr_pos
instead oflast_stmt_pos
ing.insert_at
call incgen.v
to insert string declarations before call expressions that may produce strings to be freed (link)g.stmt_path_pos
array ing.insert_at
method intext_manipulation.v
to account for added line of code and maintain correct positions for autofree feature (link)/*af arg*/
to/*autofree arg*/
infn.v
to make it more consistent and clear (link)color_code_to_rgb
and call it with sample input inmultiple_fn_calls.v
to check for memory leaks and errors with valgrind and autofree feature (link)