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

Skip function bodies? #297

Closed
rwols opened this issue Jul 30, 2017 · 3 comments
Closed

Skip function bodies? #297

rwols opened this issue Jul 30, 2017 · 3 comments
Labels

Comments

@rwols
Copy link
Contributor

rwols commented Jul 30, 2017

When creating a translation unit, you can pass the option to skip parsing the function bodies (TU.PARSE_SKIP_FUNCTION_BODIES). This greatly improves parsing the file when it first loads. For the sake of completions, parsing function bodies is also not necessary. However, you may get strange warnings about undefined functions even if they're defined. Because of this, if one would implement this feature, it would be incompatible with the inline warnings/errors feature. I would like to implement this but I'd like to hear your opinions about this first.

So, I propose a new setting called "skip_function_bodies". By default it is set to false. If it's set to true, inline warnings/errors are disabled, but parse time is improved.

@niosus
Copy link
Owner

niosus commented Jul 30, 2017

Thanks for the proposition.

So, I propose a new setting called "skip_function_bodies". By default it is set to false

This seems valid to me. As for disabling the warnings. Can't we just filter them out? How many of different kinds of warnings are there? I already filter out the warnings related to #pragma once for parsing header files, so we could just add some more checks there.

Overall the addition is welcome. It would be best if we just filter out the (potentially?) wrong warnings if the setting is on. If we cannot do this, I don't know what would be a good way. We should inform the user that we disable a setting if we do it automatically.

@dibalavs
Copy link
Contributor

Hello. I created PR #325 about goto definition/declaration.

If we skip function bodies, will goto_declaration work to local variables, declared inside function body?

@niosus
Copy link
Owner

niosus commented Oct 25, 2017

@dibalavs I agree. I think it is important to remember that this option exists. Maybe we will use it in case we do something about #124 to make parsing faster. I will close this issue for now as I have no plans implementing it.

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

No branches or pull requests

3 participants