Search in sources :

Example 1 with DOTCFGVisualizer

use of org.checkerframework.dataflow.cfg.visualize.DOTCFGVisualizer in project checker-framework by typetools.

the class GenericAnnotatedTypeFactory method createCFGVisualizer.

/**
 * Create a new CFGVisualizer.
 *
 * @return a new CFGVisualizer, or null if none will be used on this run
 */
@Nullable
protected CFGVisualizer<Value, Store, TransferFunction> createCFGVisualizer() {
    if (checker.hasOption("flowdotdir")) {
        String flowdotdir = checker.getOption("flowdotdir");
        if (flowdotdir.equals("")) {
            throw new UserError("Emtpy string provided for -Aflowdotdir command-line argument");
        }
        boolean verbose = checker.hasOption("verbosecfg");
        Map<String, Object> args = new HashMap<>(2);
        args.put("outdir", flowdotdir);
        args.put("verbose", verbose);
        args.put("checkerName", getCheckerName());
        CFGVisualizer<Value, Store, TransferFunction> res = new DOTCFGVisualizer<>();
        res.init(args);
        return res;
    } else if (checker.hasOption("cfgviz")) {
        String cfgviz = checker.getOption("cfgviz");
        if (cfgviz == null) {
            throw new UserError("-Acfgviz specified without arguments, should be -Acfgviz=VizClassName[,opts,...]");
        }
        String[] opts = cfgviz.split(",");
        String vizClassName = opts[0];
        if (!Signatures.isBinaryName(vizClassName)) {
            throw new UserError("Bad -Acfgviz class name \"%s\", should be a binary name.", vizClassName);
        }
        Map<String, Object> args = processCFGVisualizerOption(opts);
        if (!args.containsKey("verbose")) {
            boolean verbose = checker.hasOption("verbosecfg");
            args.put("verbose", verbose);
        }
        args.put("checkerName", getCheckerName());
        CFGVisualizer<Value, Store, TransferFunction> res = BaseTypeChecker.invokeConstructorFor(vizClassName, null, null);
        res.init(args);
        return res;
    }
    // Nobody expected to use cfgVisualizer if neither option given.
    return null;
}
Also used : UserError(org.checkerframework.javacutil.UserError) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) CFStore(org.checkerframework.framework.flow.CFStore) CFAbstractStore(org.checkerframework.framework.flow.CFAbstractStore) DOTCFGVisualizer(org.checkerframework.dataflow.cfg.visualize.DOTCFGVisualizer) CFGVisualizer(org.checkerframework.dataflow.cfg.visualize.CFGVisualizer) DOTCFGVisualizer(org.checkerframework.dataflow.cfg.visualize.DOTCFGVisualizer) CFAbstractValue(org.checkerframework.framework.flow.CFAbstractValue) CFValue(org.checkerframework.framework.flow.CFValue) FieldInitialValue(org.checkerframework.framework.flow.CFAbstractAnalysis.FieldInitialValue) Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) Nullable(org.checkerframework.checker.nullness.qual.Nullable)

Aggregations

HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 Map (java.util.Map)1 Nullable (org.checkerframework.checker.nullness.qual.Nullable)1 CFGVisualizer (org.checkerframework.dataflow.cfg.visualize.CFGVisualizer)1 DOTCFGVisualizer (org.checkerframework.dataflow.cfg.visualize.DOTCFGVisualizer)1 FieldInitialValue (org.checkerframework.framework.flow.CFAbstractAnalysis.FieldInitialValue)1 CFAbstractStore (org.checkerframework.framework.flow.CFAbstractStore)1 CFAbstractValue (org.checkerframework.framework.flow.CFAbstractValue)1 CFStore (org.checkerframework.framework.flow.CFStore)1 CFValue (org.checkerframework.framework.flow.CFValue)1 UserError (org.checkerframework.javacutil.UserError)1