Skip to content

Commit

Permalink
Java: qldocs for CallGraph module
Browse files Browse the repository at this point in the history
  • Loading branch information
Jami Cogswell authored and Jami Cogswell committed Dec 17, 2024
1 parent 01ff4f4 commit c217d7f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,21 @@ module SqlExecuteConfig implements DataFlow::ConfigSig {
/** Tracks flow from SQL queries that update a database to the argument of an execute method call. */
module SqlExecuteFlow = TaintTracking::Global<SqlExecuteConfig>;

/** Provides classes and predicates representing call paths. */
module CallGraph {
newtype TCallPathNode =
private newtype TCallPathNode =
TMethod(Method m) or
TCall(Call c)

/** A node in a call path graph */
class CallPathNode extends TCallPathNode {
/** Gets the method corresponding to this `CallPathNode`, if any. */
Method asMethod() { this = TMethod(result) }

/** Gets the call corresponding to this `CallPathNode`, if any. */
Call asCall() { this = TCall(result) }

/** Gets the string representation of this `CallPathNode`. */
string toString() {
result = this.asMethod().toString()
or
Expand All @@ -145,6 +150,7 @@ module CallGraph {
[viableCallable(this.asCall()), this.asCall().getCallee()] = result.asMethod()
}

/** Gets a successor node of this `CallPathNode`, if any. */
CallPathNode getASuccessor() {
this.asMethod() = result.asCall().getEnclosingCallable()
or
Expand All @@ -159,13 +165,15 @@ module CallGraph {
)
}

/** Gets the location of this `CallPathNode`. */
Location getLocation() {
result = this.asMethod().getLocation()
or
result = this.asCall().getLocation()
}
}

/** Holds if `pred` has a successor node `succ`. */
predicate edges(CallPathNode pred, CallPathNode succ) { pred.getASuccessor() = succ }
}

Expand Down

0 comments on commit c217d7f

Please sign in to comment.