File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import cpp
2+ import codeql.util.ReportStats
3+
4+ module CallTargetStats implements StatsSig {
5+ private class RelevantCall extends Call {
6+ RelevantCall ( ) { this .getFile ( ) = any ( File f | f .fromSource ( ) and exists ( f .getRelativePath ( ) ) ) }
7+ }
8+
9+ // We assume that calls with an implicit target are calls that could not be
10+ // resolved. This is accurate in the vast amount of cases, but is inaccurate
11+ // for calls that deliberately rely on implicitly declared functions.
12+ private predicate hasImplicitTarget ( RelevantCall call ) {
13+ call .getTarget ( ) .getADeclarationEntry ( ) .isImplicit ( )
14+ }
15+
16+ int getNumberOfOk ( ) { result = count ( RelevantCall call | not hasImplicitTarget ( call ) ) }
17+
18+ int getNumberOfNotOk ( ) { result = count ( RelevantCall call | hasImplicitTarget ( call ) ) }
19+
20+ string getOkText ( ) { result = "calls with call target" }
21+
22+ string getNotOkText ( ) { result = "calls with missing call target" }
23+ }
24+
25+ module CallTargetStatsReport = ReportStats< CallTargetStats > ;
Original file line number Diff line number Diff line change 1+ /**
2+ * @name C/C++ extraction information
3+ * @description Information about the extraction for a C/C++ database
4+ * @kind metric
5+ * @tags summary telemetry
6+ * @id cpp/telemetry/extraction-information
7+ */
8+
9+ import cpp
10+ import DatabaseQuality
11+
12+ from string key , float value
13+ where
14+ (
15+ CallTargetStatsReport:: numberOfOk ( key , value ) or
16+ CallTargetStatsReport:: numberOfNotOk ( key , value ) or
17+ CallTargetStatsReport:: percentageOfOk ( key , value )
18+ ) and
19+ /* Infinity */
20+ value != 1.0 / 0.0 and
21+ /* -Infinity */
22+ value != - 1.0 / 0.0 and
23+ /* NaN */
24+ value != 0.0 / 0.0
25+ select key , value
You can’t perform that action at this time.
0 commit comments