Skip to content

Commit 6648c84

Browse files
authored
Merge pull request #680 from hvitved/csharp/data-flow-performance-tweaks
C#: Minor data flow performance tweaks
2 parents dbd0c7e + b155a0f commit 6648c84

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

csharp/ql/src/semmle/code/csharp/dataflow/DataFlow.qll

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module DataFlow {
2828
DotNet::Type getType() { none() }
2929

3030
/** Gets the enclosing callable of this node. */
31+
cached
3132
DotNet::Callable getEnclosingCallable() { none() }
3233

3334
/** Gets a textual representation of this node. */
@@ -52,9 +53,19 @@ module DataFlow {
5253

5354
override DotNet::Callable getEnclosingCallable() { result = expr.getEnclosingCallable() }
5455

55-
override string toString() { result = expr.toString() }
56+
override string toString() {
57+
result = expr.(Expr).toString()
58+
or
59+
expr instanceof CIL::Expr and
60+
result = "CIL expression"
61+
}
5662

57-
override Location getLocation() { result = expr.getLocation() }
63+
override Location getLocation() {
64+
result = expr.(Expr).getLocation()
65+
or
66+
result.getFile().isPdbSourceFile() and
67+
result = expr.(CIL::Expr).getALocation()
68+
}
5869
}
5970

6071
/**

0 commit comments

Comments
 (0)