Go to file
Devin Coughlin 755baa4050 [analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning nil.
The nullability checker currently allows casts to suppress warnings when a nil
literal is passed as an argument to a parameter annotated as _Nonnull:

  foo((NSString * _Nonnull)nil); // no-warning

It does so by suppressing the diagnostic when the *type* of the argument expression
is _Nonnull -- even when the symbolic value returned is known to be nil.

This commit updates the nullability checker to similarly honor such casts in the analogous
scenario when nil is returned from a function with a _Nonnull return type:

  return (NSString * _Nonnull)nil; // no-warning

This commit also normalizes variable naming between the parameter and return cases and
adds several tests demonstrating the limitations of this suppression mechanism (such as
when nil is cast to _Nonnull and then stored into a local variable without a nullability
qualifier). These tests are marked with FIXMEs.

rdar://problem/23176782

llvm-svn: 256567
2015-12-29 17:40:49 +00:00
clang [analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning nil. 2015-12-29 17:40:49 +00:00
clang-tools-extra [clang-tidy] Fix a use-after-free bug found by asan 2015-12-29 16:14:38 +00:00
compiler-rt [PGO]: Do not update Data->Value field during profile write. 2015-12-29 07:13:59 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc AMDGPU: Add aliases for all VI targets 2015-12-15 18:37:04 +00:00
libcxx [libcxx] Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default constructors. 2015-12-23 08:20:26 +00:00
libcxxabi Add new tests for throwing incomplete pointer types 2015-12-23 07:04:32 +00:00
libunwind Replace cmake check for printf with a check for fopen. 2015-12-10 00:47:08 +00:00
lld Reformat of conditions for calculating r_offset in RelocationSection<ELFT>::writeTo(). NFC. 2015-12-29 16:17:32 +00:00
lldb Update .clang-format file to support break after return type. 2015-12-28 22:09:29 +00:00
llgo [llgo] Force exporting __morestack from llgoi 2015-11-27 04:46:46 +00:00
llvm use range-based for-loops; NFCI 2015-12-29 17:15:22 +00:00
openmp test omp_threadprivate_for.c fixed 2015-12-27 18:14:40 +00:00
polly Do not store scalar accesses in InstructionToAccess 2015-12-22 23:25:11 +00:00