summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/nonnull.c
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-12-11 19:35:42 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-12-11 19:35:42 +0000
commit2521f36e5ddcadf8dc4bd9803c4ac74fc276f046 (patch)
treef084494154ac1b68b18f8423efcc549b13838502 /clang/test/Sema/nonnull.c
parentd919698caaa57cc8ed9667f75cf3bee7b1779f0e (diff)
downloadbcm5719-llvm-2521f36e5ddcadf8dc4bd9803c4ac74fc276f046.tar.gz
bcm5719-llvm-2521f36e5ddcadf8dc4bd9803c4ac74fc276f046.zip
When checking for nonnull parameter attributes, also check the ParmVarDecl since the attribute may reside there, instead of just on the FunctionDecl. Fixes PR21668.
llvm-svn: 224039
Diffstat (limited to 'clang/test/Sema/nonnull.c')
-rw-r--r--clang/test/Sema/nonnull.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Sema/nonnull.c b/clang/test/Sema/nonnull.c
index de47e9664ca..4b3df8518cf 100644
--- a/clang/test/Sema/nonnull.c
+++ b/clang/test/Sema/nonnull.c
@@ -141,3 +141,15 @@ void yet_another_evil_nonnull_func(int* pointer)
}
}
+void pr21668_1(__attribute__((nonnull)) const char *p, const char *s) {
+ if (p) // expected-warning {{nonnull parameter 'p' will evaluate to 'true' on first encounter}}
+ ;
+ if (s) // No warning
+ ;
+}
+
+void pr21668_2(__attribute__((nonnull)) const char *p) {
+ p = 0;
+ if (p) // No warning
+ ;
+}
OpenPOWER on IntegriCloud