forked from spgroup/conflict-static-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source code structure for interprocedural override assignment
- Loading branch information
1 parent
8cc902d
commit 950cee2
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
src/main/java/br/unb/cic/analysis/ioa/InterproceduralOverrideAssignment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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..."); | ||
} | ||
} |