|
| 1 | +/** |
| 2 | + * @name Print DFG |
| 3 | + * @description Produces a representation of a file's Data Flow Graph. |
| 4 | + * This query is used by the VS Code extension. |
| 5 | + * @id java/print-cfg |
| 6 | + * @kind graph |
| 7 | + * @tags ide-contextual-queries/print-dfg |
| 8 | + */ |
| 9 | + |
| 10 | +import java |
| 11 | +private import semmle.code.java.dataflow.internal.DataFlowImplSpecific as DF |
| 12 | +private import semmle.code.java.dataflow.internal.TaintTrackingImplSpecific as TT |
| 13 | +private import codeql.dataflow.PrintDfg |
| 14 | +private import MakePrintDfg<Location, DF::JavaDataFlow, TT::JavaTaintTracking> |
| 15 | + |
| 16 | +external string selectedSourceFile(); |
| 17 | + |
| 18 | +private predicate selectedSourceFileAlias = selectedSourceFile/0; |
| 19 | + |
| 20 | +external int selectedSourceLine(); |
| 21 | + |
| 22 | +private predicate selectedSourceLineAlias = selectedSourceLine/0; |
| 23 | + |
| 24 | +external int selectedSourceColumn(); |
| 25 | + |
| 26 | +private predicate selectedSourceColumnAlias = selectedSourceColumn/0; |
| 27 | + |
| 28 | +module ViewDfgQueryInput implements ViewGraphQueryInputSig<File> { |
| 29 | + predicate selectedSourceFile = selectedSourceFileAlias/0; |
| 30 | + |
| 31 | + predicate selectedSourceLine = selectedSourceLineAlias/0; |
| 32 | + |
| 33 | + predicate selectedSourceColumn = selectedSourceColumnAlias/0; |
| 34 | + |
| 35 | + predicate callableSpan( |
| 36 | + DF::JavaDataFlow::DataFlowCallable callable, File file, int startLine, int startColumn, |
| 37 | + int endLine, int endColumn |
| 38 | + ) { |
| 39 | + file = callable.asCallable().getFile() and |
| 40 | + callable.getLocation().getStartLine() = startLine and |
| 41 | + callable.getLocation().getStartColumn() = startColumn and |
| 42 | + exists(Location loc | |
| 43 | + loc.getEndLine() = endLine and |
| 44 | + loc.getEndColumn() = endColumn and |
| 45 | + loc = callable.asCallable().getBody().getLocation() |
| 46 | + ) |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +import ViewGraphQuery<File, ViewDfgQueryInput> |
0 commit comments