From fe6655b0d91280da75702490723422647ba44032 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Mon, 12 Aug 2024 19:23:07 +0100 Subject: [PATCH] C#: More merge conflict fixes. --- .../dataflow/internal/DataFlowDispatch.qll | 20 +++++++++++++++++++ .../dataflow/internal/DataFlowPrivate.qll | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll index d67816e4c87..287c6a6b525 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll @@ -191,6 +191,16 @@ class DataFlowCallable extends TDataFlowCallable { or result = this.asCapturedVariable().getLocation() } + + /** Gets a best-effort total ordering. */ + int totalorder() { + this = + rank[result](DataFlowCallable c, string file, int startline, int startcolumn | + c.getLocation().hasLocationInfo(file, startline, startcolumn, _, _) + | + c order by file, startline, startcolumn + ) + } } /** A call relevant for data flow. */ @@ -237,6 +247,16 @@ abstract class DataFlowCall extends TDataFlowCall { ) { this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) } + + /** Gets a best-effort total ordering. */ + int totalorder() { + this = + rank[result](DataFlowCall c, int startline, int startcolumn | + c.hasLocationInfo(_, startline, startcolumn, _, _) + | + c order by startline, startcolumn + ) + } } /** A non-delegate C# call relevant for data flow. */ diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll index 4ad804e5049..5817af3c132 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowPrivate.qll @@ -2379,6 +2379,15 @@ class NodeRegion instanceof ControlFlow::BasicBlock { string toString() { result = "NodeRegion" } predicate contains(Node n) { this = n.getControlFlowNode().getBasicBlock() } + + int totalOrder() { + this = + rank[result](ControlFlow::BasicBlock b, int startline, int startcolumn | + b.getLocation().hasLocationInfo(_, startline, startcolumn, _, _) + | + b order by startline, startcolumn + ) + } } /**