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

Improve argument filtering before passing to index.parse() #5

Open
gsingh93 opened this issue Mar 9, 2022 · 2 comments
Open

Improve argument filtering before passing to index.parse() #5

gsingh93 opened this issue Mar 9, 2022 · 2 comments

Comments

@gsingh93
Copy link
Contributor

gsingh93 commented Mar 9, 2022

This is the current way we're filtering the command arguments before passing it to index.parse():

c = [
    x for x in cmd['command'].split()
    if x.startswith('-I') or x.startswith('-std=') or x.startswith('-D')
] + cfg['clang_args']

I ran into issues with this in cases where -include was used, or when there was a space between -I/-include and the actual path. In my particular case, I found that if I didn't do any argument filtering, but just used cmd['command'].split()[1:-3] instead of all the arguments, it worked. This filtered out the compiler executable (the first argument) and the '-o output_file source_file` part of the command. While this fixed my issue, this wouldn't generally fix the issue as it's relying on those three tokens being at the end of the command, which is why I didn't submit a PR for it.

I also ran into issues, because some arguments contained single quotes that would have been removed on the command line, i.e. -DFOO='BAR', and I needed to do x.replace("'", '') to fix it.

@Vermeille
Copy link
Owner

Hi!

Thank you for caring about this project. As you can see, this has not been maintained or used for 5 years. Would you like having contributor privileges?

I think you would do a much better job at fixing the bugs you have found than me, given that you just ran those investigations and have them in your mind, while I forgot it all and feel like I have never seen this code in my life.

Thank you for your contribution!

@gsingh93
Copy link
Contributor Author

gsingh93 commented Mar 9, 2022

Sure, I have a number of fixes and improvements locally. If you want me to update this project with them, you can grant me contributor privileges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants