Skip to content
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

Several improvements and cleanups to the Inference system #1407

Merged
merged 22 commits into from
Feb 6, 2024

Conversation

oxisto
Copy link
Member

@oxisto oxisto commented Jan 11, 2024

This PR does some cleanup and improvements to the inference systems. It is made more configurable, with more options added to InferenceConfiguration.

For example, currently, the Inference class only infers fields. However, some languages (such as C/C++) have global variables, which we can also infer.

Note, that we intentionally NOT infer local variables, since we assume that we have incomplete code, that is probably complete within a function, but not complete in the sense that translation unit files or headers are missing.

This also aligns the DFG of inferred functions more to non-inferred ones and adds inferred methods to the AST.

@oxisto oxisto requested a review from konradweiss as a code owner January 11, 2024 16:26
@oxisto oxisto changed the title Inference of global variables Several improvements and cleanups to the Inference system Jan 12, 2024
@oxisto oxisto force-pushed the infer-global-variables branch from b0fcb08 to 28f0cf6 Compare January 12, 2024 19:14
oxisto and others added 6 commits January 22, 2024 08:57
Currently, the `Inference` class only infers fields. However, some languages (such as C/C++) have global variables, which we can also infer.

Note, that we intentionally *NOT* infer local variables, since we assume that we have incomplete code, that is probably complete within a function, but not complete in the sense that translation unit files or headers are missing.
…nce/Inference.kt

Co-authored-by: KuechA <31155350+KuechA@users.noreply.github.com>
@oxisto oxisto force-pushed the infer-global-variables branch from 28f0cf6 to 1856644 Compare January 22, 2024 07:59
@oxisto oxisto requested a review from peckto as a code owner January 22, 2024 14:25
Copy link
Collaborator

@konradweiss konradweiss left a comment

Choose a reason for hiding this comment

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

Pls add some small missing documentation and clarify if testGlobals is correct. I also noticed that the check if inference is turned on is fragmented over the subfunctions. while it would be cool to check that asap when the first inference function is called, the checks which inference, e.g. infering records etc. is turned on needs to happen further down so I don't know if we can make it better or have to accept that checking if inference is turned on has to be done in many different places.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@oxisto oxisto requested a review from konradweiss January 29, 2024 09:18
@oxisto
Copy link
Member Author

oxisto commented Feb 1, 2024

@konradweiss Could you have another look, if the changes are ok please? thanks!

Copy link

sonarqubecloud bot commented Feb 6, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

2 New issues
0 Security Hotspots
84.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@oxisto oxisto merged commit 288ea53 into main Feb 6, 2024
@oxisto oxisto deleted the infer-global-variables branch February 6, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants