diff options
author | Devin Coughlin <dcoughlin@apple.com> | 2016-01-18 18:53:33 +0000 |
---|---|---|
committer | Devin Coughlin <dcoughlin@apple.com> | 2016-01-18 18:53:33 +0000 |
commit | 5a3843e5068ab311388f82c73d3cab7cabb99ef5 (patch) | |
tree | d9e5a9a0792080c44a92a953932a136a6826adb3 /llvm/lib/Transforms/Utils/SplitModule.cpp | |
parent | e03126aea40459f292f3d6b34cc863fdf793f660 (diff) | |
download | llvm-5a3843e5068ab311388f82c73d3cab7cabb99ef5.zip llvm-5a3843e5068ab311388f82c73d3cab7cabb99ef5.tar.gz llvm-5a3843e5068ab311388f82c73d3cab7cabb99ef5.tar.bz2 |
[analyzer] Nullability: Look through implicit casts when suppressing warnings on return.
In r256567 I changed the nullability checker to suppress warnings about returning a null
value from a function/method with a non-null return type when the type of the returned
expression is itself nonnull. This enables the programmer to silence nullability warnings
by casting to _Nonnull:
return (SomeObject * _Nonnull)nil;
Unfortunately, under ObjC automated reference counting, Sema adds implicit casts to
_Nonnull to return expressions of nullable or unspecified types in functions with
non-null function/method return types. With r256567, these casts cause all nullability
warnings for returns of reference-counted types to be suppressed under ARC, leading to
false negatives.
This commit updates the nullability checker to look through implicit casts before
determining the type of the returned expression. It also updates the tests to turn on
ARC for the nullability_nullonly.mm testfile and adds a new testfile to test when ARC
is turned off.
rdar://problem/24200117
llvm-svn: 258061
Diffstat (limited to 'llvm/lib/Transforms/Utils/SplitModule.cpp')
0 files changed, 0 insertions, 0 deletions