Skip to content

Commit 792d67c

Browse files
authored
Rename SimpleCpgPass to CpgPass (#1678)
* Rename `SimpleCpgPass` to `CpgPass` * run scalafmt
1 parent c2485f1 commit 792d67c

File tree

1 file changed

+6
-34
lines changed
  • codepropertygraph/src/main/scala/io/shiftleft/passes

1 file changed

+6
-34
lines changed

codepropertygraph/src/main/scala/io/shiftleft/passes/CpgPass.scala

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,12 @@ import scala.annotation.nowarn
1111
import scala.concurrent.duration.DurationLong
1212
import scala.util.{Failure, Success, Try}
1313

14-
/* SimpleCpgPass is a replacement for CpgPass.
15-
*
16-
* Instead of returning an Iterator[DiffGraph], the `run` fuction gets a DiffGraphBuilder as input, and can attach its
17-
* modifications to it (i.e. mutate the builder).
18-
*
19-
* CpgPass has somewhat subtle semantics with respect to lazy evaluation order of the returned iterator and graph writes.
20-
* The subtleties are gone with SimpleCpgPass.
21-
*
22-
* Note that SimpleCpgPass does not support lazy evaluation to reduce peak memory consumption. Take care before porting passes that
23-
* write large amounts of data that risk OOM errors.
24-
*
25-
* Initialization and cleanup of external resources or large datastructures can be done in the `init()` and `finish()`
26-
* methods. This may be better than using the constructor or GC, because e.g. SCPG chains of passes construct
27-
* passes eagerly, and releases them only when the entire chain has run.
28-
*
29-
* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
30-
* // description of now-removed `CpgPass` class
31-
*
32-
* Base class for CPG pass - a program, which receives an input graph and outputs a sequence of additive diff graphs.
33-
* These diff graphs can be merged into the original graph ("applied"), they can be serialized into a binary format,
34-
* and finally, they can be added to an existing cpg.bin.zip file.
35-
*
36-
* A pass is provided by inheriting from this class and implementing `run`, a method, which creates the sequence of
37-
* diff graphs from an input graph.
38-
*
39-
* Overview of steps and their meaning:
40-
*
41-
* 1. Create: A sequence of diff graphs is created from the source graph 2. Apply: Each diff graph can be applied to
42-
* the source graph 3. Serialize: After applying a diff graph, the diff graph can be serialized into a CPG overlay
43-
* 4. Store: The CPG overlay can be stored in a serialized CPG.
44-
*
45-
* @param cpg
46-
* the source CPG this pass traverses
14+
/* CpgPass
4715
*
16+
* Base class of a program which receives a CPG as input for the purpose of modifying it.
4817
* */
4918

50-
abstract class SimpleCpgPass(cpg: Cpg, outName: String = "", keyPool: Option[KeyPool] = None)
19+
abstract class CpgPass(cpg: Cpg, outName: String = "", keyPool: Option[KeyPool] = None)
5120
extends ForkJoinParallelCpgPass[AnyRef](cpg, outName, keyPool) {
5221

5322
def run(builder: overflowdb.BatchedUpdate.DiffGraphBuilder): Unit
@@ -58,6 +27,9 @@ abstract class SimpleCpgPass(cpg: Cpg, outName: String = "", keyPool: Option[Key
5827
run(builder)
5928
}
6029

30+
@deprecated abstract class SimpleCpgPass(cpg: Cpg, outName: String = "", keyPool: Option[KeyPool] = None)
31+
extends CpgPass(cpg, outName, keyPool)
32+
6133
/* ForkJoinParallelCpgPass is a possible replacement for CpgPass and ParallelCpgPass.
6234
*
6335
* Instead of returning an Iterator, generateParts() returns an Array. This means that the entire collection

0 commit comments

Comments
 (0)