-
Notifications
You must be signed in to change notification settings - Fork 1.8k
JS: Remove synthetic locations #20302
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
Conversation
The old DbLocation class was public, hence the alias
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes synthetic locations from the JavaScript CodeQL library to simplify overlay locality handling. The change affects how SSA phi nodes are located but should not impact user-visible alerts since these nodes are typically not shown to users.
- Eliminates the entire synthetic location system and related TLocation type
- Updates all location references from
DbLocation
toLocation
throughout the codebase - Simplifies SSA definition location handling to use basic block locations instead of synthetic ones
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
javascript/ql/lib/semmle/javascript/internal/Locations.qll | Complete removal of synthetic location implementation and TLocation type |
javascript/ql/lib/semmle/javascript/Locations.qll | Simplifies Location class and deprecates DbLocation |
javascript/ql/lib/semmle/javascript/SSA.qll | Updates SSA definitions to use basic block locations and deprecates hasLocationInfo |
javascript/ql/lib/semmle/javascript/dataflow/internal/sharedlib/Ssa.qll | Changes type parameter from DbLocation to Location |
javascript/ql/lib/semmle/javascript/dataflow/internal/VariableOrThis.qll | Updates return types from DbLocation to Location |
javascript/ql/lib/semmle/javascript/dataflow/internal/VariableCapture.qll | Updates type parameters and return types to use Location |
javascript/ql/lib/semmle/javascript/Variables.qll | Changes LocalVariable.getLocation return type |
javascript/ql/lib/semmle/javascript/XML.qll | Updates XML module to use Location instead of DbLocation |
javascript/ql/lib/semmle/javascript/YAML.qll | Removes DbLocation type constraint |
javascript/ql/lib/semmle/javascript/RestrictedLocations.qll | Updates location reference in FirstLineOf |
javascript/ql/lib/semmle/javascript/JSON.qll | Updates JSON file location handling |
javascript/ql/lib/semmle/javascript/Files.qll | Updates File.getLocation return type |
javascript/ql/lib/semmle/javascript/AST.qll | Updates token location handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
Turns out some locations were negatively affected after all. Taking back into a draft while I fix these. |
4329261
to
cc8fe10
Compare
There was an issue with I've updated it to refer to what it should have been all along, the mention of the variable on the LHS. See example of the old and new location: Old location![]() New location![]() EvaluationEvaluation is not quite 1% anymore, but still leaning in the right direction, |
For background see #20297.
This PR removes synthetic locations because the dependencies induced by such locations is greatly complicating overlay locality. This might change the location associated with some SSA phi nodes (from the legacy SSA library), but such nodes aren't generally used for user-visible alerts anyway.
Evaluation looks good. There's a 1% speed-up, which is expected given that we saw a similar slow-down when synthetic locations were introduced (which was at the time necessary for replacing
hasLocationInfo
withgetLocation
).