Skip to content

Commit fddbffe

Browse files
committed
C++: autoformat
1 parent 316cb95 commit fddbffe

File tree

5 files changed

+27
-26
lines changed

5 files changed

+27
-26
lines changed

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/SimpleRangeAnalysis.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ private import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticExprS
1010
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysis
1111
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.RangeAnalysisImpl
1212
private import semmle.code.cpp.rangeanalysis.RangeAnalysisUtils
13+
1314
/**
1415
* Gets the lower bound of the expression.
1516
*

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/FloatDelta.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ module FloatDelta implements DeltaSig {
2323
module FloatOverflow implements OverflowSig<FloatDelta> {
2424
predicate semExprDoesNotOverflow(boolean positively, SemExpr expr) {
2525
exists(float lb, float ub, float delta |
26-
typeBounds(expr.getSemType(), lb, ub) and
27-
ConstantStage::initialBounded(expr, any(ConstantBounds::SemZeroBound b), delta, positively, _, _, _)
26+
typeBounds(expr.getSemType(), lb, ub) and
27+
ConstantStage::initialBounded(expr, any(ConstantBounds::SemZeroBound b), delta, positively, _,
28+
_, _)
2829
|
2930
positively = true and delta < ub
3031
or
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import semmle.code.cpp.rangeanalysis.new.internal.semantic.SemanticBound
22
private import RangeAnalysisImpl as Impl
3-
import Impl::Public
3+
import Impl::Public

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisImpl.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
private import RangeAnalysisStage
1+
private import RangeAnalysisStage
22
private import RangeAnalysisConstantSpecific
33
private import RangeAnalysisRelativeSpecific
44
private import semmle.code.cpp.rangeanalysis.new.internal.semantic.analysis.FloatDelta
@@ -61,7 +61,6 @@ private newtype TSemReason =
6161
guard = any(RelativeStage::SemCondReason reason).getCond()
6262
}
6363

64-
6564
ConstantStage::SemReason constantReason(SemReason reason) {
6665
result instanceof ConstantStage::SemNoReason and reason instanceof SemNoReason
6766
or
@@ -73,6 +72,7 @@ RelativeStage::SemReason relativeReason(SemReason reason) {
7372
or
7473
result.(RelativeStage::SemCondReason).getCond() = reason.(SemCondReason).getCond()
7574
}
75+
7676
import Public
7777

7878
module Public {

cpp/ql/lib/semmle/code/cpp/rangeanalysis/new/internal/semantic/analysis/RangeAnalysisRelativeSpecific.qll

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,33 +30,32 @@ module CppLangImplRelative implements LangSig<FloatDelta> {
3030
typeBounds(e.getSemType(), lb, ub) and
3131
(
3232
upper = false and
33-
delta < lb or
33+
delta < lb
34+
or
3435
upper = true and
3536
delta > ub
3637
)
3738
)
3839
}
3940

40-
41-
private predicate typeBounds(SemType t, float lb, float ub) {
42-
exists(SemIntegerType integralType, float limit |
43-
integralType = t and limit = 2.pow(8 * integralType.getByteSize())
44-
|
45-
if integralType instanceof SemBooleanType
46-
then lb = 0 and ub = 1
47-
else
48-
if integralType.isSigned()
49-
then (
50-
lb = -(limit / 2) and ub = (limit / 2) - 1
51-
) else (
52-
lb = 0 and ub = limit - 1
53-
)
54-
)
55-
or
56-
// This covers all floating point types. The range is (-Inf, +Inf).
57-
t instanceof SemFloatingPointType and lb = -(1.0 / 0.0) and ub = 1.0 / 0.0
58-
}
59-
41+
private predicate typeBounds(SemType t, float lb, float ub) {
42+
exists(SemIntegerType integralType, float limit |
43+
integralType = t and limit = 2.pow(8 * integralType.getByteSize())
44+
|
45+
if integralType instanceof SemBooleanType
46+
then lb = 0 and ub = 1
47+
else
48+
if integralType.isSigned()
49+
then (
50+
lb = -(limit / 2) and ub = (limit / 2) - 1
51+
) else (
52+
lb = 0 and ub = limit - 1
53+
)
54+
)
55+
or
56+
// This covers all floating point types. The range is (-Inf, +Inf).
57+
t instanceof SemFloatingPointType and lb = -(1.0 / 0.0) and ub = 1.0 / 0.0
58+
}
6059

6160
/**
6261
* Ignore any inferred zero lower bound on this expression.

0 commit comments

Comments
 (0)