use of org.checkerframework.dataflow.cfg.visualize.CFGVisualizer 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;
}
Aggregations