Skip to content

Commit 5f30d4c

Browse files
committed
SSA: Add missing QL doc
1 parent 8e5d6ba commit 5f30d4c

File tree

1 file changed

+7
-1
lines changed
  • shared/ql/lib/codeql/shared/dataflow

1 file changed

+7
-1
lines changed

shared/ql/lib/codeql/shared/dataflow/Ssa.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ module Make<InputSig Input> {
573573
private import SsaDefReaches
574574

575575
pragma[nomagic]
576-
predicate liveThrough(BasicBlock bb, SourceVariable v) {
576+
private predicate liveThrough(BasicBlock bb, SourceVariable v) {
577577
liveAtExit(bb, v) and
578578
not ssaRef(bb, _, v, SsaDef())
579579
}
@@ -847,29 +847,35 @@ module Make<InputSig Input> {
847847
// TODO: Make these `query` predicates once class signatures are supported
848848
// (`SourceVariable` and `BasicBlock` must have `toString`)
849849
module Consistency {
850+
/** A definition that is relevant for the consistency queries. */
850851
abstract class RelevantDefinition extends Definition {
852+
/** Override this predicate to ensure locations in consistency results. */
851853
abstract predicate hasLocationInfo(
852854
string filepath, int startline, int startcolumn, int endline, int endcolumn
853855
);
854856
}
855857

858+
/** Holds if a read can be reached from multiple definitions. */
856859
predicate nonUniqueDef(RelevantDefinition def, SourceVariable v, BasicBlock bb, int i) {
857860
ssaDefReachesRead(v, def, bb, i) and
858861
not exists(unique(Definition def0 | ssaDefReachesRead(v, def0, bb, i)))
859862
}
860863

864+
/** Holds if a read cannot be reached from a definition. */
861865
predicate readWithoutDef(SourceVariable v, BasicBlock bb, int i) {
862866
variableRead(bb, i, v, _) and
863867
not ssaDefReachesRead(v, _, bb, i)
864868
}
865869

870+
/** Holds if a definition cannot reach a read. */
866871
predicate deadDef(RelevantDefinition def, SourceVariable v) {
867872
v = def.getSourceVariable() and
868873
not ssaDefReachesRead(_, def, _, _) and
869874
not phiHasInputFromBlock(_, def, _) and
870875
not uncertainWriteDefinitionInput(_, def)
871876
}
872877

878+
/** Holds if a read is not dominated by a definition. */
873879
predicate notDominatedByDef(RelevantDefinition def, SourceVariable v, BasicBlock bb, int i) {
874880
exists(BasicBlock bbDef, int iDef | def.definesAt(v, bbDef, iDef) |
875881
ssaDefReachesReadWithinBlock(v, def, bb, i) and

0 commit comments

Comments
 (0)