From 3f0e5c88d9ce11b24a4f97b2419e9c5f1085ab28 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 4 Dec 2008 18:35:53 +0000 Subject: [PATCH] Add another test case for attribute(nonnull) checking. llvm-svn: 60544 --- clang/test/Analysis/null-deref-ps.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/clang/test/Analysis/null-deref-ps.c b/clang/test/Analysis/null-deref-ps.c index c3bf44442077..3d912dcd0889 100644 --- a/clang/test/Analysis/null-deref-ps.c +++ b/clang/test/Analysis/null-deref-ps.c @@ -65,6 +65,15 @@ int f6(int *p) { : bar(p, 0); // no-warning } +int bar2(int* p, int q) __attribute__((nonnull(1))); + +int f6b(int *p) { + return !p ? bar2(p, 1) // expected-warning {{Null pointer passed as an argument to a 'nonnull' parameter}} + : bar2(p, 0); // no-warning +} + + + int* qux(); int f7(int x) {