CpgPass

@deprecated(message = "Please use SimpleCpgPass as a replacement.", since = "approx v1.3.503") abstract
class CpgPass(cpg: Cpg, outName: String, keyPool: Option[KeyPool]) extends CpgPassBase

Base class for CPG pass - a program, which receives an input graph and outputs a sequence of additive diff graphs. These diff graphs can be merged into the original graph ("applied"), they can be serialized into a binary format, and finally, they can be added to an existing cpg.bin.zip file.

A pass is provided by inheriting from this class and implementing run, a method, which creates the sequence of diff graphs from an input graph.

Overview of steps and their meaning:

  1. Create: A sequence of diff graphs is created from the source graph 2. Apply: Each diff graph can be applied to the source graph 3. Serialize: After applying a diff graph, the diff graph can be serialized into a CPG overlay
    1. Store: The CPG overlay can be stored in a serialized CPG.
Value Params
cpg

the source CPG this pass traverses

Deprecated
[Since version approx v1.3.503] Please use SimpleCpgPass as a replacement.
class Object
trait Matchable
class Any

Value members

Abstract methods

def run(): Iterator[DiffGraph]

Main method of pass - to be implemented by child class

Main method of pass - to be implemented by child class

Concrete methods

override
def createAndApply(): Unit

Execute the pass and apply result to the underlying graph

Execute the pass and apply result to the underlying graph

Definition Classes
def createApplyAndSerialize(inverse: Boolean): Iterator[GeneratedMessageV3]

Execute and create a serialized overlay

Execute and create a serialized overlay

Value Params
inverse

invert the diffgraph before serializing

override
def createApplySerializeAndStore(serializedCpg: SerializedCpg, inverse: Boolean, prefix: String): Unit

Run a CPG pass to create diff graphs, apply diff graphs, create corresponding overlays and add them to the serialized CPG. The name of the overlay is derived from the class name of the pass.

Run a CPG pass to create diff graphs, apply diff graphs, create corresponding overlays and add them to the serialized CPG. The name of the overlay is derived from the class name of the pass.

Value Params
inverse

invert the diffgraph before serializing

prefix

a prefix to add to the output name

serializedCpg

the destination serialized CPG to add overlays to

Definition Classes

Inherited methods

def name: String

Name of the pass. By default it is inferred from the name of the class, override if needed.

Name of the pass. By default it is inferred from the name of the class, override if needed.

Inherited from
CpgPassBase