Skip to content

Commit acda73c

Browse files
committed
Improve comment
1 parent cecae35 commit acda73c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10540,6 +10540,8 @@ static std::optional<IntRange> TryGetExprRange(ASTContext &C, const Expr *E,
1054010540
bool Approximate) {
1054110541
E = E->IgnoreParens();
1054210542

10543+
assert(MaxWidth == C.getIntWidth(GetExprType(E)));
10544+
1054310545
// Try a full evaluation first.
1054410546
Expr::EvalResult result;
1054510547
if (E->EvaluateAsRValue(result, C, InConstantContext))
@@ -10805,9 +10807,8 @@ static std::optional<IntRange> TryGetExprRange(ASTContext &C, const Expr *E,
1080510807
return std::nullopt;
1080610808

1080710809
// If the range was previously non-negative, we need an extra bit for the
10808-
// sign bit. If the range was not non-negative, we need an extra bit
10809-
// because the negation of the most-negative value is one bit wider than
10810-
// that value.
10810+
// sign bit. Otherwise, we need an extra bit because the negation of the
10811+
// most-negative value is one bit wider than that value.
1081110812
return IntRange(std::min(SubRange->Width + 1, MaxWidth), false);
1081210813
}
1081310814

0 commit comments

Comments
 (0)