[all-commits] [llvm/llvm-project] edbc1f: [analyzer] Add option assume-at-least-one-iteratio...

Donát Nagy via All-commits all-commits at lists.llvm.org
Wed Feb 12 02:56:24 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: edbc1fb228acd7746d91cd72d476c063704504b8
      https://github.com/llvm/llvm-project/commit/edbc1fb228acd7746d91cd72d476c063704504b8
  Author: Donát Nagy <donat.nagy at ericsson.com>
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/test/Analysis/analyzer-config.c
    M clang/test/Analysis/loop-assumptions.c

  Log Message:
  -----------
  [analyzer] Add option assume-at-least-one-iteration (#125494)

This commit adds the new analyzer option
`assume-at-least-one-iteration`, which is `false` by default, but can be
set to `true` to ensure that the analyzer always assumes at least one
iteration in loops.

In some situations this "loop is skipped" execution path is an important
corner case that may evade the notice of the developer and hide
significant bugs -- however, there are also many situations where it's
guaranteed that at least one iteration will happen (e.g. some data
structure is always nonempty), but the analyzer cannot realize this and
will produce false positives when it assumes that the loop is skipped.

This commit refactors some logic around the implementation of the new
feature, but the only functional change is introducing the new analyzer
option. If the new option is left in its default state (false), then the
analysis is functionally equivalent to an analysis done with a version
before this commit.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list