[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 27 15:10:45 PDT 2025
================
@@ -3189,16 +3227,21 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
// Note that signed integer inc/dec with width less than int can't
// overflow because of promotion rules; we're just eliding a few steps
// here.
- } else if (E->canOverflow() && type->isSignedIntegerOrEnumerationType()) {
+ } else if (type->isSignedIntegerOrEnumerationType() ||
+ type->isUnsignedIntegerType()) {
value = EmitIncDecConsiderOverflowBehavior(E, value, isInc);
- } else if (E->canOverflow() && type->isUnsignedIntegerType() &&
- CGF.SanOpts.has(SanitizerKind::UnsignedIntegerOverflow) &&
- !excludeOverflowPattern &&
- !CGF.getContext().isTypeIgnoredBySanitizer(
- SanitizerKind::UnsignedIntegerOverflow, E->getType())) {
- value = EmitOverflowCheckedBinOp(createBinOpInfoFromIncDec(
- E, value, isInc, E->getFPFeaturesInEffect(CGF.getLangOpts())));
- } else {
+ }
+ // else if (E->canOverflow() && type->isSignedIntegerOrEnumerationType()) {
----------------
JustinStitt wrote:
whoops, fixed in [8c875bb](https://github.com/llvm/llvm-project/pull/148914/commits/8c875bb1750c1f5fb1ac37ead58fb046501dd9f2)
https://github.com/llvm/llvm-project/pull/148914
More information about the cfe-commits
mailing list