-
Notifications
You must be signed in to change notification settings - Fork 71
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
Conversation
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/SymbolResolver.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/inference/Inference.kt
Outdated
Show resolved
Hide resolved
Inference
system
b0fcb08
to
28f0cf6
Compare
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>
28f0cf6
to
1856644
Compare
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/DFGPass.kt
Outdated
Show resolved
Hide resolved
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.
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.
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/frontends/LanguageTraits.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/inference/Inference.kt
Show resolved
Hide resolved
cpg-language-cxx/src/test/kotlin/de/fraunhofer/aisec/cpg/frontends/cxx/CXXInferenceTest.kt
Show resolved
Hide resolved
@konradweiss Could you have another look, if the changes are ok please? thanks! |
|
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.