flexibility in how to model constants
This commit is contained in:
parent
2a7a98ed32
commit
8005b665b9
|
@ -106,8 +106,8 @@ public class DelegatingAstPointerKeys implements AstPointerKeyFactory {
|
||||||
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) {
|
protected PointerKey getInstanceFieldPointerKeyForConstant(InstanceKey I, ConstantKey<?> F) {
|
||||||
Object v = F.getValue();
|
Object v = F.getValue();
|
||||||
// FIXME: current only constant string are handled
|
// FIXME: current only constant string are handled
|
||||||
if (v instanceof String) {
|
if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) {
|
||||||
IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom((String) v));
|
IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v)));
|
||||||
return getPointerKeyForInstanceField(I, f);
|
return getPointerKeyForInstanceField(I, f);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -154,4 +154,7 @@ public interface Language {
|
||||||
AbstractRootMethod getFakeRootMethod(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache);
|
AbstractRootMethod getFakeRootMethod(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache);
|
||||||
|
|
||||||
InducedCFG makeInducedCFG(SSAInstruction[] instructions, IMethod method, Context context);
|
InducedCFG makeInducedCFG(SSAInstruction[] instructions, IMethod method, Context context);
|
||||||
|
|
||||||
|
boolean modelConstant(Object o);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,4 +74,11 @@ public abstract class LanguageImpl implements Language {
|
||||||
InducedCFG makeInducedCFG(SSAInstruction[] instructions, IMethod method, Context context) {
|
InducedCFG makeInducedCFG(SSAInstruction[] instructions, IMethod method, Context context) {
|
||||||
return new InducedCFG(instructions, method, context);
|
return new InducedCFG(instructions, method, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean modelConstant(Object o) {
|
||||||
|
return o instanceof String;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue