[all-commits] [llvm/llvm-project] 257754: [NFC][analyzer] OOB test consolidation II: constra...

Donát Nagy via All-commits all-commits at lists.llvm.org
Wed Feb 12 07:18:48 PST 2025


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

  Changed paths:
    M clang/test/Analysis/out-of-bounds-constraint-check.c
    M clang/test/Analysis/out-of-bounds.c

  Log Message:
  -----------
  [NFC][analyzer] OOB test consolidation II: constraint checking (#126748)

This commit heavily refactors `out-of-bounds-constraint-check.c`:
1. The complex combinations of several `clang_analyzer_eval` calls were
replaced by `clang_analyzer_value`, which can directly query the range
of a symbol.
2. Testcases were renamed to a (hopefully) more consistent scheme.
3. The use of `size_t` as an argument type was replaced by `unsigned
long long`, which is usually a no-op, but seems to be a better choice if
I look for `64u` in the output of `clang_analyzer_value`.
4. The single "dynamic extent" case was generalized into a full set of
tests that use `malloc`.
5. Half of the testcases (the ones that don't use `malloc`) were changed
to use an `int[5]` array instead of a string literal. After this change
the tests in this file cover every functionality that was tested by the
testcases `test_assume_after_access{,2}` in the file `out-of-bounds.c`
so I was able to delete those two testcases (and therefore consolidate
the validation of these constraints within a single test file).

This is the second commit in a series that reorganizes the tests of
`security.ArrayBound` to system that's easier to understand and
maintain. (Note that this file wasn't significantly modified by the
recent commit 6e17ed9b04e5523cc910bf171c3122dcc64b86db which renamed
`alpha.security.ArrayBoundV2` to `security.ArrayBound`; but I still felt
that this cleanup may be useful.)



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