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) {
|
||||
Object v = F.getValue();
|
||||
// FIXME: current only constant string are handled
|
||||
if (v instanceof String) {
|
||||
IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom((String) v));
|
||||
if (I.getConcreteType().getClassLoader().getLanguage().modelConstant(v)) {
|
||||
IField f = I.getConcreteType().getField(Atom.findOrCreateUnicodeAtom(String.valueOf(v)));
|
||||
return getPointerKeyForInstanceField(I, f);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -154,4 +154,7 @@ public interface Language {
|
|||
AbstractRootMethod getFakeRootMethod(IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache);
|
||||
|
||||
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) {
|
||||
return new InducedCFG(instructions, method, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean modelConstant(Object o) {
|
||||
return o instanceof String;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue