Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaration of multiple variables is handled incorrectly #500

Closed
leg0 opened this issue Aug 31, 2022 · 1 comment
Closed

Declaration of multiple variables is handled incorrectly #500

leg0 opened this issue Aug 31, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@leg0
Copy link

leg0 commented Aug 31, 2022

Input:

int a,b,c;

Output:

int c;

Expecting to see all variable declarations in the output.

@andreasfertig andreasfertig added the bug Something isn't working label Sep 2, 2022
@andreasfertig
Copy link
Owner

Hello @leg0,

thanks for reporting this! That's an issue in global scope only. The three variables all have the same source location. Hence there are three rewrites for the same location. As a result, only the last rewrite survives. I'm unsure how to fix this without tracking the variables, which I'm not particularly eager to do. I plan to switch to a transformation at the TU level, which would solve this issue automatically. What I'm trying to say is that it can take a while until I fix this issue.

Andreas

andreasfertig added a commit that referenced this issue Mar 11, 2024
This change introduces a `TranslationUnit` handler, replacing the previous
matchers. The advantage is that _all_ statements are processed,  not only the
ones where an exact match exists.

The new approach fixes #376, #500, and #588.

There is one disadvantage: for primary templates, some code is not reproduced
as written. This causes one compile issue.
andreasfertig added a commit that referenced this issue Mar 11, 2024
This change introduces a `TranslationUnit` handler, replacing the previous
matchers. The advantage is that _all_ statements are processed,  not only the
ones where an exact match exists.

The new approach fixes #376, #500, and #588.

There is one disadvantage: for primary templates, some code is not reproduced
as written. This causes one compile issue.
andreasfertig added a commit that referenced this issue Mar 11, 2024
This change introduces a `TranslationUnit` handler, replacing the previous
matchers. The advantage is that _all_ statements are processed,  not only the
ones where an exact match exists.

The new approach fixes #376, #500, and #588.

There is one disadvantage: for primary templates, some code is not reproduced
as written. This causes one compile issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants