Skip to content

Commit a371205

Browse files
committed
Data flow: Sync files
1 parent 8c9f85d commit a371205

File tree

18 files changed

+360
-54
lines changed

18 files changed

+360
-54
lines changed

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,14 +2098,31 @@ class PathNode extends TPathNode {
20982098
/** Gets the associated configuration. */
20992099
Configuration getConfiguration() { none() }
21002100

2101+
private predicate isHidden() {
2102+
nodeIsHidden(this.getNode()) and
2103+
not this.isSource() and
2104+
not this instanceof PathNodeSink
2105+
}
2106+
2107+
private PathNode getASuccessorIfHidden() {
2108+
this.isHidden() and
2109+
result = this.(PathNodeImpl).getASuccessorImpl()
2110+
}
2111+
21012112
/** Gets a successor of this node, if any. */
2102-
PathNode getASuccessor() { none() }
2113+
final PathNode getASuccessor() {
2114+
result = this.(PathNodeImpl).getASuccessorImpl().getASuccessorIfHidden*() and
2115+
not this.isHidden() and
2116+
not result.isHidden()
2117+
}
21032118

21042119
/** Holds if this node is a source. */
21052120
predicate isSource() { none() }
21062121
}
21072122

21082123
abstract private class PathNodeImpl extends PathNode {
2124+
abstract PathNode getASuccessorImpl();
2125+
21092126
private string ppAp() {
21102127
this instanceof PathNodeSink and result = ""
21112128
or
@@ -2180,7 +2197,7 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
21802197
result.getConfiguration() = unbind(this.getConfiguration())
21812198
}
21822199

2183-
override PathNodeImpl getASuccessor() {
2200+
override PathNodeImpl getASuccessorImpl() {
21842201
// an intermediate step to another intermediate node
21852202
result = getSuccMid()
21862203
or
@@ -2217,7 +2234,7 @@ private class PathNodeSink extends PathNodeImpl, TPathNodeSink {
22172234

22182235
override Configuration getConfiguration() { result = config }
22192236

2220-
override PathNode getASuccessor() { none() }
2237+
override PathNode getASuccessorImpl() { none() }
22212238

22222239
override predicate isSource() { config.isSource(node) }
22232240
}

0 commit comments

Comments
 (0)