@@ -58,6 +58,31 @@ predicate asPartialModel = DataFlowPrivate::Csv::asPartialModel/1;
58
58
59
59
predicate asPartialNegativeModel = DataFlowPrivate:: Csv:: asPartialNegativeModel / 1 ;
60
60
61
+ /**
62
+ * Holds if `t` is a type that is generally used for bulk data in collection types.
63
+ * Eg. char[] is roughly equivalent to string and thus a highly
64
+ * relevant type for model generation.
65
+ */
66
+ private predicate isPrimitiveTypeUsedForBulkData ( CS:: Type t ) {
67
+ t instanceof CS:: ByteType or
68
+ t instanceof CS:: CharType
69
+ }
70
+
71
+ /**
72
+ * Holds if the collection type `ct` is irrelevant for model generation.
73
+ * Collection types where the type of the elements are
74
+ * (1) unknown - are considered relevant.
75
+ * (2) known - at least one the child types should be relevant (a non-simple type
76
+ * or a type used for bulk data)
77
+ */
78
+ private predicate irrelevantCollectionType ( CS:: Type ct ) {
79
+ Collections:: isCollectionType ( ct ) and
80
+ forex ( CS:: Type child | child = ct .getAChild ( ) |
81
+ child instanceof CS:: SimpleType and
82
+ not isPrimitiveTypeUsedForBulkData ( child )
83
+ )
84
+ }
85
+
61
86
/**
62
87
* Holds for type `t` for fields that are relevant as an intermediate
63
88
* read or write step in the data flow analysis.
@@ -66,7 +91,8 @@ predicate asPartialNegativeModel = DataFlowPrivate::Csv::asPartialNegativeModel/
66
91
*/
67
92
predicate isRelevantType ( CS:: Type t ) {
68
93
not t instanceof CS:: SimpleType and
69
- not t instanceof CS:: Enum
94
+ not t instanceof CS:: Enum and
95
+ not irrelevantCollectionType ( t )
70
96
}
71
97
72
98
/**
0 commit comments