mirror of
https://github.com/github/codeql.git
synced 2026-05-04 21:25:44 +02:00
C++: Expose PresentIRFunction and override in cpp/count-ir-inconsistencies
The `toString` implementtion that `PresentIRFunction` uses may result in very long strings that may crash the evaluator. Overriding allows is to limit the string size and still suffices when just counting the number of inconsistencies.
This commit is contained in:
@@ -10,6 +10,12 @@ import cpp
|
||||
import semmle.code.cpp.ir.implementation.aliased_ssa.IR
|
||||
import semmle.code.cpp.ir.implementation.aliased_ssa.IRConsistency as IRConsistency
|
||||
|
||||
class PresentIRFunction extends IRConsistency::PresentIRFunction {
|
||||
override string toString() {
|
||||
result = min(string name | name = this.getIRFunction().getFunction().getQualifiedName() | name)
|
||||
}
|
||||
}
|
||||
|
||||
select count(Instruction i | IRConsistency::missingOperand(i, _, _, _) | i) as missingOperand,
|
||||
count(Instruction i | IRConsistency::unexpectedOperand(i, _, _, _) | i) as unexpectedOperand,
|
||||
count(Instruction i | IRConsistency::duplicateOperand(i, _, _, _) | i) as duplicateOperand,
|
||||
|
||||
Reference in New Issue
Block a user