-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fix DFG of the variable of aForEachStatement
#1052
Conversation
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.
Do we need to handle anything else in the normal DFG pass?
No, actually, the respective edges from the |
I just meant, if the user is missing out on this "feature", if he is only using the "normal" DFG pass? |
Good point. Since the variable declaration is wrapped in a DeclarationStatement, the DFG edge was indeed not added only with the normal DFG pass. Btw. the |
uhm no idea :D @konradweiss ? |
cpg-core/src/main/java/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/java/de/fraunhofer/aisec/cpg/passes/DFGPass.kt
Outdated
Show resolved
Hide resolved
* fix for loop and add DFG test * fix test * fix test * DFG pass fixes ForEach with Declarations @KuechA * New crazy idea * Moving some code around * Also handle NamespaceDeclarations for the DFG * Move test code to function * Compiler error * Fix loop DFGs * Correct parsing of functions in namespaces in C++ (#1078) * We incorrectly assumed that all scoped function definitions are methods. This is not true. This PR fixes this issue by determinging the correct scope target (which could also be a namespace). Furthermore, this tries to mitigate the problem that types used within such a function could refer to a namespaced entity but are referred with its local name. Since this requires resolving of symbols in a frontend, we introduce a new annotaiton `@ResolveInFrontend` to warn developers. Fixes #1070 * Converting remaining Java node classes to Kotlin (#1082) Co-authored-by: Alexander Kuechler <[email protected]> * Fluent Node DSL (#772) * Fluent Node DSL This PR adds a fluent node DSL to quickly build up a tree of CPG nodes. This can be used for unit tests or any occasion you quickly want to spin up a tree of CPG nodes that are independent of the underlying programming language. This is useful if you want to test the behaviour of some passes purely on the CPG tree, rather than a concrete program. * Consider all children to find the `prevDFG` for `FunctionDeclaration`s (#1086) * Fix DFG for FunctionDeclarations * Remove DFG for unreachable implicit return * Set isImplicit in java frontend * Apply suggestions from code review * Format --------- Co-authored-by: Christian Banse <[email protected]> * Disable problematic test The for loop test is broken because the implementation is broken. Thus, the test is disabled, until there is proper support for multi var assignments. * revert enabling of additional language * make it compile --------- Co-authored-by: Alexander Kuechler <[email protected]> Co-authored-by: Christian Banse <[email protected]> Co-authored-by: KuechA <[email protected]>
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.
I'm generally in favor of this PR. The only thing I dislike is the heavy use of !!
in the pass.
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt
Outdated
Show resolved
Hide resolved
Agree. Can you change it to a local variable assignment + smart card instead? We should really avoid !! |
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlFlowSensitiveDFGPass.kt
Outdated
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
The variable declaration in a
ForEachStatement
does not have an initializer and is therefore not really considered by theControlFlowSensitiveDFGPass
. We have to handle this case separately.Closes #1006