summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2015-08-27 18:49:07 +0000
committerGabor Horvath <xazax.hun@gmail.com>2015-08-27 18:49:07 +0000
commit8d3ad6b6171531f258d26a250ccf26ecdea96430 (patch)
tree8d885a3884955b1610a412cf8cd6aa7d2167077b /clang/test/Analysis
parent8251f978d37608441f3270957f3c44caaf2cc2ba (diff)
downloadbcm5719-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.mm8
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);
OpenPOWER on IntegriCloud