[all-commits] [llvm/llvm-project] 360ced: [analyzer] Ignore IncompleteArrayTypes in getStati...

Balazs Benics via All-commits all-commits at lists.llvm.org
Wed Aug 25 07:14:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 360ced3b8fd2cfb9f2a26deb739e6c381e98b9a5
      https://github.com/llvm/llvm-project/commit/360ced3b8fd2cfb9f2a26deb739e6c381e98b9a5
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2021-08-25 (Wed, 25 Aug 2021)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    A clang/test/Analysis/flexible-array-members.c

  Log Message:
  -----------
  [analyzer] Ignore IncompleteArrayTypes in getStaticSize() for FAMs

Currently only `ConstantArrayType` is considered for flexible array
members (FAMs) in `getStaticSize()`.
However, `IncompleteArrayType` also shows up in practice as FAMs.

This patch will ignore the `IncompleteArrayType` and return Unknown
for that case as well. This way it will be at least consistent with
the current behavior until we start modeling them accurately.

I'm expecting that this will resolve a bunch of false-positives
internally, caused by the `ArrayBoundV2`.

Reviewed By: ASDenysPetrov

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




More information about the All-commits mailing list