Skip to content

Commit 2d616d4

Browse files
committed
C#/Ruby: Add fields as per review comments.
1 parent 577bbd5 commit 2d616d4

File tree

8 files changed

+40
-33
lines changed

8 files changed

+40
-33
lines changed

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,16 +1125,14 @@ private module ParameterNodes {
11251125

11261126
/** A parameter for a library callable with a flow summary. */
11271127
class SummaryParameterNode extends ParameterNodeImpl, FlowSummaryNode {
1128-
SummaryParameterNode() {
1129-
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), _)
1130-
}
1128+
private ParameterPosition pos_;
11311129

1132-
private ParameterPosition getPosition() {
1133-
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), result)
1130+
SummaryParameterNode() {
1131+
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), pos_)
11341132
}
11351133

11361134
override predicate isParameterOf(DataFlowCallable c, ParameterPosition pos) {
1137-
this.getSummarizedCallable() = c.asSummarizedCallable() and pos = this.getPosition()
1135+
this.getSummarizedCallable() = c.asSummarizedCallable() and pos = pos_
11381136
}
11391137
}
11401138
}
@@ -1305,12 +1303,15 @@ private module ArgumentNodes {
13051303
}
13061304

13071305
private class SummaryArgumentNode extends FlowSummaryNode, ArgumentNodeImpl {
1306+
private DataFlowCall call_;
1307+
private ArgumentPosition pos_;
1308+
13081309
SummaryArgumentNode() {
1309-
FlowSummaryImpl::Private::summaryArgumentNode(_, this.getSummaryNode(), _)
1310+
FlowSummaryImpl::Private::summaryArgumentNode(call_, this.getSummaryNode(), pos_)
13101311
}
13111312

13121313
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
1313-
FlowSummaryImpl::Private::summaryArgumentNode(call, this.getSummaryNode(), pos)
1314+
call = call_ and pos = pos_
13141315
}
13151316
}
13161317
}
@@ -1593,11 +1594,14 @@ private module OutNodes {
15931594
}
15941595

15951596
private class SummaryOutNode extends FlowSummaryNode, OutNode {
1596-
SummaryOutNode() { FlowSummaryImpl::Private::summaryOutNode(_, this.getSummaryNode(), _) }
1597+
private DataFlowCall call;
1598+
private ReturnKind kind_;
15971599

1598-
override DataFlowCall getCall(ReturnKind kind) {
1599-
FlowSummaryImpl::Private::summaryOutNode(result, this.getSummaryNode(), kind)
1600+
SummaryOutNode() {
1601+
FlowSummaryImpl::Private::summaryOutNode(call, this.getSummaryNode(), kind_)
16001602
}
1603+
1604+
override DataFlowCall getCall(ReturnKind kind) { result = call and kind = kind_ }
16011605
}
16021606
}
16031607

@@ -2120,15 +2124,14 @@ private module PostUpdateNodes {
21202124
}
21212125

21222126
private class SummaryPostUpdateNode extends FlowSummaryNode, PostUpdateNode {
2127+
private FlowSummaryImpl::Private::SummaryNode preUpdateNode;
2128+
21232129
SummaryPostUpdateNode() {
2124-
FlowSummaryImpl::Private::summaryPostUpdateNode(this.getSummaryNode(), _) and
2130+
FlowSummaryImpl::Private::summaryPostUpdateNode(this.getSummaryNode(), preUpdateNode) and
21252131
not summaryPostUpdateNodeIsOutOrRef(this, _)
21262132
}
21272133

2128-
override Node getPreUpdateNode() {
2129-
FlowSummaryImpl::Private::summaryPostUpdateNode(this.getSummaryNode(),
2130-
result.(FlowSummaryNode).getSummaryNode())
2131-
}
2134+
override Node getPreUpdateNode() { result.(FlowSummaryNode).getSummaryNode() = preUpdateNode }
21322135
}
21332136
}
21342137

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowPrivate.qll

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -751,18 +751,16 @@ private module ParameterNodes {
751751

752752
/** A parameter for a library callable with a flow summary. */
753753
class SummaryParameterNode extends ParameterNodeImpl, FlowSummaryNode {
754-
SummaryParameterNode() {
755-
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), _)
756-
}
754+
private ParameterPosition pos_;
757755

758-
private ParameterPosition getPosition() {
759-
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), result)
756+
SummaryParameterNode() {
757+
FlowSummaryImpl::Private::summaryParameterNode(this.getSummaryNode(), pos_)
760758
}
761759

762760
override Parameter getParameter() { none() }
763761

764762
override predicate isParameterOf(DataFlowCallable c, ParameterPosition pos) {
765-
this.getSummarizedCallable() = c.asLibraryCallable() and pos = this.getPosition()
763+
this.getSummarizedCallable() = c.asLibraryCallable() and pos = pos_
766764
}
767765
}
768766
}
@@ -847,16 +845,19 @@ private module ArgumentNodes {
847845
}
848846

849847
private class SummaryArgumentNode extends FlowSummaryNode, ArgumentNode {
848+
private DataFlowCall call_;
849+
private ArgumentPosition pos_;
850+
850851
SummaryArgumentNode() {
851-
FlowSummaryImpl::Private::summaryArgumentNode(_, this.getSummaryNode(), _)
852+
FlowSummaryImpl::Private::summaryArgumentNode(call_, this.getSummaryNode(), pos_)
852853
}
853854

854855
override predicate sourceArgumentOf(CfgNodes::ExprNodes::CallCfgNode call, ArgumentPosition pos) {
855856
none()
856857
}
857858

858859
override predicate argumentOf(DataFlowCall call, ArgumentPosition pos) {
859-
FlowSummaryImpl::Private::summaryArgumentNode(call, this.getSummaryNode(), pos)
860+
call = call_ and pos = pos_
860861
}
861862
}
862863

@@ -1063,11 +1064,14 @@ private module OutNodes {
10631064
}
10641065

10651066
private class SummaryOutNode extends FlowSummaryNode, OutNode {
1066-
SummaryOutNode() { FlowSummaryImpl::Private::summaryOutNode(_, this.getSummaryNode(), _) }
1067+
private DataFlowCall call;
1068+
private ReturnKind kind_;
10671069

1068-
override DataFlowCall getCall(ReturnKind kind) {
1069-
FlowSummaryImpl::Private::summaryOutNode(result, this.getSummaryNode(), kind)
1070+
SummaryOutNode() {
1071+
FlowSummaryImpl::Private::summaryOutNode(call, this.getSummaryNode(), kind_)
10701072
}
1073+
1074+
override DataFlowCall getCall(ReturnKind kind) { result = call and kind = kind_ }
10711075
}
10721076
}
10731077

ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ module Private {
570570
summaryParameterNodeRange(c, pos)
571571
}
572572

573-
class SummaryNode extends TSummaryNode {
573+
abstract class SummaryNode extends TSummaryNode {
574574
abstract string toString();
575575

576576
abstract SummarizedCallable getSummarizedCallable();

0 commit comments

Comments
 (0)