Go: make data flow consistency checks available (and fix one)#14547
Go: make data flow consistency checks available (and fix one)#14547owen-mc merged 7 commits intogithub:mainfrom
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.
mbg
left a comment
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Question: why does this get its own qlpack?
There was a problem hiding this comment.
Reason 1: all the other languages do it...
…nal-files.md Co-authored-by: Michael B. Gale <mbg@github.com>
|
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 ofTDataFlowCallablecalledTExternalFileScopewhich is used only as a return value fornodeGetEnclosingCallablewhen a node exists in an external file (i.e. one which is not in the project being analyzed).