]> granicus.if.org Git - clang/commitdiff
Add another test case for attribute(nonnull) checking.
authorTed Kremenek <kremenek@apple.com>
Thu, 4 Dec 2008 18:35:53 +0000 (18:35 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 4 Dec 2008 18:35:53 +0000 (18:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60544 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/null-deref-ps.c

index c3bf4444207732a442a273f437136b67cb4b0c00..3d912dcd0889c20bad8f5457f1e2a19daab7ff8b 100644 (file)
@@ -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) {