From 950cee2a3353391d0a5e24e8f06cfdc39ac5dfe0 Mon Sep 17 00:00:00 2001 From: Rodrigo Bonifacio Date: Tue, 17 Nov 2020 06:42:13 -0300 Subject: [PATCH] source code structure for interprocedural override assignment --- .../InterproceduralOverrideAssignment.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java diff --git a/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java b/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java new file mode 100644 index 00000000..4a95b82e --- /dev/null +++ b/src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java @@ -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 visitedMethods; + + private PointsToAnalysis pta; + + private AbstractMergeConflictDefinition definition; + + public InterproceduralOverrideAssignment(AbstractMergeConflictDefinition definition) { + visitedMethods = new HashSet<>(); + this.definition = definition; + } + + @Override + protected void internalTransform(String s, Map map) { + definition.loadSourceStatements(); + definition.loadSinkStatements(); + + configureEntryPoints(); + + List 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 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..."); + } +}