implement some methods in CHACallGraph
This commit is contained in:
parent
c9022b0743
commit
8c65754b0e
|
@ -65,20 +65,17 @@ public class CHACallGraph extends BasicCallGraph<CHAContextInterpreter> {
|
|||
|
||||
@Override
|
||||
public IR getIR() {
|
||||
assert false;
|
||||
return null;
|
||||
return cache.getIR(method);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefUse getDU() {
|
||||
assert false;
|
||||
return null;
|
||||
return cache.getDefUse(cache.getIR(method));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<NewSiteReference> iterateNewSites() {
|
||||
assert false;
|
||||
return null;
|
||||
return getInterpreter(this).iterateNewSites(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,6 +13,7 @@ package com.ibm.wala.ipa.callgraph.cha;
|
|||
import java.util.Iterator;
|
||||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
|
||||
public interface CHAContextInterpreter {
|
||||
|
@ -27,4 +28,5 @@ public interface CHAContextInterpreter {
|
|||
*/
|
||||
public abstract Iterator<CallSiteReference> iterateCallSites(CGNode node);
|
||||
|
||||
Iterator<NewSiteReference> iterateNewSites(CGNode node);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.Iterator;
|
|||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.CodeScanner;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||
import com.ibm.wala.shrikeCT.InvalidClassFileException;
|
||||
import com.ibm.wala.util.debug.Assertions;
|
||||
|
@ -39,4 +40,16 @@ public class ContextInsensitiveCHAContextInterpreter implements CHAContextInterp
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<NewSiteReference> iterateNewSites(CGNode node) {
|
||||
if (node == null) {
|
||||
throw new IllegalArgumentException("node is null");
|
||||
}
|
||||
try {
|
||||
return CodeScanner.getNewSites(node.getMethod()).iterator();
|
||||
} catch (InvalidClassFileException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue