Go to file
Artem Dergachev 9d3ca9a5ae [analyzer] Fix zero-initialization of stack VLAs under ObjC ARC.
Using ARC, strong, weak, and autoreleasing stack variables are implicitly
initialized with nil. This includes variable-length arrays of Objective-C object
pointers. However, in the analyzer we don't zero-initialize them. We used to,
but it accidentally regressed after r289618.

Under ARC, the array variable's initializer within DeclStmt is an
ImplicitValueInitExpr. Environment doesn't maintain any bindings for this
expression kind - instead it always knows that it's a known constant
(0 in our case), so it just returns the known value by calling
SValBuilder::makeZeroVal() (see EnvironmentManager::getSVal().
Commit r289618 had introduced reasonable behavior of SValBuilder::makeZeroVal()
for the arrays, which produces a zero-length compoundVal{}. When such value
is bound to arrays, in RegionStoreManager::bindArray() "remaining" items in the
array are default-initialized with zero, as in
RegionStoreManager::setImplicitDefaultValue(). The similar mechanism works when
an array is initialized by an initializer list that is too short, eg.
  int a[3] = { 1, 2 };
would result in a[2] initialized with 0. However, in case of variable-length
arrays it didn't know if any more items need to be added,
because, well, the length is variable.

Add the default binding anyway, regardless of how many actually need
to be added. We don't really care how many, because the default binding covers
the whole array anyway.

Differential Revision: https://reviews.llvm.org/D41478
rdar://problem/35477763

llvm-svn: 321290
2017-12-21 18:43:02 +00:00
clang [analyzer] Fix zero-initialization of stack VLAs under ObjC ARC. 2017-12-21 18:43:02 +00:00
clang-tools-extra [clangd] Fix use after free. 2017-12-21 17:51:35 +00:00
compiler-rt [mips][compiler-rt] Provide 64bit atomic add and sub 2017-12-21 13:05:41 +00:00
debuginfo-tests [debuginfo-tests] Support moving debuginfo-tests to llvm/projects 2017-12-12 16:54:20 +00:00
libclc configure.py: Add gfx900 (Vega, Raven) 2017-11-27 11:14:06 +00:00
libcxx Fix the definitions of 'reference' and 'pointer' in string_view that no one uses :-). Thanks to K-ballo for the catch. 2017-12-20 16:31:40 +00:00
libcxxabi [libcxxabi] Pass LIBCXXABI_SYSROOT and LIBCXXABI_GCC_TOOLCHAIN to lit 2017-12-12 01:20:37 +00:00
libunwind [libunwind][MIPS]: Add support for unwinding in O32 and N64 processes. 2017-12-12 21:43:36 +00:00
lld [WebAssmebly] Fix references to weak aliases 2017-12-21 02:43:39 +00:00
lldb Make one more test redhat-compatible 2017-12-21 15:52:59 +00:00
llgo irgen: Create functions instead of global variables for builtin hash and equal algorithms. 2017-06-04 22:11:28 +00:00
llvm [X86][SSE] Split large PAVGB/PAVGW vectors to legal widths 2017-12-21 18:12:31 +00:00
openmp Add missing test case from D41171 commit 2017-12-21 14:36:36 +00:00
parallel-libs [Axccel] Remove -Wno-missing-braces in build 2016-12-19 21:34:07 +00:00
polly [ScopBuilder] Split statements on encountering store instructions. 2017-12-11 12:51:24 +00:00
README.md Add an svn project to contain the files that appear at the root of the 2017-10-19 21:09:49 +00:00

README.md

Low Level Virtual Machine (LLVM)

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.