Skip to content

Commit e928c22

Browse files
committed
C#/Cfg: Some simple review fixes.
1 parent 88160ef commit e928c22

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowElement.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ControlFlowElement extends ControlFlowElementOrCallable, @control_flow_ele
3838
*/
3939
ControlFlowNodes::ElementNode getAControlFlowNode() { result = this.getControlFlowNode() }
4040

41-
/** Gets the control flow node for this element. */
41+
/** Gets the control flow node for this element, if any. */
4242
ControlFlowNode getControlFlowNode() { result.injects(this) }
4343

4444
/** Gets the basic block in which this element occurs. */

csharp/ql/lib/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ private module Initializers {
277277
*/
278278
Expr initializedStaticMemberOrder(Constructor staticCtor, int i) {
279279
result =
280-
rank[i + 1](Expr init, Location l |
280+
rank[i + 1](Expr init, Location l, string filepath, int startline, int startcolumn |
281281
staticMemberInitializer(staticCtor, init) and
282-
l = init.getLocation()
282+
l = init.getLocation() and
283+
l.hasLocationInfo(filepath, startline, startcolumn, _, _)
283284
|
284-
init order by l.getStartLine(), l.getStartColumn(), l.getFile().getAbsolutePath()
285+
init order by startline, startcolumn, filepath
285286
)
286287
}
287288

@@ -292,12 +293,13 @@ private module Initializers {
292293
AssignExpr initializedInstanceMemberOrder(ObjectInitMethod obinit, CompilationExt comp, int i) {
293294
obinit.initializes(result) and
294295
result =
295-
rank[i + 1](AssignExpr ae0, Location l |
296+
rank[i + 1](AssignExpr ae0, Location l, string filepath, int startline, int startcolumn |
296297
obinit.initializes(ae0) and
297298
l = ae0.getLocation() and
299+
l.hasLocationInfo(filepath, startline, startcolumn, _, _) and
298300
getCompilation(l.getFile()) = comp
299301
|
300-
ae0 order by l.getStartLine(), l.getStartColumn(), l.getFile().getAbsolutePath()
302+
ae0 order by startline, startcolumn, filepath
301303
)
302304
}
303305

csharp/ql/lib/semmle/code/csharp/controlflow/internal/Completion.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@
2121

2222
import csharp
2323
private import semmle.code.csharp.commons.Assertions
24-
private import semmle.code.csharp.commons.Constants
2524
private import semmle.code.csharp.frameworks.System
2625
private import NonReturning
27-
private import SuccessorType
2826

2927
private class Overflowable extends UnaryOperation {
3028
Overflowable() {

shared/controlflow/codeql/controlflow/ControlFlowGraph.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,7 +1990,7 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
19901990

19911991
/** Holds if `n` does not have a unique enclosing callable. */
19921992
query predicate nonUniqueEnclosingCallable(AstNode n, int callables) {
1993-
callables = strictcount(getEnclosingCallable(n)) and callables > 1
1993+
callables = count(getEnclosingCallable(n)) and callables != 1
19941994
}
19951995

19961996
/**

0 commit comments

Comments
 (0)