-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Go: make data flow consistency checks available (and fix one) #14547
Go: make data flow consistency checks available (and fix one) #14547
Conversation
This can be run on an existing database to check for any assumptions of the data flow library which do not hold.
It wasn't updated when MkImplicitVarargsSlice was added as a branch of TNode. This meant that it gave no result for `ImplicitVarargsSlice`s in function calls used to initialise variables declared at file level.
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 reasonable -- just a few minor questions and comments.
I also couldn't find any reference of this actually getting run in the build logs. Is there a way to verify that this works as expected other than deliberately introducing a failure locally?
go/ql/lib/change-notes/2023-10-20-enclosing-callable-for-external-files.md
Outdated
Show resolved
Hide resolved
go/ql/consistency-queries/qlpack.yml
Outdated
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.
Question: why does this get its own qlpack?
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.
Reason 1: all the other languages do it...
…nal-files.md Co-authored-by: Michael B. Gale <[email protected]>
It isn't currently run in CI. I'm not sure what other languages do. I stumbled across some experimental tests using it for python. It's a bit unclear to me what test code it should be run on. I've just been running it on some databases I already had handy. |
It seems the standard way to run it in CI is to add it to the consistency queries, so it's run on all tests. But we can't really do that till we've made all the queries have zero results. |
Performance testing showed so significant difference. I think this is ready to merge. |
This PR makes the data flow consistency checks for go available. They currently have to be manually. When we have done the work to reduce the number of expected results to zero we can add them to the consistency checks so that we will notice when there is a regression.
This PR also fixes a problem which was highlighted that not all nodes have a result for
nodeGetEnclosingCallable
. Two steps were needed: (1) fixing an accidental exclusion of ImplicitVarArgsSlice nodes and (2) making a new branch ofTDataFlowCallable
calledTExternalFileScope
which is used only as a return value fornodeGetEnclosingCallable
when a node exists in an external file (i.e. one which is not in the project being analyzed).