[all-commits] [llvm/llvm-project] 134faa: [analyzer] CStringChecker: Improve warning messages.

NoQ via All-commits all-commits at lists.llvm.org
Wed Dec 11 11:22:43 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 134faae04259b0412a067c73069f61905fc451d7
      https://github.com/llvm/llvm-project/commit/134faae04259b0412a067c73069f61905fc451d7
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    M clang/test/Analysis/bsd-string.c
    M clang/test/Analysis/bstring.c
    M clang/test/Analysis/cstring-ranges.c
    M clang/test/Analysis/null-deref-path-notes.c
    M clang/test/Analysis/null-deref-ps-region.c
    M clang/test/Analysis/string.c

  Log Message:
  -----------
  [analyzer] CStringChecker: Improve warning messages.

Differential Revision: https://reviews.llvm.org/D71321


  Commit: 2b3f2071ec6561c3f10e5291289c47bb3629e354
      https://github.com/llvm/llvm-project/commit/2b3f2071ec6561c3f10e5291289c47bb3629e354
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    M clang/test/Analysis/bstring.c
    M clang/test/Analysis/string.c

  Log Message:
  -----------
  [analyzer] CStringChecker: Fix overly eager assumption that memcmp args overlap.

While analyzing code `memcmp(a, NULL, n);', where `a' has an unconstrained
symbolic value, the analyzer was emitting a warning about the *first* argument
being a null pointer, even though we'd rather have it warn about the *second*
argument.

This happens because CStringChecker first checks whether the two argument
buffers are in fact the same buffer, in order to take the fast path.
This boils down to assuming `a == NULL' to true. Then the subsequent check
for null pointer argument "discovers" that `a' is null.

Don't take the fast path unless we are *sure* that the buffers are the same.
Otherwise proceed as normal.

Differential Revision: https://reviews.llvm.org/D71322


  Commit: b01012b7c8a547c0c4f34734a432ee9ba780a6c8
      https://github.com/llvm/llvm-project/commit/b01012b7c8a547c0c4f34734a432ee9ba780a6c8
  Author: Artem Dergachev <artem.dergachev at gmail.com>
  Date:   2019-12-11 (Wed, 11 Dec 2019)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
    M clang/test/Analysis/localization-aggressive.m

  Log Message:
  -----------
  [analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.

The checker was trying to analyze the body of every method in Objective-C
@implementation clause but the sythesized accessor stubs that were introduced
into it by 2073dd2d have no bodies.


Compare: https://github.com/llvm/llvm-project/compare/b361d3bbcd85...b01012b7c8a5


More information about the All-commits mailing list