summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2015-12-29 17:40:49 +0000
committerDevin Coughlin <dcoughlin@apple.com>2015-12-29 17:40:49 +0000
commit755baa405065d2264a692467bab5702f83f0c570 (patch)
tree19f1dd043c8ff95b26573151bdce374d069d8e9c /llvm/lib/Transforms/Scalar/JumpThreading.cpp
parent7dd45697ca578874c96d9b938761f8d28d0d525e (diff)
downloadbcm5719-llvm-755baa405065d2264a692467bab5702f83f0c570.tar.gz
bcm5719-llvm-755baa405065d2264a692467bab5702f83f0c570.zip
[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
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud