@@ -35,6 +35,9 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
3535 result = n .asExpr ( ) .getEnclosingDeclaration ( )
3636 }
3737
38+ /** Gets `api` if it is relevant. */
39+ private Callable liftedImpl ( Callable api ) { result = api and relevant ( api ) }
40+
3841 private predicate hasManualSummaryModel ( Callable api ) {
3942 api = any ( FlowSummaryImpl:: Public:: SummarizedCallable sc | sc .applyManualModel ( ) ) or
4043 api = any ( FlowSummaryImpl:: Public:: NeutralSummaryCallable sc | sc .hasManualModel ( ) )
@@ -48,13 +51,49 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
4851 api = any ( FlowSummaryImpl:: Public:: NeutralSinkCallable sc | sc .hasManualModel ( ) )
4952 }
5053
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+ }
5291
5392 class SummaryTargetApi extends Callable {
5493 private Callable lift ;
5594
5695 SummaryTargetApi ( ) {
57- lift = this and
96+ lift = liftedImpl ( this ) and
5897 not hasManualSummaryModel ( lift )
5998 }
6099
@@ -327,34 +366,7 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
327366 )
328367 }
329368
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 ( ) }
358370
359371 predicate isUninterestingForHeuristicDataFlowModels ( Callable api ) {
360372 isUninterestingForDataFlowModels ( api )
0 commit comments