File tree Expand file tree Collapse file tree 6 files changed +25
-15
lines changed
csharp/ql/src/utils/modelgenerator/internal
java/ql/src/utils/modelgenerator/internal Expand file tree Collapse file tree 6 files changed +25
-15
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ private import CaptureModelsSpecific
77private import CaptureModelsPrinting
88
99class DataFlowTargetApi extends TargetApiSpecific {
10- DataFlowTargetApi ( ) { isRelevantForDataFlowModels ( this ) }
10+ DataFlowTargetApi ( ) { not isUninterestingForDataFlowModels ( this ) }
1111}
1212
1313private module Printing implements PrintingSig {
Original file line number Diff line number Diff line change @@ -51,16 +51,18 @@ private predicate isRelevantForModels(CS::Callable api) {
5151}
5252
5353/**
54- * Holds if it is relevant to generate models for `api` based on data flow analysis.
54+ * Holds if it is irrelevant to generate models for `api` based on data flow analysis.
55+ *
56+ * This serves as an extra filter for the `relevant` predicate.
5557 */
56- predicate isRelevantForDataFlowModels ( CS:: Callable api ) {
57- isRelevantForModels ( api ) and not isHigherOrder ( api )
58- }
58+ predicate isUninterestingForDataFlowModels ( CS:: Callable api ) { isHigherOrder ( api ) }
5959
6060/**
61- * Holds if it is relevant to generate models for `api` based on its type.
61+ * Holds if it is irrelevant to generate models for `api` based on type-based analysis.
62+ *
63+ * This serves as an extra filter for the `relevant` predicate.
6264 */
63- predicate isRelevantForTypeBasedFlowModels = isRelevantForModels / 1 ;
65+ predicate isUninterestingForTypeBasedFlowModels ( CS :: Callable api ) { none ( ) }
6466
6567/**
6668 * A class of callables that are relevant generating summary, source and sinks models for.
@@ -71,7 +73,8 @@ predicate isRelevantForTypeBasedFlowModels = isRelevantForModels/1;
7173class TargetApiSpecific extends CS:: Callable {
7274 TargetApiSpecific ( ) {
7375 this .fromSource ( ) and
74- this .isUnboundDeclaration ( )
76+ this .isUnboundDeclaration ( ) and
77+ isRelevantForModels ( this )
7578 }
7679}
7780
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ private module ModelPrinting = PrintingImpl<Printing>;
190190 * on the Theorems for Free approach.
191191 */
192192class TypeBasedFlowTargetApi extends Specific:: TargetApiSpecific {
193- TypeBasedFlowTargetApi ( ) { Specific:: isRelevantForTypeBasedFlowModels ( this ) }
193+ TypeBasedFlowTargetApi ( ) { not Specific:: isUninterestingForTypeBasedFlowModels ( this ) }
194194
195195 /**
196196 * Gets the string representation of all type based summaries for `this`
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ private import CaptureModelsSpecific
77private import CaptureModelsPrinting
88
99class DataFlowTargetApi extends TargetApiSpecific {
10- DataFlowTargetApi ( ) { isRelevantForDataFlowModels ( this ) }
10+ DataFlowTargetApi ( ) { not isUninterestingForDataFlowModels ( this ) }
1111}
1212
1313private module Printing implements PrintingSig {
Original file line number Diff line number Diff line change @@ -63,13 +63,20 @@ private predicate hasManualModel(Callable api) {
6363}
6464
6565/**
66- * Holds if it is relevant to generate models for `api` based on data flow analysis.
66+ * Holds if it is irrelevant to generate models for `api` based on data flow analysis.
67+ *
68+ * This serves as an extra filter for the `relevant` predicate.
6769 */
68- predicate isRelevantForDataFlowModels ( Callable api ) {
69- ( not api .getDeclaringType ( ) instanceof J:: Interface or exists ( api .getBody ( ) ) )
70+ predicate isUninterestingForDataFlowModels ( Callable api ) {
71+ api .getDeclaringType ( ) instanceof J:: Interface and not exists ( api .getBody ( ) )
7072}
7173
72- predicate isRelevantForTypeBasedFlowModels ( Callable api ) { any ( ) }
74+ /**
75+ * Holds if it is irrelevant to generate models for `api` based on type-based analysis.
76+ *
77+ * This serves as an extra filter for the `relevant` predicate.
78+ */
79+ predicate isUninterestingForTypeBasedFlowModels ( Callable api ) { none ( ) }
7380
7481/**
7582 * A class of Callables that are relevant for generating summary, source and sinks models for.
Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ private module ModelPrinting = PrintingImpl<Printing>;
296296 * on the Theorems for Free approach.
297297 */
298298class TypeBasedFlowTargetApi extends Specific:: TargetApiSpecific {
299- TypeBasedFlowTargetApi ( ) { Specific:: isRelevantForTypeBasedFlowModels ( this ) }
299+ TypeBasedFlowTargetApi ( ) { not Specific:: isUninterestingForTypeBasedFlowModels ( this ) }
300300
301301 /**
302302 * Gets the string representation of all type based summaries for `this`
You can’t perform that action at this time.
0 commit comments