Skip to content

Commit a88d2a1

Browse files
authored
Remove unused logic (#1672)
1 parent fc99de2 commit a88d2a1

8 files changed

Lines changed: 6 additions & 925 deletions

File tree

codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading/CpgLoader.scala

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ object CpgLoader {
4444
def createIndexes(cpg: Cpg): Unit =
4545
new CpgLoader().createIndexes(cpg)
4646

47-
/** Load and apply overlays from archives to the given CPG.
48-
*
49-
* @param overlayFilenames
50-
* filenames of proto archives
51-
* @param cpg
52-
* The CPG to apply overlays to
53-
*/
54-
def addOverlays(overlayFilenames: Seq[String], cpg: Cpg): Unit =
55-
new CpgLoader().addOverlays(overlayFilenames, cpg)
56-
5747
/** Determine whether the CPG is a legacy (proto) CPG
5848
*
5949
* @param filename
@@ -98,10 +88,4 @@ private class CpgLoader {
9888
def createIndexes(cpg: Cpg): Unit =
9989
cpg.graph.indexManager.createNodePropertyIndex(PropertyNames.FULL_NAME)
10090

101-
def addOverlays(overlayFilenames: Seq[String], cpg: Cpg): Unit = {
102-
overlayFilenames.foreach { overlayFilename =>
103-
CpgOverlayLoader.load(overlayFilename, cpg)
104-
}
105-
}
106-
10791
}

codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading/CpgOverlayLoader.scala

Lines changed: 0 additions & 146 deletions
This file was deleted.

codepropertygraph/src/main/scala/io/shiftleft/codepropertygraph/cpgloading/ProtoCpgLoader.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.google.protobuf.GeneratedMessageV3
44
import io.shiftleft.codepropertygraph.Cpg
55
import io.shiftleft.proto.cpg.Cpg.CpgStruct.Edge
66
import io.shiftleft.proto.cpg.Cpg.CpgStruct.Edge.EdgeType
7-
import io.shiftleft.proto.cpg.Cpg.{CpgOverlay, CpgStruct, DiffGraph}
7+
import io.shiftleft.proto.cpg.Cpg.{CpgOverlay, CpgStruct}
88
import org.slf4j.{Logger, LoggerFactory}
99
import overflowdb.Config
1010

@@ -69,9 +69,6 @@ object ProtoCpgLoader {
6969
def loadOverlays(fileName: String): Try[Iterator[CpgOverlay]] =
7070
loadOverlays(fileName, CpgOverlay.parseFrom)
7171

72-
def loadDiffGraphs(fileName: String): Try[Iterator[DiffGraph]] =
73-
loadOverlays(fileName, DiffGraph.parseFrom)
74-
7572
private def loadOverlays[T <: GeneratedMessageV3](fileName: String, f: InputStream => T): Try[Iterator[T]] =
7673
Using(new ZipArchive(fileName)) { zip =>
7774
zip.entries

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ package io.shiftleft.passes
33
import com.google.protobuf.GeneratedMessageV3
44
import io.shiftleft.SerializedCpg
55
import io.shiftleft.codepropertygraph.Cpg
6-
import io.shiftleft.codepropertygraph.generated.nodes.{NewNode, StoredNode}
76
import org.slf4j.{Logger, LoggerFactory, MDC}
87
import overflowdb.BatchedUpdate
98

10-
import java.lang.{Long => JLong}
119
import java.util.function.{BiConsumer, Supplier}
1210
import scala.concurrent.duration.DurationLong
1311
import scala.util.{Failure, Success, Try}
@@ -244,14 +242,6 @@ trait CpgPassBase {
244242
}
245243
}
246244

247-
protected def serialize(appliedDiffGraph: AppliedDiffGraph, inverse: Boolean): GeneratedMessageV3 = {
248-
if (inverse) {
249-
new DiffGraphProtoSerializer().serialize(appliedDiffGraph.inverseDiffGraph.get)
250-
} else {
251-
new DiffGraphProtoSerializer().serialize(appliedDiffGraph)
252-
}
253-
}
254-
255245
protected def generateOutFileName(prefix: String, outName: String, index: Int): String = {
256246
val outputName = {
257247
if (outName.isEmpty) {
@@ -283,19 +273,3 @@ trait CpgPassBase {
283273
}
284274

285275
}
286-
287-
/** Diff Graph that has been applied to a source graph. This is a wrapper around diff graph, which additionally provides
288-
* a map from nodes to graph ids.
289-
*/
290-
case class AppliedDiffGraph(
291-
diffGraph: DiffGraph,
292-
inverseDiffGraph: Option[DiffGraph],
293-
private val nodeToOdbNode: java.util.IdentityHashMap[NewNode, StoredNode]
294-
) {
295-
296-
/** Obtain the id this node has in the applied graph
297-
*/
298-
def nodeToGraphId(node: NewNode): JLong = {
299-
nodeToOdbNode.get(node).id
300-
}
301-
}

0 commit comments

Comments
 (0)