Closed konradweiss closed 4 years ago
What is the reasoning behind having two passes now?
What is the reasoning behind having two passes now?
I'll test it against #64 and if it's correct and does not fail the existing analyses, we'll migrate to only this new pass.
Looks good to me, at least for IfStatement
. I would propose to replace the current EOG pass with this variant, so it will also become part of defaultPasses()
.
Yes, please combine it into one pass @konradweiss
Ah, well. The graph itself looks good, but the tests are still NOK. This needs to be fixed first:
DemoTests.testHierarchy():
java.lang.StackOverflowError
at java.base/java.lang.Class.getSimpleName(Class.java:1550)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.pushToEOG(EvaluationOrderGraphPass.java:786)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:594)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:39)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
at de.fraunhofer.aisec.cpg.passes.EvaluationOrderGraphPass.createEOG(EvaluationOrderGraphPass.java:574)
at de.fraunhofer.aisec.cpg.passes.BranchSemanticEOGPass.handleConditionalExpression(BranchSemanticEOGPass.java:40)
...
Also, both test cases in JavaVsCppTest need to be adapted and I am unsure if this order is actually correct:
0 Literal
1 VariableDeclaration
2 DeclarationStatement
3 DeclaredReferenceExpression
4 Literal
5 BinaryOperator
6 IfStatement
7 DeclaredReferenceExpression
8 DeclaredReferenceExpression
9 DeclaredReferenceExpression
10 CallExpression
11 BinaryOperator
12 ReturnStatement
13 CompoundStatement
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities (and 0 Security Hotspots to review)
29 Code Smells
…hat connects some language structures differently. Structures like if, for, switch, synchronized have an expression that needs to be evaluated first and these are now connected to the root node of the expression before the eog connects the 'body' this allows to parse the expression and then deduce its meaning from the following node that is the root node and thus gives information on the semantic of the overal language structue.