Skip to content

Commit 273ef46

Browse files
authored
Merge pull request github#2080 from hvitved/dataflow/ap-tostring
Java/C++/C#: Tweak `AccessPathNil::toString()`
2 parents 48dee29 + 7f6e253 commit 273ef46

File tree

42 files changed

+614
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+614
-614
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ abstract private class AccessPath extends TAccessPath {
12611261

12621262
private class AccessPathNil extends AccessPath, TNil {
12631263
override string toString() {
1264-
exists(DataFlowType t | this = TNil(t) | result = concat(" : " + ppReprType(t)))
1264+
exists(DataFlowType t | this = TNil(t) | result = concat(": " + ppReprType(t)))
12651265
}
12661266

12671267
override AccessPathFront getFront() {
@@ -1277,7 +1277,7 @@ private class AccessPathConsNil extends AccessPathCons, TConsNil {
12771277
override string toString() {
12781278
exists(Content f, DataFlowType t | this = TConsNil(f, t) |
12791279
// The `concat` becomes "" if `ppReprType` has no result.
1280-
result = f.toString() + concat(" : " + ppReprType(t))
1280+
result = "[" + f.toString() + "]" + concat(" : " + ppReprType(t))
12811281
)
12821282
}
12831283

@@ -1294,8 +1294,8 @@ private class AccessPathConsCons extends AccessPathCons, TConsCons {
12941294
override string toString() {
12951295
exists(Content f1, Content f2, int len | this = TConsCons(f1, f2, len) |
12961296
if len = 2
1297-
then result = f1.toString() + ", " + f2.toString()
1298-
else result = f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")"
1297+
then result = "[" + f1.toString() + ", " + f2.toString() + "]"
1298+
else result = "[" + f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")]"
12991299
)
13001300
}
13011301

@@ -1626,7 +1626,7 @@ abstract class PathNode extends TPathNode {
16261626
this instanceof PathNodeSink and result = ""
16271627
or
16281628
exists(string s | s = this.(PathNodeMid).getAp().toString() |
1629-
if s = "" then result = "" else result = " [" + s + "]"
1629+
if s = "" then result = "" else result = " " + s
16301630
)
16311631
}
16321632

@@ -2071,7 +2071,7 @@ private module FlowExploration {
20712071

20722072
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20732073
override string toString() {
2074-
exists(DataFlowType t | this = TPartialNil(t) | result = concat(" : " + ppReprType(t)))
2074+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(": " + ppReprType(t)))
20752075
}
20762076

20772077
override AccessPathFront getFront() {
@@ -2083,8 +2083,8 @@ private module FlowExploration {
20832083
override string toString() {
20842084
exists(Content f, int len | this = TPartialCons(f, len) |
20852085
if len = 1
2086-
then result = f.toString()
2087-
else result = f.toString() + ", ... (" + len.toString() + ")"
2086+
then result = "[" + f.toString() + "]"
2087+
else result = "[" + f.toString() + ", ... (" + len.toString() + ")]"
20882088
)
20892089
}
20902090

@@ -2161,7 +2161,7 @@ private module FlowExploration {
21612161

21622162
private string ppAp() {
21632163
exists(string s | s = this.(PartialPathNodePriv).getAp().toString() |
2164-
if s = "" then result = "" else result = " [" + s + "]"
2164+
if s = "" then result = "" else result = " " + s
21652165
)
21662166
}
21672167

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ abstract private class AccessPath extends TAccessPath {
12611261

12621262
private class AccessPathNil extends AccessPath, TNil {
12631263
override string toString() {
1264-
exists(DataFlowType t | this = TNil(t) | result = concat(" : " + ppReprType(t)))
1264+
exists(DataFlowType t | this = TNil(t) | result = concat(": " + ppReprType(t)))
12651265
}
12661266

12671267
override AccessPathFront getFront() {
@@ -1277,7 +1277,7 @@ private class AccessPathConsNil extends AccessPathCons, TConsNil {
12771277
override string toString() {
12781278
exists(Content f, DataFlowType t | this = TConsNil(f, t) |
12791279
// The `concat` becomes "" if `ppReprType` has no result.
1280-
result = f.toString() + concat(" : " + ppReprType(t))
1280+
result = "[" + f.toString() + "]" + concat(" : " + ppReprType(t))
12811281
)
12821282
}
12831283

@@ -1294,8 +1294,8 @@ private class AccessPathConsCons extends AccessPathCons, TConsCons {
12941294
override string toString() {
12951295
exists(Content f1, Content f2, int len | this = TConsCons(f1, f2, len) |
12961296
if len = 2
1297-
then result = f1.toString() + ", " + f2.toString()
1298-
else result = f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")"
1297+
then result = "[" + f1.toString() + ", " + f2.toString() + "]"
1298+
else result = "[" + f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")]"
12991299
)
13001300
}
13011301

@@ -1626,7 +1626,7 @@ abstract class PathNode extends TPathNode {
16261626
this instanceof PathNodeSink and result = ""
16271627
or
16281628
exists(string s | s = this.(PathNodeMid).getAp().toString() |
1629-
if s = "" then result = "" else result = " [" + s + "]"
1629+
if s = "" then result = "" else result = " " + s
16301630
)
16311631
}
16321632

@@ -2071,7 +2071,7 @@ private module FlowExploration {
20712071

20722072
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20732073
override string toString() {
2074-
exists(DataFlowType t | this = TPartialNil(t) | result = concat(" : " + ppReprType(t)))
2074+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(": " + ppReprType(t)))
20752075
}
20762076

20772077
override AccessPathFront getFront() {
@@ -2083,8 +2083,8 @@ private module FlowExploration {
20832083
override string toString() {
20842084
exists(Content f, int len | this = TPartialCons(f, len) |
20852085
if len = 1
2086-
then result = f.toString()
2087-
else result = f.toString() + ", ... (" + len.toString() + ")"
2086+
then result = "[" + f.toString() + "]"
2087+
else result = "[" + f.toString() + ", ... (" + len.toString() + ")]"
20882088
)
20892089
}
20902090

@@ -2161,7 +2161,7 @@ private module FlowExploration {
21612161

21622162
private string ppAp() {
21632163
exists(string s | s = this.(PartialPathNodePriv).getAp().toString() |
2164-
if s = "" then result = "" else result = " [" + s + "]"
2164+
if s = "" then result = "" else result = " " + s
21652165
)
21662166
}
21672167

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ abstract private class AccessPath extends TAccessPath {
12611261

12621262
private class AccessPathNil extends AccessPath, TNil {
12631263
override string toString() {
1264-
exists(DataFlowType t | this = TNil(t) | result = concat(" : " + ppReprType(t)))
1264+
exists(DataFlowType t | this = TNil(t) | result = concat(": " + ppReprType(t)))
12651265
}
12661266

12671267
override AccessPathFront getFront() {
@@ -1277,7 +1277,7 @@ private class AccessPathConsNil extends AccessPathCons, TConsNil {
12771277
override string toString() {
12781278
exists(Content f, DataFlowType t | this = TConsNil(f, t) |
12791279
// The `concat` becomes "" if `ppReprType` has no result.
1280-
result = f.toString() + concat(" : " + ppReprType(t))
1280+
result = "[" + f.toString() + "]" + concat(" : " + ppReprType(t))
12811281
)
12821282
}
12831283

@@ -1294,8 +1294,8 @@ private class AccessPathConsCons extends AccessPathCons, TConsCons {
12941294
override string toString() {
12951295
exists(Content f1, Content f2, int len | this = TConsCons(f1, f2, len) |
12961296
if len = 2
1297-
then result = f1.toString() + ", " + f2.toString()
1298-
else result = f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")"
1297+
then result = "[" + f1.toString() + ", " + f2.toString() + "]"
1298+
else result = "[" + f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")]"
12991299
)
13001300
}
13011301

@@ -1626,7 +1626,7 @@ abstract class PathNode extends TPathNode {
16261626
this instanceof PathNodeSink and result = ""
16271627
or
16281628
exists(string s | s = this.(PathNodeMid).getAp().toString() |
1629-
if s = "" then result = "" else result = " [" + s + "]"
1629+
if s = "" then result = "" else result = " " + s
16301630
)
16311631
}
16321632

@@ -2071,7 +2071,7 @@ private module FlowExploration {
20712071

20722072
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20732073
override string toString() {
2074-
exists(DataFlowType t | this = TPartialNil(t) | result = concat(" : " + ppReprType(t)))
2074+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(": " + ppReprType(t)))
20752075
}
20762076

20772077
override AccessPathFront getFront() {
@@ -2083,8 +2083,8 @@ private module FlowExploration {
20832083
override string toString() {
20842084
exists(Content f, int len | this = TPartialCons(f, len) |
20852085
if len = 1
2086-
then result = f.toString()
2087-
else result = f.toString() + ", ... (" + len.toString() + ")"
2086+
then result = "[" + f.toString() + "]"
2087+
else result = "[" + f.toString() + ", ... (" + len.toString() + ")]"
20882088
)
20892089
}
20902090

@@ -2161,7 +2161,7 @@ private module FlowExploration {
21612161

21622162
private string ppAp() {
21632163
exists(string s | s = this.(PartialPathNodePriv).getAp().toString() |
2164-
if s = "" then result = "" else result = " [" + s + "]"
2164+
if s = "" then result = "" else result = " " + s
21652165
)
21662166
}
21672167

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ abstract private class AccessPath extends TAccessPath {
12611261

12621262
private class AccessPathNil extends AccessPath, TNil {
12631263
override string toString() {
1264-
exists(DataFlowType t | this = TNil(t) | result = concat(" : " + ppReprType(t)))
1264+
exists(DataFlowType t | this = TNil(t) | result = concat(": " + ppReprType(t)))
12651265
}
12661266

12671267
override AccessPathFront getFront() {
@@ -1277,7 +1277,7 @@ private class AccessPathConsNil extends AccessPathCons, TConsNil {
12771277
override string toString() {
12781278
exists(Content f, DataFlowType t | this = TConsNil(f, t) |
12791279
// The `concat` becomes "" if `ppReprType` has no result.
1280-
result = f.toString() + concat(" : " + ppReprType(t))
1280+
result = "[" + f.toString() + "]" + concat(" : " + ppReprType(t))
12811281
)
12821282
}
12831283

@@ -1294,8 +1294,8 @@ private class AccessPathConsCons extends AccessPathCons, TConsCons {
12941294
override string toString() {
12951295
exists(Content f1, Content f2, int len | this = TConsCons(f1, f2, len) |
12961296
if len = 2
1297-
then result = f1.toString() + ", " + f2.toString()
1298-
else result = f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")"
1297+
then result = "[" + f1.toString() + ", " + f2.toString() + "]"
1298+
else result = "[" + f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")]"
12991299
)
13001300
}
13011301

@@ -1626,7 +1626,7 @@ abstract class PathNode extends TPathNode {
16261626
this instanceof PathNodeSink and result = ""
16271627
or
16281628
exists(string s | s = this.(PathNodeMid).getAp().toString() |
1629-
if s = "" then result = "" else result = " [" + s + "]"
1629+
if s = "" then result = "" else result = " " + s
16301630
)
16311631
}
16321632

@@ -2071,7 +2071,7 @@ private module FlowExploration {
20712071

20722072
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20732073
override string toString() {
2074-
exists(DataFlowType t | this = TPartialNil(t) | result = concat(" : " + ppReprType(t)))
2074+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(": " + ppReprType(t)))
20752075
}
20762076

20772077
override AccessPathFront getFront() {
@@ -2083,8 +2083,8 @@ private module FlowExploration {
20832083
override string toString() {
20842084
exists(Content f, int len | this = TPartialCons(f, len) |
20852085
if len = 1
2086-
then result = f.toString()
2087-
else result = f.toString() + ", ... (" + len.toString() + ")"
2086+
then result = "[" + f.toString() + "]"
2087+
else result = "[" + f.toString() + ", ... (" + len.toString() + ")]"
20882088
)
20892089
}
20902090

@@ -2161,7 +2161,7 @@ private module FlowExploration {
21612161

21622162
private string ppAp() {
21632163
exists(string s | s = this.(PartialPathNodePriv).getAp().toString() |
2164-
if s = "" then result = "" else result = " [" + s + "]"
2164+
if s = "" then result = "" else result = " " + s
21652165
)
21662166
}
21672167

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ abstract private class AccessPath extends TAccessPath {
12611261

12621262
private class AccessPathNil extends AccessPath, TNil {
12631263
override string toString() {
1264-
exists(DataFlowType t | this = TNil(t) | result = concat(" : " + ppReprType(t)))
1264+
exists(DataFlowType t | this = TNil(t) | result = concat(": " + ppReprType(t)))
12651265
}
12661266

12671267
override AccessPathFront getFront() {
@@ -1277,7 +1277,7 @@ private class AccessPathConsNil extends AccessPathCons, TConsNil {
12771277
override string toString() {
12781278
exists(Content f, DataFlowType t | this = TConsNil(f, t) |
12791279
// The `concat` becomes "" if `ppReprType` has no result.
1280-
result = f.toString() + concat(" : " + ppReprType(t))
1280+
result = "[" + f.toString() + "]" + concat(" : " + ppReprType(t))
12811281
)
12821282
}
12831283

@@ -1294,8 +1294,8 @@ private class AccessPathConsCons extends AccessPathCons, TConsCons {
12941294
override string toString() {
12951295
exists(Content f1, Content f2, int len | this = TConsCons(f1, f2, len) |
12961296
if len = 2
1297-
then result = f1.toString() + ", " + f2.toString()
1298-
else result = f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")"
1297+
then result = "[" + f1.toString() + ", " + f2.toString() + "]"
1298+
else result = "[" + f1.toString() + ", " + f2.toString() + ", ... (" + len.toString() + ")]"
12991299
)
13001300
}
13011301

@@ -1626,7 +1626,7 @@ abstract class PathNode extends TPathNode {
16261626
this instanceof PathNodeSink and result = ""
16271627
or
16281628
exists(string s | s = this.(PathNodeMid).getAp().toString() |
1629-
if s = "" then result = "" else result = " [" + s + "]"
1629+
if s = "" then result = "" else result = " " + s
16301630
)
16311631
}
16321632

@@ -2071,7 +2071,7 @@ private module FlowExploration {
20712071

20722072
private class PartialAccessPathNil extends PartialAccessPath, TPartialNil {
20732073
override string toString() {
2074-
exists(DataFlowType t | this = TPartialNil(t) | result = concat(" : " + ppReprType(t)))
2074+
exists(DataFlowType t | this = TPartialNil(t) | result = concat(": " + ppReprType(t)))
20752075
}
20762076

20772077
override AccessPathFront getFront() {
@@ -2083,8 +2083,8 @@ private module FlowExploration {
20832083
override string toString() {
20842084
exists(Content f, int len | this = TPartialCons(f, len) |
20852085
if len = 1
2086-
then result = f.toString()
2087-
else result = f.toString() + ", ... (" + len.toString() + ")"
2086+
then result = "[" + f.toString() + "]"
2087+
else result = "[" + f.toString() + ", ... (" + len.toString() + ")]"
20882088
)
20892089
}
20902090

@@ -2161,7 +2161,7 @@ private module FlowExploration {
21612161

21622162
private string ppAp() {
21632163
exists(string s | s = this.(PartialPathNodePriv).getAp().toString() |
2164-
if s = "" then result = "" else result = " [" + s + "]"
2164+
if s = "" then result = "" else result = " " + s
21652165
)
21662166
}
21672167

0 commit comments

Comments
 (0)