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 {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ module Consistency {
1818 /** Holds if `n` should be excluded from the consistency test `uniqueEnclosingCallable`. */
1919 predicate uniqueEnclosingCallableExclude ( Node n ) { none ( ) }
2020
21+ /** Holds if `call` should be excluded from the consistency test `uniqueCallEnclosingCallable`. */
22+ predicate uniqueCallEnclosingCallableExclude ( DataFlowCall call ) { none ( ) }
23+
2124 /** Holds if `n` should be excluded from the consistency test `uniqueNodeLocation`. */
2225 predicate uniqueNodeLocationExclude ( Node n ) { none ( ) }
2326
@@ -86,6 +89,15 @@ module Consistency {
8689 )
8790 }
8891
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+
89101 query predicate uniqueType ( Node n , string msg ) {
90102 exists ( int c |
91103 n instanceof RelevantNode and
You can’t perform that action at this time.
0 commit comments