Skip to content

Swift: add UnknownLocation #9430

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

Merged
merged 2 commits into from
Jun 13, 2022
Merged

Swift: add UnknownLocation #9430

merged 2 commits into from
Jun 13, 2022

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Jun 3, 2022

getLocation() will now exists for all entities. When there is no
valid location, the location will still not be emitted in the DB, but
on the QL side we will then assign a special UnknownLocation with
empty filename and 0 for line/column start/end.

This unknown location is currently emitted (with a unique @ key) at
the start of every extraction, but we can move it elsewhere (and
possibly in a unique global trap file) at a later stage, possibly after
or when we rework the trap file strategy.

This should solve flakiness that was observed on the control flow tests,
which is probably caused by the nodes predicate in the TestOutput
class in ControlFlowGraphImplShared.qll not able to assign a proper
rank when the node does not have a location.

`getLocation()` will now exists for all entities. When there is no
valid location, the location will still not be emitted in the DB, but
on the QL side we will then assign a special `UnknownLocation` with
empty filename and 0 for line/column start/end.

This unknown location is currently emitted (with a unique `@` key) at
the start of every extraction, but we can move it elsewhere (and
possibly in a unique global trap file) at a later stage, possibly after
or when we rework the trap file strategy.

This should solve flakiness that was observed on the control flow tests,
which is probably caused by the `nodes` predicate in the `TestOutput`
class in `ControlFlowGraphImplShared.qll` not able to assign a proper
rank when the node does not have a location.
@redsun82 redsun82 requested review from AlexDenisov and MathiasVP June 3, 2022 13:07
@redsun82 redsun82 requested a review from a team as a code owner June 3, 2022 13:07
@github-actions github-actions bot added the Swift label Jun 3, 2022
@redsun82 redsun82 added the no-change-note-required This PR does not need a change note label Jun 3, 2022
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@MathiasVP MathiasVP merged commit 32ef535 into main Jun 13, 2022
@MathiasVP MathiasVP deleted the redsun82/swift-unknown-location branch June 13, 2022 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Swift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants