Skip to content

Commit c8a6798

Browse files
committed
Ruby: Workaround for optimiser problem.
A size 1 DataFlowType causes misoptimisations.
1 parent ef714f7 commit c8a6798

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,14 +710,16 @@ predicate clearsContent(Node n, Content c) {
710710
FlowSummaryImpl::Private::Steps::summaryClearsContent(n, c)
711711
}
712712

713-
private newtype TDataFlowType = TTodoDataFlowType()
713+
private newtype TDataFlowType =
714+
TTodoDataFlowType() or
715+
TTodoDataFlowType2()
714716

715717
class DataFlowType extends TDataFlowType {
716718
string toString() { result = "" }
717719
}
718720

719721
/** Gets the type of `n` used for type pruning. */
720-
DataFlowType getNodeType(NodeImpl n) { any() }
722+
DataFlowType getNodeType(NodeImpl n) { result = TTodoDataFlowType() and exists(n) }
721723

722724
/** Gets a string representation of a `DataFlowType`. */
723725
string ppReprType(DataFlowType t) { result = t.toString() }

0 commit comments

Comments
 (0)