@@ -35,6 +35,9 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
35
35
result = n .asExpr ( ) .getEnclosingDeclaration ( )
36
36
}
37
37
38
+ /** Gets `api` if it is relevant. */
39
+ private Callable liftedImpl ( Callable api ) { result = api and relevant ( api ) }
40
+
38
41
private predicate hasManualSummaryModel ( Callable api ) {
39
42
api = any ( FlowSummaryImpl:: Public:: SummarizedCallable sc | sc .applyManualModel ( ) ) or
40
43
api = any ( FlowSummaryImpl:: Public:: NeutralSummaryCallable sc | sc .hasManualModel ( ) )
@@ -48,13 +51,49 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
48
51
api = any ( FlowSummaryImpl:: Public:: NeutralSinkCallable sc | sc .hasManualModel ( ) )
49
52
}
50
53
51
- private predicate relevant ( Callable api ) { api .fromSource ( ) }
54
+ /**
55
+ * Holds if `f` is a "private" function.
56
+ *
57
+ * A "private" function does not contribute any models as it is assumed
58
+ * to be an implementation detail of some other "public" function for which
59
+ * we will generate a summary.
60
+ */
61
+ private predicate isPrivate ( Function f ) {
62
+ f .getNamespace ( ) .getParentNamespace * ( ) .isAnonymous ( )
63
+ or
64
+ exists ( MemberFunction mf | mf = f |
65
+ mf .isPrivate ( )
66
+ or
67
+ mf .isProtected ( )
68
+ )
69
+ or
70
+ f .isStatic ( )
71
+ }
72
+
73
+ private predicate isUninterestingForModels ( Callable api ) {
74
+ // Note: This also makes all global/static-local variables
75
+ // not relevant (which is good!)
76
+ not api .( Function ) .hasDefinition ( )
77
+ or
78
+ isPrivate ( api )
79
+ or
80
+ api instanceof Destructor
81
+ or
82
+ api = any ( LambdaExpression lambda ) .getLambdaFunction ( )
83
+ or
84
+ api .isFromUninstantiatedTemplate ( _)
85
+ }
86
+
87
+ private predicate relevant ( Callable api ) {
88
+ api .fromSource ( ) and
89
+ not isUninterestingForModels ( api )
90
+ }
52
91
53
92
class SummaryTargetApi extends Callable {
54
93
private Callable lift ;
55
94
56
95
SummaryTargetApi ( ) {
57
- lift = this and
96
+ lift = liftedImpl ( this ) and
58
97
not hasManualSummaryModel ( lift )
59
98
}
60
99
@@ -327,34 +366,7 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
327
366
)
328
367
}
329
368
330
- /**
331
- * Holds if `f` is a "private" function.
332
- *
333
- * A "private" function does not contribute any models as it is assumed
334
- * to be an implementation detail of some other "public" function for which
335
- * we will generate a summary.
336
- */
337
- private predicate isPrivate ( Function f ) {
338
- f .getNamespace ( ) .getParentNamespace * ( ) .isAnonymous ( )
339
- or
340
- f .( MemberFunction ) .isPrivate ( )
341
- or
342
- f .isStatic ( )
343
- }
344
-
345
- predicate isUninterestingForDataFlowModels ( Callable api ) {
346
- // Note: This also makes all global/static-local variables
347
- // uninteresting (which is good!)
348
- not api .( Function ) .hasDefinition ( )
349
- or
350
- isPrivate ( api )
351
- or
352
- api instanceof Destructor
353
- or
354
- api = any ( LambdaExpression lambda ) .getLambdaFunction ( )
355
- or
356
- api .isFromUninstantiatedTemplate ( _)
357
- }
369
+ predicate isUninterestingForDataFlowModels ( Callable api ) { none ( ) }
358
370
359
371
predicate isUninterestingForHeuristicDataFlowModels ( Callable api ) {
360
372
isUninterestingForDataFlowModels ( api )
0 commit comments