[PATCH] D103440: [WIP][analyzer] Introduce range-based reasoning for addition operator
Manas Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 22 17:05:57 PDT 2021
manas added a comment.
Regarding the tweakings in `constant-folding.c`, I have refrained from using cases which were resulting in `UNKNOWN` assertions as they were the primary reason for constraints being propagated.
================
Comment at: clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp:1075-1076
+ /// LHSOpd binop RHSOpd == Result, where binop is any binary operation
+ bool hasOverflowed(llvm::APSInt LHSOpd, llvm::APSInt RHSOpd,
+ llvm::APSInt &Result, QualType T) {
+ llvm::APSInt Zero = ValueFactory.getAPSIntType(T).getZeroValue();
----------------
We should have these specific functions for other BO as well. Because they will lead us to reason about when `Operand1 binop Operand2` can overflow or not. I was thinking in the direction of having a simpler class which works for this.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103440/new/
https://reviews.llvm.org/D103440
More information about the cfe-commits
mailing list