File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
csharp/ql/lib/semmle/code/csharp/dataflow/internal Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -83,13 +83,26 @@ newtype TReturnKind =
83
83
)
84
84
}
85
85
86
+ /**
87
+ * Holds if the summary for `c` should be used for dataflow analysis.
88
+ */
89
+ predicate useFlowSummary ( FlowSummary:: SummarizedCallable c ) {
90
+ not c .fromSource ( )
91
+ or
92
+ c .fromSource ( ) and not c .isAutoGenerated ( )
93
+ }
94
+
86
95
private module Cached {
96
+ /**
97
+ * The following heuristic is used to rank when to use source code or when to use summaries for DataFlowCallables.
98
+ * 1. Use hand written summaries.
99
+ * 2. Use source code.
100
+ * 3. Use auto generated summaries.
101
+ */
87
102
cached
88
103
newtype TDataFlowCallable =
89
- TDotNetCallable ( DotNet:: Callable c ) {
90
- c .isUnboundDeclaration ( ) and not c instanceof FlowSummary:: SummarizedCallable
91
- } or
92
- TSummarizedCallable ( FlowSummary:: SummarizedCallable c )
104
+ TDotNetCallable ( DotNet:: Callable c ) { c .isUnboundDeclaration ( ) and not useFlowSummary ( c ) } or
105
+ TSummarizedCallable ( FlowSummary:: SummarizedCallable c ) { useFlowSummary ( c ) }
93
106
94
107
cached
95
108
newtype TDataFlowCall =
Original file line number Diff line number Diff line change @@ -743,9 +743,11 @@ private module Cached {
743
743
FlowSummaryImpl:: Public:: SummarizedCallable c ,
744
744
FlowSummaryImpl:: Private:: SummaryNodeState state
745
745
) {
746
+ useFlowSummary ( c ) and
746
747
FlowSummaryImpl:: Private:: summaryNodeRange ( c , state )
747
748
} or
748
749
TSummaryParameterNode ( FlowSummaryImpl:: Public:: SummarizedCallable c , ParameterPosition pos ) {
750
+ useFlowSummary ( c ) and
749
751
FlowSummaryImpl:: Private:: summaryParameterNodeRange ( c , pos )
750
752
} or
751
753
TParamsArgumentNode ( ControlFlow:: Node callCfn ) {
You can’t perform that action at this time.
0 commit comments