Skip to content

Commit

Permalink
fix reduplicated predecessors problem
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzun66 committed Dec 20, 2024
1 parent 1a33bc3 commit 9de327e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
Binary file added shared-test-resources/bugfixes/TrapSSA.class
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,8 @@ protected void putEdge_internal(@Nonnull Stmt stmtA, int succesorIdx, @Nonnull S
.values()
.forEach(
eb -> {
// blockA is in eb's predecessors list, because A and B have same ebs.
eb.removePredecessorBlock(blockB);
eb.addPredecessorBlock(blockA);
});

} else {
Expand Down
17 changes: 0 additions & 17 deletions sootup.tests/src/test/java/sootup/tests/InsertBeforeAfterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import sootup.core.model.SourceType;
import sootup.core.signatures.MethodSignature;
import sootup.core.types.ClassType;
import sootup.core.util.DotExporter;
import sootup.java.bytecode.frontend.inputlocation.PathBasedAnalysisInputLocation;
import sootup.java.core.JavaIdentifierFactory;
import sootup.java.core.language.JavaJimple;
Expand Down Expand Up @@ -668,20 +667,4 @@ public void testInsertAfterBlockMiddle2() {
+ "}\n";
Assertions.assertEquals(exceptedBody, builder.build().toString());
}

@Test
public void testErrors() {
ClassType clazzType = factory.getClassType("TrapSSA");
MethodSignature methodSignature =
factory.getMethodSignature(
clazzType, "main", "void", Collections.singletonList("java.lang.String[]"));
final Path path = Paths.get(location + "TrapSSA.class");
PathBasedAnalysisInputLocation inputLocation =
new PathBasedAnalysisInputLocation.ClassFileBasedAnalysisInputLocation(
path, "", SourceType.Application);
JavaView view = new JavaView(inputLocation);
Body body = view.getMethod(methodSignature).get().getBody();
System.out.println(DotExporter.createUrlToWebeditor(body.getStmtGraph()));
System.out.println(body);
}
}

0 comments on commit 9de327e

Please sign in to comment.