@@ -17,13 +17,19 @@ private import codeql.rust.dataflow.FlowSummary
17
17
private import Node as Node
18
18
private import DataFlowImpl
19
19
private import FlowSummaryImpl as FlowSummaryImpl
20
+ private import codeql.rust.internal.CachedStages
20
21
21
22
/** An element, viewed as a node in a data flow graph. */
22
- abstract class NodePublic extends TNode {
23
+ // It is important to not make this class `abstract`, as it otherwise results in
24
+ // a needless charpred, which will result in recomputation of internal non-cached
25
+ // predicates
26
+ class NodePublic extends TNode {
23
27
/** Gets the location of this node. */
28
+ cached
24
29
abstract Location getLocation ( ) ;
25
30
26
31
/** Gets a textual representation of this node. */
32
+ cached
27
33
abstract string toString ( ) ;
28
34
29
35
/**
@@ -55,17 +61,6 @@ abstract class Node extends NodePublic {
55
61
CfgNode getCfgNode ( ) { none ( ) }
56
62
}
57
63
58
- /** A node type that is not implemented. */
59
- final class NaNode extends Node {
60
- NaNode ( ) { none ( ) }
61
-
62
- override CfgScope getCfgScope ( ) { none ( ) }
63
-
64
- override string toString ( ) { result = "N/A" }
65
-
66
- override Location getLocation ( ) { none ( ) }
67
- }
68
-
69
64
/** A data flow node used to model flow summaries. */
70
65
class FlowSummaryNode extends Node , TFlowSummaryNode {
71
66
FlowSummaryImpl:: Private:: SummaryNode getSummaryNode ( ) { this = TFlowSummaryNode ( result ) }
@@ -108,6 +103,7 @@ class FlowSummaryNode extends Node, TFlowSummaryNode {
108
103
}
109
104
110
105
override Location getLocation ( ) {
106
+ Stages:: DataFlowStage:: ref ( ) and
111
107
exists ( this .getSummarizedCallable ( ) ) and
112
108
result instanceof EmptyLocation
113
109
or
@@ -116,7 +112,10 @@ class FlowSummaryNode extends Node, TFlowSummaryNode {
116
112
result = this .getSinkElement ( ) .getLocation ( )
117
113
}
118
114
119
- override string toString ( ) { result = this .getSummaryNode ( ) .toString ( ) }
115
+ override string toString ( ) {
116
+ Stages:: DataFlowStage:: ref ( ) and
117
+ result = this .getSummaryNode ( ) .toString ( )
118
+ }
120
119
}
121
120
122
121
/** A data flow node that corresponds directly to a CFG node for an AST node. */
@@ -440,9 +439,9 @@ private class CapturePostUpdateNode extends PostUpdateNode, CaptureNode {
440
439
final override string toString ( ) { result = PostUpdateNode .super .toString ( ) }
441
440
}
442
441
443
- final class CastNode = NaNode ;
444
-
445
- private import codeql.rust.internal.CachedStages
442
+ final class CastNode extends ExprNode {
443
+ CastNode ( ) { none ( ) }
444
+ }
446
445
447
446
cached
448
447
newtype TNode =
0 commit comments