For the complete documentation index, see llms.txt. This page is also available as Markdown.

Complex Steps

Complex Steps are CPGQL Steps which combine the functionality of one or more Node-Type Steps, Repeat Steps, Filter Steps, Core Steps or Execution Directives. They are represented by one or more Directives and can be of three types: Generic Complex Steps, Call Graph Steps or Dataflow Complex Steps.

Generic Complex Steps

dump

dump is a Complex Step which executes the traversal and returns the value of the CODE property of the nodes it suffixes with syntax-highlighting.

ocular> cpg.method.name("main").dump
res0: List[String] = List(
  """int main(int argc, char *argv[]) { /* <=== */
  if (argc > 1 && strcmp(argv[1], "42") == 0) {
    fprintf(stderr, "It depends!\n");
    exit(42);
  }
  printf("What is the meaning of life?\n");
  exit(0);
}"""
)

dumpRaw

dumpRaw is a Complex Step which executes the traversal and returns the value of the CODE property of the nodes it suffixes.

tagList

tagList is a Complex Step which executes the traversal and returns the list of all TAG nodes found at each node visited by the traversal it suffixes.

Call Graph Steps

Call Graph Steps are Complex Steps which traverse the nodes of a Code Property Graph which represent a program's Call Graph.

The following examples are run on the simple program named X42:

callee

callee is a Call Graph Step which lists all nodes representing Call Graph callees of the traversed nodes.

caller

caller is a Call Graph Step which lists all nodes representing Call Graph callers of the traversed nodes.

callIn

callIn is a Call Graph Step which lists all nodes representing Call Graph parent call-sites of the traversed nodes.

inCall

inCall is a Call Graph Step which lists all nodes representing surrounding Call Graph call-sites of the traversed nodes.

Dataflow Steps

Dataflow Steps are Complex Steps which traverse the nodes of a Code Property Graph which represent a program's data-flow. controlledBy, flows,passes, passesNot, source, sink, reachableBy are all CPGQL Components that are combined to construct Dataflow Steps.

Last updated

Was this helpful?