[clang] [analyzer] Suppress out of bounds reports after weak loop assumptions (PR #109804)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 24 16:14:13 PDT 2024
=?utf-8?q?DonĂ¡t?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/109804 at github.com>
================
@@ -121,6 +121,25 @@ struct EvalCallOptions {
EvalCallOptions() {}
};
+/// Simple control flow statements like `if` only produce a single state split,
+/// so the fact that they are included in the source code implies that both
+/// branches are possible (at least under some conditions) and the analyzer can
+/// freely assume either of them. (This is not entirely true, because there may
+/// be unmarked logical correlations between `if` statements, but is a good
+/// enough heuristic and the analyzer strongly relies on it.)
+/// On the other hand, in a loop the state may be split repeatedly at each
+/// evaluation of the loop condition, and this can lead to following "weak"
+/// assumptions even though the code does not imply that they're valid and the
+/// programmer intended to cover them.
+/// This function is called to mark the `State` when the engine makes an
+/// assumption which is weak. Checkers may use this heuristical mark to discard
+/// result and reduce the amount of false positives.
----------------
isuckatcs wrote:
```suggestion
/// assumption which is weak. Checkers may use this heuristical mark to discard
/// the result and reduce the amount of false positives.
```
https://github.com/llvm/llvm-project/pull/109804
More information about the cfe-commits
mailing list