-
Notifications
You must be signed in to change notification settings - Fork 62
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
Improvements to EOG iteration and more applications #1135
Conversation
… set in the normal DFGPass
Kudos, SonarCloud Quality Gate passed! |
… in Expression Builder
@peckto Could you test if there are performance issues with the new and redesigned passes which haven't been there before? |
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt
Outdated
Show resolved
Hide resolved
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt
Outdated
Show resolved
Hide resolved
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt
Outdated
Show resolved
Hide resolved
cpg-analysis/src/test/kotlin/de/fraunhofer/aisec/cpg/analysis/MultiValueEvaluatorTest.kt
Show resolved
Hide resolved
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/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlDependenceGraphPass.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlDependenceGraphPass.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlDependenceGraphPass.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/helpers/EOGWorklist.kt
Outdated
Show resolved
Hide resolved
cpg-analysis/src/test/kotlin/de/fraunhofer/aisec/cpg/analysis/MultiValueEvaluatorTest.kt
Show resolved
Hide resolved
/** A mapping of a [Node] to its [Lattice]. */ | ||
var generalState: State<Node, V> = State(), | ||
/** A mapping of [Declaration] to its [Lattice]. */ | ||
var declarationsState: State<Node, V> = State(), |
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.
The declaration state seems to contain more than just declarations - is that intended?
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.
Yes it is because the "generalState" collects the nodes which will later receive DFG edges whereas the nodes here don't. I documented this but we can also change the name if necessary.
cpg-analysis/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/UnreachableEOGPass.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/de/fraunhofer/aisec/cpg/graph/statements/expressions/ShortCircuitOperator.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ControlDependenceGraphPass.kt
Outdated
Show resolved
Hide resolved
…lDependenceGraphPass.kt Co-authored-by: Selina Lin <[email protected]>
Co-authored-by: Selina Lin <[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.
LGTM once the conflict is resolved
Kudos, SonarCloud Quality Gate passed! |
Multiple (future) passes or analyses compute a fix-point by traversing the EOG and performing some operations. We do not want to implement the same strategy multiple times, so I tried to generalize the EOG iteration and the respective transformation of a state.
This PR...
BranchingNode
) as discussed in (PDG for Branch nodes #1066). It has the fieldbranchingDecision
which is the condition or similar. The following nodes implement this interface:IfStatement
WhileStatement
ForStatement
ForEachStatement
SwitchStatement
CatchClause
(even if it is incorrectly handled in the EOGPass)ConditionalExpression
(see Missing DataFlow edge for ConditionalExpression #1142 )ShortCircuitOperator
which extends BinaryOperator. This one has to be adapted for each language (i.e., the language frontend has to decide if a binary op is a normalBinaryOperator
or aShortCircuitOperator
. There's already a configuration in theLanguage
class).nextCDGEdges
andprevCDGEdges
to the classNode
. These hold the control dependence graph.ControlDependenceGraphPass
which adds the CDG edges for each function (intraprocedurally).Unreachable
properties of EOG edges (Closes Propagate UNREACHABLE Property for EOG edges #1067)