[clang] [analyzer] Model concrete floating-point values (PR #214098)
Balázs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 21 10:01:30 PDT 2026
================
@@ -1035,6 +1047,12 @@ void ExprEngine::VisitIncrementDecrementOperator(const UnaryOperator* U,
RHS = svalBuilder.makeArrayIndex(1);
else if (U->getType()->isIntegralOrEnumerationType())
RHS = svalBuilder.makeIntVal(1, U->getType());
+ else if (U->getType()->isRealFloatingType())
+ // C99 6.5.3.1: ++E is equivalent to (E += 1). Then the usual arithmetic
+ // conversions convert the 1 to E's type, so just build it as that type
+ // here.
+ RHS = svalBuilder.makeFloatVal(llvm::APFloat::getOne(
+ getContext().getFloatTypeSemantics(U->getType())));
----------------
steakhal wrote:
This comment applies across this PR. You can be more liberal of using braces.
My rule of thumb is: if any of the subexpressions in the guarded block has any source locations spanning across multiple lines - then the guarded block should have a brace around it.
https://github.com/llvm/llvm-project/pull/214098
More information about the cfe-commits
mailing list