Skip to content

Commit

Permalink
Move depth first order numbering of CFG nodes to codepropertygraph repo.
Browse files Browse the repository at this point in the history
This is a preparation step to avoid calculation the depth first order
numbering multiple times.
  • Loading branch information
ml86 committed Nov 11, 2022
1 parent 0b1a92d commit 02ad6c6
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.shiftleft.codepropertygraph.schema

import overflowdb.schema.EdgeType.Cardinality
import overflowdb.schema.Property.ValueType
import overflowdb.schema.{SchemaBuilder, SchemaInfo}

object Cfg extends SchemaBase {
Expand Down Expand Up @@ -101,6 +102,20 @@ object Cfg extends SchemaBase {

methodRef.addOutEdge(edge = cfg, inNode = methodReturn)
typeRef.addOutEdge(edge = cfg, inNode = methodReturn)

val depthFirstOrder = builder
.addProperty(
name = "DEPTH_FIRST_ORDER",
valueType = ValueType.Int,
comment = s"""The depth first ordering number. This is the reverse of a post order numbering.
|Among other things this can be to detect retreating CFG edges and back edges
|in reducible CFGs""".stripMargin
)
.mandatory(-1)
.protoId(17)

cfgNode.addProperties(depthFirstOrder)

}

}

0 comments on commit 02ad6c6

Please sign in to comment.