[analyzer] Fix for incorrect handling of 0 length non-POD array construction
authorisuckatcs <65320245+isuckatcs@users.noreply.github.com>
Mon, 22 Aug 2022 12:43:54 +0000 (14:43 +0200)
committerisuckatcs <65320245+isuckatcs@users.noreply.github.com>
Thu, 25 Aug 2022 10:42:02 +0000 (12:42 +0200)
commite3e9082b013ba948e3df6d4a2536df9d04656e76
tree459815e850479912f79f4c39b716700c4735aa55
parent14d5ae2038b58830f0565980e20fe0bfd683fb54
[analyzer] Fix for incorrect handling of 0 length non-POD array construction

Prior to this patch when the analyzer encountered a non-POD 0 length array,
it still invoked the constructor for 1 element, which lead to false positives.
This patch makes sure that we no longer construct any elements when we see a
0 length array.

Differential Revision: https://reviews.llvm.org/D131501
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/lib/StaticAnalyzer/Core/RegionStore.cpp
clang/test/Analysis/array-init-loop.cpp
clang/test/Analysis/dtor-array.cpp
clang/test/Analysis/flexible-array-member.cpp [new file with mode: 0644]
clang/test/Analysis/zero-size-non-pod-array.cpp [new file with mode: 0644]