C++: Improvements to "Declaration hides parameter"#751
Merged
geoffw0 merged 4 commits intogithub:masterfrom Jan 11, 2019
Merged
C++: Improvements to "Declaration hides parameter"#751geoffw0 merged 4 commits intogithub:masterfrom
geoffw0 merged 4 commits intogithub:masterfrom
Conversation
Bad magic ended up in `LocalVariable.getFunction` and effectively
created a Cartesian product. Before this change, the timing looked like
this:
Variable::LocalVariable::getFunction_dispred#bb ... 50.1s
#select#cpe#123#fff ............................... 20.6s
After this change, those predicates become much faster:
Variable::LocalVariable::getFunction_dispred#ff ... 121ms
DeclarationHidesParameter::localVariableNames#fff . 77ms
#select#cpe#123#fff ............................... 28ms
Introducing the predicate `localVariableNames` ensures that we can do
the main join on two columns simultaneously, so that's a change we
should keep even if we remove the `pragma[nomagic]` later.
This change suppresses results from "Declaration hides parameter" where the ParameterDeclarationEntry does not link up to the right FunctionDeclarationEntry.
geoffw0
reviewed
Jan 11, 2019
| // We also exclude names from functions that have multiple definitions. | ||
| // This should not happen in a single application but since we | ||
| // have a system wide view it is likely to happen for instance for | ||
| // the main function. |
Contributor
There was a problem hiding this comment.
Should this perhaps be a QLDoc comment?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The forum post https://discuss.lgtm.com/t/please-help-me-understand-this-issue-local-variable-buffer-hides-a-parameter-of-the-same-name/1662 prompted me to look at this query. I auto-formatted the query and fixed a performance bug, and then I worked around the issue that was causing false positives. I think it's an extractor bug, and I've filed CPP-331 to track it.
I wasn't able to create a unit test that demonstrates the problem, but you can see how the results change on the jx_application_framework project: before and after.