diff options
| author | Gabor Horvath <xazax.hun@gmail.com> | 2015-08-27 18:49:07 +0000 |
|---|---|---|
| committer | Gabor Horvath <xazax.hun@gmail.com> | 2015-08-27 18:49:07 +0000 |
| commit | 8d3ad6b6171531f258d26a250ccf26ecdea96430 (patch) | |
| tree | 8d885a3884955b1610a412cf8cd6aa7d2167077b /clang/test/Analysis | |
| parent | 8251f978d37608441f3270957f3c44caaf2cc2ba (diff) | |
| download | bcm5719-llvm-8d3ad6b6171531f258d26a250ccf26ecdea96430.tar.gz bcm5719-llvm-8d3ad6b6171531f258d26a250ccf26ecdea96430.zip | |
[Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
Differential Revision: http://reviews.llvm.org/D11433
llvm-svn: 246182
Diffstat (limited to 'clang/test/Analysis')
| -rw-r--r-- | clang/test/Analysis/nullability.mm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/test/Analysis/nullability.mm b/clang/test/Analysis/nullability.mm index 4b68e3da995..ec7ea3acada 100644 --- a/clang/test/Analysis/nullability.mm +++ b/clang/test/Analysis/nullability.mm @@ -50,6 +50,8 @@ int *_Nullable returnsNullableInt(); template <typename T> T *eraseNullab(T *p) { return p; } +void takesAttrNonnull(Dummy *p) __attribute((nonnull(1))); + void testBasicRules() { Dummy *p = returnsNullable(); int *ptr = returnsNullableInt(); @@ -73,10 +75,8 @@ void testBasicRules() { Dummy dd(d); break; } - // Here the copy constructor is called, so a reference is initialized with the - // value of p. No ImplicitNullDereference event will be dispatched for this - // case. A followup patch is expected to fix this in NonNullParamChecker. - default: { Dummy d = *p; } break; // No warning. + case 5: takesAttrNonnull(p); break; // expected-warning {{Nullable pointer is passed to}} + default: { Dummy d = *p; } break; // expected-warning {{Nullable pointer is dereferenced}} } if (p) { takesNonnull(p); |

