fixes for bug with dead code and exception handlers
This commit is contained in:
parent
00eb1d2bd2
commit
1cc5e5ce9c
|
@ -49,6 +49,7 @@ import com.ibm.wala.cast.tree.CAstSourcePositionMap;
|
|||
import com.ibm.wala.cast.tree.CAstType;
|
||||
import com.ibm.wala.cast.tree.CAstType.Function;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.ClassLoaderImpl;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
|
@ -159,9 +160,9 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
}
|
||||
|
||||
private void addMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
declaredMethods.put(Util.methodEntityToSelector(methodEntity), new ConcreteJavaMethod(methodEntity, owner, cfg, symtab,
|
||||
hasCatchBlock, catchTypes, hasMonitorOp, lexicalInfo, debugInfo));
|
||||
hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo));
|
||||
}
|
||||
|
||||
private void addMethod(CAstEntity methodEntity, IClass owner) {
|
||||
|
@ -239,9 +240,9 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
private final TypeReference[] exceptionTypes;
|
||||
|
||||
public JavaEntityMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(owner, methodEntity.getQualifiers(), cfg, symtab, MethodReference.findOrCreate(owner.getReference(), Util
|
||||
.methodEntityToSelector(methodEntity)), hasCatchBlock, catchTypes, hasMonitorOp, lexicalInfo, debugInfo, JavaSourceLoaderImpl.this.getAnnotations(methodEntity));
|
||||
.methodEntityToSelector(methodEntity)), hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo, JavaSourceLoaderImpl.this.getAnnotations(methodEntity));
|
||||
this.parameterTypes = computeParameterTypes(methodEntity);
|
||||
this.exceptionTypes = computeExceptionTypes(methodEntity);
|
||||
}
|
||||
|
@ -350,8 +351,8 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
*/
|
||||
public class ConcreteJavaMethod extends JavaEntityMethod {
|
||||
public ConcreteJavaMethod(CAstEntity methodEntity, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(methodEntity, owner, cfg, symtab, hasCatchBlock, catchTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(methodEntity, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
}
|
||||
|
||||
public IClassHierarchy getClassHierarchy() {
|
||||
|
@ -478,8 +479,8 @@ public abstract class JavaSourceLoaderImpl extends ClassLoaderImpl {
|
|||
}
|
||||
|
||||
public void defineFunction(CAstEntity n, IClass owner, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
((JavaClass) owner).addMethod(n, owner, cfg, symtab, hasCatchBlock, catchTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
((JavaClass) owner).addMethod(n, owner, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo);
|
||||
}
|
||||
|
||||
public void defineAbstractFunction(CAstEntity n, IClass owner) {
|
||||
|
|
|
@ -15,6 +15,7 @@ package com.ibm.wala.cast.java.translator;
|
|||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
|
||||
|
@ -30,6 +31,7 @@ import com.ibm.wala.cast.tree.CAstType;
|
|||
import com.ibm.wala.cast.tree.CAstType.Method;
|
||||
import com.ibm.wala.cast.tree.visit.CAstVisitor;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.ModuleEntry;
|
||||
|
@ -229,7 +231,7 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
|||
}
|
||||
|
||||
protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab,
|
||||
boolean hasCatchBlock, TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
DebuggingInformation debugInfo) {
|
||||
// N.B.: base class may actually ask to create a synthetic type to wrap
|
||||
// code bodies, so we may see other things than TYPE_ENTITY here.
|
||||
|
|
|
@ -643,6 +643,11 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
|||
verifyGraphAssertions(CG, assertionsForDeadCode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeadCatch() throws IllegalArgumentException, IOException, CancelException, WalaException {
|
||||
JSCallGraphBuilderUtil.makeScriptCG("tests", "dead_catch.js");
|
||||
}
|
||||
|
||||
@Test(expected = CallGraphBuilderCancelException.class)
|
||||
public void testManyStrings() throws IllegalArgumentException, IOException, CancelException, WalaException {
|
||||
SSAPropagationCallGraphBuilder B = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "many-strings.js");
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.ibm.wala.cast.util.CAstPattern;
|
|||
import com.ibm.wala.cast.util.CAstPattern.Segments;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.ControlFlowGraph;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.AnalysisCache;
|
||||
|
@ -291,7 +292,7 @@ public class ArgumentSpecialization {
|
|||
|
||||
@Override
|
||||
protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab,
|
||||
boolean hasCatchBlock, TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
DebuggingInformation debugInfo) {
|
||||
if (N == codeBodyEntity) {
|
||||
specializedCode = myloader.makeCodeBodyCode(cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, LI, debugInfo, method.getDeclaringClass());
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.net.URL;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ibm.wala.cast.ipa.callgraph.StandardFunctionTargetSelector;
|
||||
|
@ -36,6 +37,7 @@ import com.ibm.wala.cast.tree.visit.CAstVisitor;
|
|||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.cast.util.CAstPrinter;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.ClassLoaderFactory;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.SourceURLModule;
|
||||
|
@ -163,7 +165,7 @@ public class JSCallGraphUtil extends com.ibm.wala.cast.ipa.callgraph.CAstCallGra
|
|||
JSAstTranslator toIR = new JSAstTranslator(cl) {
|
||||
@Override
|
||||
protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab,
|
||||
boolean hasCatchBlock, TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
DebuggingInformation debugInfo) {
|
||||
String fnName = "L" + composeEntityName(definingContext, N);
|
||||
names.add(fnName);
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.ibm.wala.cast.tree.CAstSourcePositionMap;
|
|||
import com.ibm.wala.cast.tree.rewrite.CAstRewriterFactory;
|
||||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IClassLoader;
|
||||
|
@ -705,7 +706,7 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
private CAstEntity entity;
|
||||
|
||||
JavaScriptMethodObject(IClass cls, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
super(cls, functionQualifiers, cfg, symtab, AstMethodReference.fnReference(cls.getReference()), hasCatchBlock, caughtTypes,
|
||||
hasMonitorOp, lexicalInfo, debugInfo, null);
|
||||
|
||||
|
@ -808,14 +809,14 @@ public class JavaScriptLoader extends CAstAbstractModuleLoader {
|
|||
}
|
||||
|
||||
public IMethod defineCodeBodyCode(String clsName, AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo) {
|
||||
JavaScriptCodeBody C = (JavaScriptCodeBody) lookupClass(clsName, cha);
|
||||
assert C != null : clsName;
|
||||
return C.setCodeBody(makeCodeBodyCode(cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo, debugInfo, C));
|
||||
}
|
||||
|
||||
public JavaScriptMethodObject makeCodeBodyCode(AbstractCFG cfg, SymbolTable symtab, boolean hasCatchBlock,
|
||||
TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo,
|
||||
Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo, DebuggingInformation debugInfo,
|
||||
IClass C) {
|
||||
return new JavaScriptMethodObject(C, cfg, symtab, hasCatchBlock, caughtTypes, hasMonitorOp, lexicalInfo,
|
||||
debugInfo);
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
*****************************************************************************/
|
||||
package com.ibm.wala.cast.js.translator;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||
import com.ibm.wala.cast.js.loader.JSCallSiteReference;
|
||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||
|
@ -26,6 +28,7 @@ import com.ibm.wala.cast.tree.impl.CAstSymbolImpl;
|
|||
import com.ibm.wala.cast.tree.visit.CAstVisitor;
|
||||
import com.ibm.wala.cast.types.AstMethodReference;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.NewSiteReference;
|
||||
import com.ibm.wala.ssa.SymbolTable;
|
||||
import com.ibm.wala.types.FieldReference;
|
||||
|
@ -135,7 +138,7 @@ public class JSAstTranslator extends AstTranslator {
|
|||
}
|
||||
|
||||
protected void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab,
|
||||
boolean hasCatchBlock, TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
boolean hasCatchBlock, Map<IBasicBlock,TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation LI,
|
||||
DebuggingInformation debugInfo) {
|
||||
if (DEBUG)
|
||||
System.err.println(("\n\nAdding code for " + N));
|
||||
|
|
|
@ -10,11 +10,14 @@
|
|||
*****************************************************************************/
|
||||
package com.ibm.wala.cast.ir.ssa;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.wala.cast.loader.AstMethod;
|
||||
import com.ibm.wala.cast.loader.AstMethod.LexicalInformation;
|
||||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.ControlFlowGraph;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ipa.callgraph.Context;
|
||||
import com.ibm.wala.ssa.DefaultIRFactory;
|
||||
|
@ -82,12 +85,12 @@ public class AstIRFactory implements IRFactory {
|
|||
}
|
||||
}
|
||||
|
||||
private void setupCatchTypes(SSACFG cfg, TypeReference[][] catchTypes) {
|
||||
for (int i = 0; i < catchTypes.length; i++) {
|
||||
if (catchTypes[i] != null) {
|
||||
ExceptionHandlerBasicBlock bb = (ExceptionHandlerBasicBlock) cfg.getNode(i);
|
||||
for (int j = 0; j < catchTypes[i].length; j++) {
|
||||
bb.addCaughtExceptionType(catchTypes[i][j]);
|
||||
private void setupCatchTypes(SSACFG cfg, Map<IBasicBlock, TypeReference[]> map) {
|
||||
for(Map.Entry<IBasicBlock,TypeReference[]> e : map.entrySet()) {
|
||||
if (e.getKey().getNumber() != -1) {
|
||||
ExceptionHandlerBasicBlock bb = (ExceptionHandlerBasicBlock) cfg.getNode(e.getKey().getNumber());
|
||||
for (int j = 0; j < e.getValue().length; j++) {
|
||||
bb.addCaughtExceptionType(e.getValue()[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
* been processed
|
||||
*/
|
||||
protected abstract void defineFunction(CAstEntity N, WalkContext definingContext, AbstractCFG cfg, SymbolTable symtab,
|
||||
boolean hasCatchBlock, TypeReference[][] caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
boolean hasCatchBlock, Map<IBasicBlock, TypeReference[]> catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
DebuggingInformation debugInfo);
|
||||
|
||||
/**
|
||||
|
@ -826,7 +826,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
setCurrentBlockAsHandler();
|
||||
e = sourceContext.astContext.currentScope().allocateTempValue();
|
||||
addInstruction(insts.GetCaughtExceptionInstruction(startBlock.getNumber(), e));
|
||||
sourceContext.astContext.setCatchType(startBlock.getNumber(), defaultCatchType());
|
||||
sourceContext.astContext.setCatchType(startBlock, defaultCatchType());
|
||||
}
|
||||
|
||||
while (sourceContext != null && (targetContext == null || !targetContext.covers(sourceContext))) {
|
||||
|
@ -1235,11 +1235,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
for (int i = 0, blockNumber = 0; i < blocks.size(); i++) {
|
||||
PreBasicBlock pb = blocks.get(i);
|
||||
PreBasicBlock block = blocks.get(i);
|
||||
block.setGraphNodeId(-1);
|
||||
if (liveBlocks.contains(pb)) {
|
||||
instructionToBlockMap[blockNumber] = blocks.get(i).getLastInstructionIndex();
|
||||
instructionToBlockMap[blockNumber] = block.getLastInstructionIndex();
|
||||
|
||||
PreBasicBlock block = blocks.get(i);
|
||||
block.setGraphNodeId(-1);
|
||||
this.addNode(block);
|
||||
if (block.isCatchBlock()) {
|
||||
setCatchBlock(blockNumber);
|
||||
|
@ -2110,11 +2110,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
UnwindState getUnwindState();
|
||||
|
||||
void setCatchType(int blockNumber, TypeReference catchType);
|
||||
void setCatchType(IBasicBlock bb, TypeReference catchType);
|
||||
|
||||
void setCatchType(CAstNode catchNode, TypeReference catchType);
|
||||
|
||||
TypeReference[][] getCatchTypes();
|
||||
Map<IBasicBlock,TypeReference[]> getCatchTypes();
|
||||
|
||||
void addEntityName(CAstEntity e, String name);
|
||||
|
||||
|
@ -2185,15 +2185,15 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
return parent.getUnwindState();
|
||||
}
|
||||
|
||||
public void setCatchType(int blockNumber, TypeReference catchType) {
|
||||
parent.setCatchType(blockNumber, catchType);
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
parent.setCatchType(bb, catchType);
|
||||
}
|
||||
|
||||
public void setCatchType(CAstNode catchNode, TypeReference catchType) {
|
||||
parent.setCatchType(catchNode, catchType);
|
||||
}
|
||||
|
||||
public TypeReference[][] getCatchTypes() {
|
||||
public Map<IBasicBlock, TypeReference[]> getCatchTypes() {
|
||||
return parent.getCatchTypes();
|
||||
}
|
||||
|
||||
|
@ -2286,7 +2286,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
private final IncipientCFG cfg;
|
||||
|
||||
private TypeReference[][] catchTypes = new TypeReference[0][];
|
||||
private final Map<IBasicBlock,TypeReference[]> catchTypes = HashMapFactory.make();
|
||||
|
||||
Set<Pair<Pair<String, String>, Integer>> exposedReads;
|
||||
Set<Pair<Pair<String, String>, Integer>> exposedWrites;
|
||||
|
@ -2362,20 +2362,14 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
public void setCatchType(CAstNode catchNode, TypeReference catchType) {
|
||||
setCatchType(cfg.getBlock(catchNode).getNumber(), catchType);
|
||||
setCatchType(cfg.getBlock(catchNode), catchType);
|
||||
}
|
||||
|
||||
public void setCatchType(int blockNumber, TypeReference catchType) {
|
||||
if (catchTypes.length <= blockNumber) {
|
||||
TypeReference[][] data = new TypeReference[blockNumber + 1][];
|
||||
System.arraycopy(catchTypes, 0, data, 0, catchTypes.length);
|
||||
catchTypes = data;
|
||||
}
|
||||
|
||||
if (catchTypes[blockNumber] == null) {
|
||||
catchTypes[blockNumber] = new TypeReference[] { catchType };
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
if (! catchTypes.containsKey(bb)) {
|
||||
catchTypes.put(bb, new TypeReference[] { catchType });
|
||||
} else {
|
||||
TypeReference[] data = catchTypes[blockNumber];
|
||||
TypeReference[] data = catchTypes.get(bb);
|
||||
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (data[i] == catchType) {
|
||||
|
@ -2387,11 +2381,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
System.arraycopy(data, 0, newData, 0, data.length);
|
||||
newData[data.length] = catchType;
|
||||
|
||||
catchTypes[blockNumber] = newData;
|
||||
catchTypes.put(bb, newData);
|
||||
}
|
||||
}
|
||||
|
||||
public TypeReference[][] getCatchTypes() {
|
||||
public Map<IBasicBlock,TypeReference[]> getCatchTypes() {
|
||||
return catchTypes;
|
||||
}
|
||||
|
||||
|
@ -3034,7 +3028,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
// create code entry stuff for this entity
|
||||
SymbolTable symtab = ((AbstractScope) functionContext.currentScope()).getUnderlyingSymtab();
|
||||
TypeReference[][] catchTypes = functionContext.getCatchTypes();
|
||||
Map<IBasicBlock,TypeReference[]> catchTypes = functionContext.getCatchTypes();
|
||||
AstCFG cfg = new AstCFG(n, functionContext.cfg(), symtab);
|
||||
Position[] line = functionContext.cfg().getLinePositionMap();
|
||||
boolean katch = functionContext.cfg().hasCatchBlock();
|
||||
|
@ -4261,13 +4255,13 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
return null;
|
||||
}
|
||||
|
||||
public void setCatchType(int blockNumber, TypeReference catchType) {
|
||||
public void setCatchType(IBasicBlock bb, TypeReference catchType) {
|
||||
}
|
||||
|
||||
public void setCatchType(CAstNode castNode, TypeReference catchType) {
|
||||
}
|
||||
|
||||
public TypeReference[][] getCatchTypes() {
|
||||
public Map<IBasicBlock, TypeReference[]> getCatchTypes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
package com.ibm.wala.cast.loader;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||
import com.ibm.wala.cast.ir.translator.AstTranslator.AstLexicalInformation;
|
||||
|
@ -19,6 +20,7 @@ import com.ibm.wala.cast.tree.CAstQualifier;
|
|||
import com.ibm.wala.cast.tree.CAstSourcePositionMap.Position;
|
||||
import com.ibm.wala.cfg.AbstractCFG;
|
||||
import com.ibm.wala.cfg.ControlFlowGraph;
|
||||
import com.ibm.wala.cfg.IBasicBlock;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.classLoader.IMethod;
|
||||
import com.ibm.wala.ssa.SymbolTable;
|
||||
|
@ -111,20 +113,20 @@ public abstract class AstMethod implements IMethod {
|
|||
private final MethodReference ref;
|
||||
private final boolean hasCatchBlock;
|
||||
private final boolean hasMonitorOp;
|
||||
private final TypeReference[][] catchTypes;
|
||||
private final Map<IBasicBlock, TypeReference[]> catchTypes;
|
||||
private final AstLexicalInformation lexicalInfo;
|
||||
private final DebuggingInformation debugInfo;
|
||||
private final Collection<Annotation> annotations;
|
||||
|
||||
protected AstMethod(IClass cls, Collection qualifiers, AbstractCFG cfg, SymbolTable symtab, MethodReference ref,
|
||||
boolean hasCatchBlock, TypeReference[][] catchTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
boolean hasCatchBlock, Map<IBasicBlock, TypeReference[]> caughtTypes, boolean hasMonitorOp, AstLexicalInformation lexicalInfo,
|
||||
DebuggingInformation debugInfo, Collection<Annotation> annotations) {
|
||||
this.cls = cls;
|
||||
this.cfg = cfg;
|
||||
this.ref = ref;
|
||||
this.symtab = symtab;
|
||||
this.qualifiers = qualifiers;
|
||||
this.catchTypes = catchTypes;
|
||||
this.catchTypes = caughtTypes;
|
||||
this.hasCatchBlock = hasCatchBlock;
|
||||
this.hasMonitorOp = hasMonitorOp;
|
||||
this.lexicalInfo = lexicalInfo;
|
||||
|
@ -161,7 +163,7 @@ public abstract class AstMethod implements IMethod {
|
|||
return symtab;
|
||||
}
|
||||
|
||||
public TypeReference[][] catchTypes() {
|
||||
public Map<IBasicBlock, TypeReference[]> catchTypes() {
|
||||
return catchTypes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue