]> granicus.if.org Git - clang/commit
[analyzer] pr28449: Fix support for various array initializers.
authorArtem Dergachev <artem.dergachev@gmail.com>
Fri, 13 Oct 2017 20:54:56 +0000 (20:54 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Fri, 13 Oct 2017 20:54:56 +0000 (20:54 +0000)
commit68943cdc1ab30062480ab3962b78c1550fa98643
treeecdbd18eb10a1a542b50feed715e1ae4268364bc
parent89ba86c158ce787d14f0352b2bffc6bacd71d02e
[analyzer] pr28449: Fix support for various array initializers.

In some cases the analyzer didn't expect an array-type variable to be
initialized with anything other than a string literal. The patch essentially
removes the assertion, and ensures relatively sane behavior.

There is a bigger problem with these initializers. Currently our memory model
(RegionStore) is being ordered to initialize the array with a region that
is assumed to be storing the initializer rvalue, and it guesses to copy
the contents of that region to the array variable. However, it would make
more sense for RegionStore to receive the correct initializer in the first
place. This problem isn't addressed with this patch.

rdar://problem/27248428
Differential Revision: https://reviews.llvm.org/D23963

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315750 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/RegionStore.cpp
test/Analysis/compound-literals.c [new file with mode: 0644]
test/Analysis/objc-encode.m [new file with mode: 0644]