-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Rust: Handle path attributes in path resolution #19216
Conversation
4dd7239
to
cbf6f94
Compare
cbf6f94
to
15ac9d3
Compare
15ac9d3
to
13f4a6a
Compare
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.
Looks great 👍. I've left a few minor comments.
exists(int components | | ||
components = (-1).maximum(max(int comp | exists(getComponent(relativePath, comp)) | comp)) and | ||
result = appendStep(f, relativePath, components) | ||
) |
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.
Two thoughts:
- Maybe factor out a
getNrOfComponents
predicate from this? Then this predicate would become justresult = appendStep(f, relativePath, getNrOfComponents(relativePath)
- The
comp
here is not a component but an index. Maybe rename it to justi
?
) | ||
} | ||
|
||
private predicate append(Folder f, string relativePath) { pathAttrImport(f, _, relativePath) } |
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.
This had me a bit confused at first as the predicate is called append
but doesn't seem to append :)
If I understand correctly this is about limiting the things that are appended by append
inside Append
in order for it not to append everything in the world?
What about calling it shouldAppend
/limitAppend
/appendOnly
/shouldBeAppended
(or something along those lines) and then using the same name for the parameter to the Append
module (what is now called app
)?
@@ -655,6 +655,11 @@ private predicate fileModule(SourceFile f, string name, Folder folder) { | |||
) | |||
} | |||
|
|||
private Meta getPathAttrMeta(Module m) { |
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.
private Meta getPathAttrMeta(Module m) { | |
/** | |
* Gets the `Meta` of the module `m`'s [path attribute][1]. | |
* | |
* [1]: https://doc.rust-lang.org/reference/items/modules.html#r-items.mod.outlined.path | |
*/ | |
private Meta getPathAttrMeta(Module m) { |
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.
Looks great! Thanks 👍
This PR adds basic support for taking path attributes into account in path resolution.
DCA shows that, while we maintain performance, we gain an additional 10% true positive call edges (up 522,938 from 475,383) and an additional 6% true positive resolved paths (up 388,991 from 368,369), all numbers computed across the entire DCA suite.