Skip to content

Commit

Permalink
source code structure for interprocedural override assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
rbonifacio committed Nov 17, 2020
1 parent 8cc902d commit 950cee2
Showing 1 changed file with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package br.unb.cic.analysis.ioa;

import br.unb.cic.analysis.AbstractMergeConflictDefinition;
import soot.*;

import java.util.*;

public class InterproceduralOverrideAssignment extends SceneTransformer {

private Set<SootMethod> visitedMethods;

private PointsToAnalysis pta;

private AbstractMergeConflictDefinition definition;

public InterproceduralOverrideAssignment(AbstractMergeConflictDefinition definition) {
visitedMethods = new HashSet<>();
this.definition = definition;
}

@Override
protected void internalTransform(String s, Map<String, String> map) {
definition.loadSourceStatements();
definition.loadSinkStatements();

configureEntryPoints();

List<SootMethod> methods = Scene.v().getEntryPoints();
pta = Scene.v().getPointsToAnalysis();
methods.forEach(m -> traverse(m));
}

private void traverse(SootMethod m) {
if(visitedMethods.contains(m) || m.isPhantom()) {
return;
}

Body body = m.retrieveActiveBody();

body.getUnits().forEach(unit -> {
// TODO: write specific code for Override Assignment.
});
}

private void configureEntryPoints() {
List<SootMethod> entryPoints = new ArrayList<>();
definition.getSourceStatements().forEach(s -> {
entryPoints.add(s.getSootMethod());
});
Scene.v().setEntryPoints(entryPoints);
// TODO: after fixing the logic for
// setting the entry points, remove the following
// line.
throw new RuntimeException("not implemented yet...");
}
}

0 comments on commit 950cee2

Please sign in to comment.