diff options
author | Jordan Rose <jordan_rose@apple.com> | 2014-02-11 17:27:59 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2014-02-11 17:27:59 +0000 |
commit | c939907a5af701aae3ebae452251520b88060694 (patch) | |
tree | 7d98466bb91c98f8b55fe3bdbe7d4bd9f9c75f9d /clang/test/Sema/nonnull.c | |
parent | 1515a48e1431115b99bec216e29c204847294b14 (diff) | |
download | bcm5719-llvm-c939907a5af701aae3ebae452251520b88060694.tar.gz bcm5719-llvm-c939907a5af701aae3ebae452251520b88060694.zip |
'nonnull(1)' on a block parameter should apply to the block's argument.
Thanks to r199467, __attribute__((nonnull)) (without arguments) can apply
directly to parameters, instead of being applied to the whole function.
However, the old form of nonnull (with an argument index) could also apply
to the arguments of function and block pointers, and both of these can be
passed as parameters.
Now, if 'nonnull' with an argument is found on a parameter, /and/ the
parameter is a function or block pointer, it is handled the old way.
PR18795
llvm-svn: 201162
Diffstat (limited to 'clang/test/Sema/nonnull.c')
-rw-r--r-- | clang/test/Sema/nonnull.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/nonnull.c b/clang/test/Sema/nonnull.c index 784fd7d08f7..0e92654c283 100644 --- a/clang/test/Sema/nonnull.c +++ b/clang/test/Sema/nonnull.c @@ -45,3 +45,11 @@ void *test_bad_returns_null(void) { return 0; // expected-warning {{null returned from function that requires a non-null return value}} } +void PR18795(int (*g)(const char *h, ...) __attribute__((nonnull(1))) __attribute__((nonnull))) { + g(0); // expected-warning{{null passed to a callee which requires a non-null argument}} +} +void PR18795_helper() { + PR18795(0); // expected-warning{{null passed to a callee which requires a non-null argument}} +} + + |