C++: NoSpecifiedEstimateReasonUnspecified...

This commit is contained in:
Paolo Tranquilli
2021-12-14 14:01:18 +00:00
committed by GitHub
parent 4a85b9b0cc
commit 8ac34f3db5
2 changed files with 6 additions and 6 deletions

View File

@@ -10,7 +10,7 @@ private import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
private import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
private newtype TBufferWriteEstimationReason =
TNoSpecifiedEstimateReason() or
TUnspecifiedEstimateReason() or
TTypeBoundsAnalysis() or
TValueFlowAnalysis()
@@ -40,8 +40,8 @@ abstract class BufferWriteEstimationReason extends TBufferWriteEstimationReason
* classes derived from BufferWrite and overriding `getMaxData/0` still work with the
* queries as intended.
*/
class NoSpecifiedEstimateReason extends BufferWriteEstimationReason, TNoSpecifiedEstimateReason {
override string toString() { result = "NoSpecifiedEstimateReason" }
class UnspecifiedEstimateReason extends BufferWriteEstimationReason, TUnspecifiedEstimateReason {
override string toString() { result = "UnspecifiedEstimateReason" }
override string getDescription() { result = "no reason specified" }
@@ -62,7 +62,7 @@ class TypeBoundsAnalysis extends BufferWriteEstimationReason, TTypeBoundsAnalysi
override string getDescription() { result = "based on type bounds" }
override BufferWriteEstimationReason combineWith(BufferWriteEstimationReason other) {
other != TNoSpecifiedEstimateReason() and result = TTypeBoundsAnalysis()
other != TUnspecifiedEstimateReason() and result = TTypeBoundsAnalysis()
}
}
@@ -82,7 +82,7 @@ class ValueFlowAnalysis extends BufferWriteEstimationReason, TValueFlowAnalysis
override string getDescription() { result = "based on flow analysis of value bounds" }
override BufferWriteEstimationReason combineWith(BufferWriteEstimationReason other) {
other != TNoSpecifiedEstimateReason() and result = other
other != TUnspecifiedEstimateReason() and result = other
}
}

View File

@@ -76,7 +76,7 @@ abstract class BufferWrite extends Expr {
* can be found), specifying the reason for the estimation.
*/
int getMaxData(BufferWriteEstimationReason reason) {
reason instanceof NoSpecifiedEstimateReason and result = getMaxData()
reason instanceof UnspecifiedEstimateReason and result = getMaxData()
}
/**