mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Rust: Add Rust SSA inconsistency infrastructure.
This commit is contained in:
14
rust/ql/src/queries/diagnostics/SsaConsistencyCounts.ql
Normal file
14
rust/ql/src/queries/diagnostics/SsaConsistencyCounts.ql
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @name Static single assignment inconsistency counts
|
||||
* @description Counts the number of static single assignment inconsistencies of each type. This query is intended for internal use.
|
||||
* @kind diagnostic
|
||||
* @id rust/diagnostics/ssa-consistency-counts
|
||||
*/
|
||||
|
||||
private import codeql.rust.dataflow.internal.SsaImpl as SsaImpl
|
||||
|
||||
// see also `rust/diagnostics/ssa-consistency`, which lists the
|
||||
// individual inconsistency results.
|
||||
from string type, int num
|
||||
where num = SsaImpl::Consistency::getInconsistencyCounts(type)
|
||||
select type, num
|
||||
@@ -10,6 +10,7 @@ private import codeql.rust.internal.AstConsistency as AstConsistency
|
||||
private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
|
||||
private import codeql.rust.controlflow.internal.CfgConsistency as CfgConsistency
|
||||
private import codeql.rust.dataflow.internal.DataFlowConsistency as DataFlowConsistency
|
||||
private import codeql.rust.dataflow.internal.SsaImpl as SsaImpl
|
||||
private import codeql.rust.Concepts
|
||||
private import codeql.rust.Diagnostics
|
||||
private import codeql.rust.security.SensitiveData
|
||||
@@ -57,6 +58,13 @@ int getTotalCfgInconsistencies() {
|
||||
result = sum(string type | | CfgConsistency::getCfgInconsistencyCounts(type))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a count of the total number of SSA inconsistencies in the database.
|
||||
*/
|
||||
int getTotalSsaInconsistencies() {
|
||||
result = sum(string type | | SsaImpl::Consistency::getInconsistencyCounts(type))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a count of the total number of data flow inconsistencies in the database.
|
||||
*/
|
||||
@@ -142,6 +150,8 @@ predicate inconsistencyStats(string key, int value) {
|
||||
or
|
||||
key = "Inconsistencies - CFG" and value = getTotalCfgInconsistencies()
|
||||
or
|
||||
key = "Inconsistencies - SSA" and value = getTotalSsaInconsistencies()
|
||||
or
|
||||
key = "Inconsistencies - data flow" and value = getTotalDataFlowInconsistencies()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user