File tree Expand file tree Collapse file tree 8 files changed +96
-0
lines changed
experimental/semmle/code/cpp/ir/dataflow/internal
csharp/ql/lib/semmle/code/csharp/dataflow/internal
java/ql/lib/semmle/code/java/dataflow/internal
python/ql/lib/semmle/python/dataflow/new/internal
ruby/ql/lib/codeql/ruby/dataflow/internal
swift/ql/lib/codeql/swift/dataflow/internal Expand file tree Collapse file tree 8 files changed +96
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
18
18
/** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
19
19
predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
20
20
21
+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22
+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23
+
21
24
/** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
22
25
predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
23
26
@@ -86,6 +89,15 @@ module Consistency {
86
89
)
87
90
}
88
91
92
+ query predicate uniqueCallEnclosingCallable ( DataFlowCall call , string msg ) {
93
+ exists ( int c |
94
+ c = count ( call .getEnclosingCallable ( ) ) and
95
+ c != 1 and
96
+ not any ( ConsistencyConfiguration conf ) .uniqueCallEnclosingCallableExclude ( call ) and
97
+ msg = "Call should have one enclosing callable but has " + c + "."
98
+ )
99
+ }
100
+
89
101
query predicate uniqueType ( Node n , string msg ) {
90
102
exists ( int c |
91
103
n instanceof RelevantNode and
You can’t perform that action at this time.
0 commit comments