Skip to content

Commit 703a54c

Browse files
committed
C#: Update some references to ControlFlow::Nodes.
1 parent c8c811c commit 703a54c

File tree

5 files changed

+26
-34
lines changed

5 files changed

+26
-34
lines changed

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ class Callable extends Parameterizable, ControlFlowElementOrCallable, @callable
157157
final predicate hasExpressionBody() { exists(this.getExpressionBody()) }
158158

159159
/** Gets the entry point in the control graph for this callable. */
160-
ControlFlow::Nodes::EntryNode getEntryPoint() { result.getCallable() = this }
160+
ControlFlow::EntryNode getEntryPoint() { result.getEnclosingCallable() = this }
161161

162162
/** Gets the exit point in the control graph for this callable. */
163-
ControlFlow::Nodes::ExitNode getExitPoint() { result.getCallable() = this }
163+
ControlFlow::ExitNode getExitPoint() { result.getEnclosingCallable() = this }
164164

165165
/**
166166
* Gets the enclosing callable of this callable, if any.

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

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -234,37 +234,29 @@ module ControlFlow {
234234
final Callable getEnclosingCallable() { result = Impl::getNodeCfgScope(this) }
235235
}
236236

237-
/** Provides different types of control flow nodes. */
238-
module Nodes {
239-
/** A node for a callable entry point. */
240-
class EntryNode extends Node instanceof Impl::EntryNode {
241-
/** Gets the callable that this entry applies to. */
242-
Callable getCallable() { result = this.getScope() }
243-
244-
override BasicBlocks::EntryBlock getBasicBlock() { result = Node.super.getBasicBlock() }
245-
}
246-
247-
/** A node for a callable exit point, annotated with the type of exit. */
248-
class AnnotatedExitNode extends Node instanceof Impl::AnnotatedExitNode {
249-
/** Gets the callable that this exit applies to. */
250-
Callable getCallable() { result = this.getScope() }
251-
252-
override BasicBlocks::AnnotatedExitBlock getBasicBlock() {
253-
result = Node.super.getBasicBlock()
254-
}
255-
}
237+
/** A node for a callable entry point. */
238+
class EntryNode extends Node instanceof Impl::EntryNode {
239+
/** Gets the callable that this entry applies to. */
240+
Callable getEnclosingCallable() { result = this.getScope() }
241+
}
256242

257-
/** A control flow node indicating normal termination of a callable. */
258-
class NormalExitNode extends AnnotatedExitNode instanceof Impl::NormalExitNode { }
243+
/** A node for a callable exit point, annotated with the type of exit. */
244+
class AnnotatedExitNode extends Node instanceof Impl::AnnotatedExitNode {
245+
/** Gets the callable that this exit applies to. */
246+
Callable getEnclosingCallable() { result = this.getScope() }
247+
}
259248

260-
/** A node for a callable exit point. */
261-
class ExitNode extends Node instanceof Impl::ExitNode {
262-
/** Gets the callable that this exit applies to. */
263-
Callable getCallable() { result = this.getScope() }
249+
/** A control flow node indicating normal termination of a callable. */
250+
class NormalExitNode extends AnnotatedExitNode instanceof Impl::NormalExitNode { }
264251

265-
override BasicBlocks::ExitBlock getBasicBlock() { result = Node.super.getBasicBlock() }
266-
}
252+
/** A node for a callable exit point. */
253+
class ExitNode extends Node instanceof Impl::ExitNode {
254+
/** Gets the callable that this exit applies to. */
255+
Callable getEnclosingCallable() { result = this.getScope() }
256+
}
267257

258+
/** Provides different types of control flow nodes. */
259+
module Nodes {
268260
/**
269261
* A node for a control flow element, that is, an expression or a statement.
270262
*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private module GuardsInput implements
2020
{
2121
private import csharp as CS
2222

23-
class NormalExitNode = ControlFlow::Nodes::NormalExitNode;
23+
class NormalExitNode = ControlFlow::NormalExitNode;
2424

2525
class AstNode = ControlFlowElement;
2626

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowDispatch.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ newtype TReturnKind =
2828
private predicate hasMultipleSourceLocations(Callable c) { strictcount(getASourceLocation(c)) > 1 }
2929

3030
private predicate objectInitEntry(ObjectInitMethod m, ControlFlowElement first) {
31-
exists(ControlFlow::Nodes::EntryNode en |
32-
en.getCallable() = m and first.getControlFlowNode() = en.getASuccessor()
31+
exists(ControlFlow::EntryNode en |
32+
en.getEnclosingCallable() = m and first.getControlFlowNode() = en.getASuccessor()
3333
)
3434
}
3535

csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,11 @@ private module SourceVariableImpl {
187187
* ```
188188
*/
189189
predicate outRefExitRead(ControlFlow::BasicBlock bb, int i, LocalScopeSourceVariable v) {
190-
exists(ControlFlow::Nodes::NormalExitNode exit |
190+
exists(ControlFlow::NormalExitNode exit |
191191
exists(LocalScopeVariable lsv |
192192
lsv = v.getAssignable() and
193193
bb.getNode(i) = exit and
194-
exit.getCallable() = lsv.getCallable()
194+
exit.getEnclosingCallable() = lsv.getCallable()
195195
|
196196
lsv.(Parameter).isOutOrRef()
197197
or

0 commit comments

Comments
 (0)