Skip to content

Commit 533a42f

Browse files
authored
Update Sanitizers.cpp
1 parent 9d5ca8f commit 533a42f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

clang/lib/Basic/Sanitizers.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,18 @@ void SanitizerMaskCutoffs::clear(SanitizerMask K) { set(K, 0); }
4646

4747
std::optional<std::vector<unsigned>>
4848
SanitizerMaskCutoffs::getAllScaled(unsigned ScalingFactor) const {
49-
std::vector<int> ScaledCutoffs;
49+
std::vector<unsigned> ScaledCutoffs;
5050

5151
bool AnyCutoff = false;
5252
for (unsigned int i = 0; i < SanitizerKind::SO_Count; ++i) {
5353
auto C = (*this)[i];
54-
ScaledCutoffs.push_back(C.has_value() ? lround(std::clamp(ScalingFactor, 0.0, 1.0) * *C) : 0);
55-
AnyCutoff |= C.has_value();
54+
if (C.has_value()) {
55+
ScaledCutoffs.push_back(
56+
lround(std::clamp(*C, 0.0, 1.0) * ScalingFactor));
57+
AnyCutoff = true;
58+
} else {
59+
ScaledCutoffs.push_back(0);
60+
}
5661
}
5762

5863
if (AnyCutoff)

0 commit comments

Comments
 (0)