Skip to content

Commit 837df2a

Browse files
committed
Dataflow: Sync.
1 parent 58cd165 commit 837df2a

File tree

7 files changed

+140
-21
lines changed

7 files changed

+140
-21
lines changed

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

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

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,7 @@ module Impl<FullStateConfigSig Config> {
27062706

27072707
ParamNodeEx getParamNode() { result = p }
27082708

2709-
override string toString() { result = p + ": " + ap }
2709+
override string toString() { result = p + concat(" : " + ppReprType(t)) + " " + ap }
27102710

27112711
predicate hasLocationInfo(
27122712
string filepath, int startline, int startcolumn, int endline, int endcolumn
@@ -2758,12 +2758,21 @@ module Impl<FullStateConfigSig Config> {
27582758
)
27592759
}
27602760

2761+
private predicate forceUnfold(AccessPathApprox apa) {
2762+
forceHighPrecision(apa.getHead())
2763+
or
2764+
exists(Content c2 |
2765+
apa = TConsCons(_, _, c2, _) and
2766+
forceHighPrecision(c2)
2767+
)
2768+
}
2769+
27612770
/**
27622771
* Holds with `unfold = false` if a precise head-tail representation of `apa` is
27632772
* expected to be expensive. Holds with `unfold = true` otherwise.
27642773
*/
27652774
private predicate evalUnfold(AccessPathApprox apa, boolean unfold) {
2766-
if forceHighPrecision(apa.getHead())
2775+
if forceUnfold(apa)
27672776
then unfold = true
27682777
else
27692778
exists(int aps, int nodes, int apLimit, int tupleLimit |
@@ -3092,6 +3101,12 @@ module Impl<FullStateConfigSig Config> {
30923101
result = " <" + this.(PathNodeMid).getCallContext().toString() + ">"
30933102
}
30943103

3104+
private string ppSummaryCtx() {
3105+
this instanceof PathNodeSink and result = ""
3106+
or
3107+
result = " <" + this.(PathNodeMid).getSummaryCtx().toString() + ">"
3108+
}
3109+
30953110
/** Gets a textual representation of this element. */
30963111
string toString() { result = this.getNodeEx().toString() + this.ppType() + this.ppAp() }
30973112

@@ -3100,7 +3115,9 @@ module Impl<FullStateConfigSig Config> {
31003115
* representation of the call context.
31013116
*/
31023117
string toStringWithContext() {
3103-
result = this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx()
3118+
result =
3119+
this.getNodeEx().toString() + this.ppType() + this.ppAp() + this.ppCtx() +
3120+
this.ppSummaryCtx()
31043121
}
31053122

31063123
/**

0 commit comments

Comments
 (0)