Skip to content

Commit 02ad6c6

Browse files
committed
Move depth first order numbering of CFG nodes to codepropertygraph repo.
This is a preparation step to avoid calculation the depth first order numbering multiple times.
1 parent 0b1a92d commit 02ad6c6

File tree

1 file changed

+15
-0
lines changed
  • schema/src/main/scala/io/shiftleft/codepropertygraph/schema

1 file changed

+15
-0
lines changed

schema/src/main/scala/io/shiftleft/codepropertygraph/schema/Cfg.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.shiftleft.codepropertygraph.schema
22

33
import overflowdb.schema.EdgeType.Cardinality
4+
import overflowdb.schema.Property.ValueType
45
import overflowdb.schema.{SchemaBuilder, SchemaInfo}
56

67
object Cfg extends SchemaBase {
@@ -101,6 +102,20 @@ object Cfg extends SchemaBase {
101102

102103
methodRef.addOutEdge(edge = cfg, inNode = methodReturn)
103104
typeRef.addOutEdge(edge = cfg, inNode = methodReturn)
105+
106+
val depthFirstOrder = builder
107+
.addProperty(
108+
name = "DEPTH_FIRST_ORDER",
109+
valueType = ValueType.Int,
110+
comment = s"""The depth first ordering number. This is the reverse of a post order numbering.
111+
|Among other things this can be to detect retreating CFG edges and back edges
112+
|in reducible CFGs""".stripMargin
113+
)
114+
.mandatory(-1)
115+
.protoId(17)
116+
117+
cfgNode.addProperties(depthFirstOrder)
118+
104119
}
105120

106121
}

0 commit comments

Comments
 (0)